实体类定义Integer的字段
private Integer type;
Integer类型传值为0时,在Mapper.xml中被 条件过滤
xml文件if判断不能判断为空,日期也是
否则代码执行不生效
<update id="update">
UPDATE student
<set>
<if test="name !=null and name!=''">
name=#{name},
</if>
<if test="mobile !=null and mobile!=''">
mobile=#{mobile},
</if>
<if test="dates !=null ">
dates=#{dates},
</if>
<if test="type !=null ">
type=#{type},
</if>
</set>
WHERE id=#{id}
</update>