1、springMVC和boot通用配置:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD SQL MAP Config 3.1//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="callSettersOnNulls" value="true"/>
</settings>
</configuration>
2、boot专用配置:
在application.properties中添加:
mybatis.configuration.call-setters-on-nulls=true
3、每个sql返回字段做判断(通用boot、mvc、比较麻烦):
IFNULL(name,'') as name