mybatis中resultType返回值为java.util.Map返回结果字段值为null的字段会直接不显示怎么办?
mybatis:
mapper-locations: classpath:/mapper/*.xml
configuration:
map-underscore-to-camel-case: true
call-setters-on-nulls: true #mybatis返回类型为map返回字段值为null的字段
配置一下mybatis的配置文件即可
call-setters-on-nulls: true #mybatis返回类型为map返回字段值为null的字段
将call-setters-on-nulls改为true即可
本文解决MyBatis中使用Map作为返回类型时,字段值为null不被显示的问题。通过设置mybatis配置文件中的call-setters-on-nulls参数为true,确保即使字段值为null也能正确返回。
1万+





