MyBatis Null Value Handling Guide
In MyBatis, the nullValue attribute can be used to set the method for handling empty values. This attribute can be used in the
<resultMap id="userResultMap" type="User">
<result property="id" column="id" nullValue="0" />
<result property="name" column="name" nullValue="Unknown" />
<result property="age" column="age" nullValue="-1" />
</resultMap>
In the example above, if a field in the query result is null, MyBatis will set the value of that field to 0, Unknown, or -1 instead of keeping it as null.