First, springMVC boot and general configuration: (Mybatis.xml)
<?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>
The second, boot-specific configuration:
In application.properties added: mybatis.configuration.call-setters to true-ON-NULLS =
Third, each field sql returns to make a judgment (Universal boot, mvc, more trouble):
IFNULL(name,'') as name