mybatis查询为空的处理
Mybatis配置
springboot:
mybatis.configuration.call-setters-on-nulls=true
xml:
<setting name="callSettersOnNulls" value="true"/>
实体类
实体类封装一般能很好的解决这种问题,默认情况值为null的属性也是会被序列化的,如果实体类也有这种情况,可以尝试添加注解
@JsonInclude(JsonInclude.Include.ALWAYS)(默认策略)
或者
@ok(“json:full”)
后者在内嵌list处理上可能会不生效