实体类的字段类型全部使用 包装类
int > Integer
long > Long
double > Double
float > Float
主要的原因在于: 默认值的问题。
比如设备列表需要排序的功能。那么 deviceSort 字段在更新的时候 0 也必须更新。
int 的默认值就是 0;
mapper.xml 中不能过滤 0 ,因为业务上需要有的排序设置为 0
所以将 deviceSort 的类型设置为 Integer
进行 null 判断就可以解决这个问题
<if test="deviceSort != null">device_sort = #{deviceSort},</if>