mybatis结果封装到hashmap中没有null的数据

1、在ssm框架中

在mybatis-config.xml配置文件中加下面这句代码即可解决 

<setting name="callSettersOnNulls" value="true"/>  

2、在springboot中

mybatis:
  type-aliases-package: com.hoohui.houtai.model
  mapper-locations: classpath:mapper/*.xml
#mybatis解决返回为HashMap或者LinkedHashMap时,某些结果集的字段null,导致map中少key的问题
  configuration:
    call-setters-on-nulls: true
原文地址:https://www.cnblogs.com/dhrwawa/p/11176613.html