项目使用的SpringBoot、Mybatis-plus
问题描述如题:
执行sql:select userId,name,address,mobile from user
当address为空时,返回结果map中只有三个字段,userId、name、address
解决方法:
修改yml文件中Mybatis的配置,设置call-setters-on-nulls为true即可
mybatis-plus:
mapper-locations: classpath:mapper/**/*.xml
configuration:
call-setters-on-nulls: true