mybatis更新操作添加if
如果某条件为空
<update id="updata">
update user set <if test="username!=null">
username=#{username},
</if> age=#{age},address=#{address} where id=#{id}
如果某条件为空
<update id="updata">
update user set <if test="username!=null">
username=#{username},
</if> age=#{age},address=#{address} where id=#{id}