mybatis resultType=map时,value为null时返回结果没有对应的key

mybatis.xml 配置文件设置

    <configuration>  
    <settings>  
      <!-- 在null时也调用 setter,适应于返回Map,3.2版本以上可用 -->  
        <setting name="callSettersOnNulls" value="true"/>  
    </settings>  
    </configuration>

spring boot 设置

#key为null时也会映射key
mybatis.configuration.call-setters-on-nulls=true

猜你喜欢

转载自www.cnblogs.com/wilwei/p/10244722.html