【BUG修复】com.fasterxml.jackson.databind.exc.InvalidDefinitionException<A>
org.springframework.http.converter.HttpMessageConversionException:Type definition error: [simple type, class com.ruoyi.digital.domain.BbCoordInfo];nested exception is com.fasterxml.jackson.databind.ex
·
org.springframework.http.converter.HttpMessageConversionException:
Type definition error: [simple type, class com.ruoyi.digital.domain.BbCoordInfo];
nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
No serializer found for class com.ruoyi.digital.domain.BbCoordInfo and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.ruoyi.common.core.web.page.TableDataInfo["rows"]->java.util.ArrayList[0])
Caused by:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
No serializer found for class com.ruoyi.digital.domain.BbCoordInfo and no properties discovered to create BeanSerializer
(to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
(through reference chain: com.ruoyi.common.core.web.page.TableDataInfo["rows"]->java.util.ArrayList[0])
今天新写了一个功能,各种表单的联表查询功能,具体的SQL语句如下:
<select id="selectBbCoordDetailList" parameterType="Long" resultType="com.ruoyi.digital.domain.BbCoordInfo">
select g.WS_ID as wsId,g.WS_Name as wsName,b.CID as cId,b.CName as cName ,a.Mac_ID as macId,
c.Mac_Code as macCode,b.coord_x as coordX,b.coord_y as coordY,d.RunStatus as statusCode,
e.status_text as statusText,f.Mac_ConnectIP as macIP from BU_Machine_Coord a
left join BB_Coord b on a.Mac_CoordID = b.CID
left join BU_Machine_BasicInfo c on a.Mac_ID = c.Mac_ID
left join BU_Machine_CurrStatus d on a.Mac_ID = d.Mac_ID
left join BB_Status_Info e on d.RunStatus = e.status_id
left join BU_Machine_IP f on a.Mac_ID = f.Mac_ID
left join BB_WorkShop g on b.WS_ID = g.WS_ID
<where>
b.IsDel = 0
<if test="wsId != null and wsId != ''"> and g.WS_ID = #{wsId}</if>
</where>
order by CID asc
</select>
接口调用地址:
http://192.168.0.192:9203/coord/detail
后台controller代码:
@GetMapping(value = {"/detail","/detail/{wsId}"})
public TableDataInfo getDetailInfo(@PathVariable(value = "wsId",required = false) Long wsId){
startPage();
List<BbCoordInfo> list = bbCoordService.selectBbCoordDetailList(wsId);
return getDataTable(list);
}
实体类:
package com.ruoyi.digital.domain;
import com.ruoyi.common.core.annotation.Excel;
import java.math.BigDecimal;
/**
* @author layman
* @description: 机位详细信息
* @date 2021/11/15
*/
public class BbCoordInfo {
private static final long serialVersionUID = 1L;
/** 车间ID */
private Long wsId;
/** 车间名称 */
@Excel(name = "车间名称")
private String wsName;
}
似乎是缺少序列化。
我看了别的实体类的写法:
public class BbCoord extends BaseEntity
它们都有个 extends BaseEntity
public class BaseEntity implements Serializable
应该是这个导致的,我在我的实体类上添加 extends BaseEntity
,这个报错得到修复。
更多推荐
已为社区贡献17条内容
所有评论(0)