<update id="update" parameterType="Employee">
UPDATE employee
<!-- <set>--> 方式一
<trim prefix="SET" suffixOverrides=","> 方式二
<if test="name!=null and name!=''">
name=#{name}
</if>
<if test="age!=null">
age=#{age}
</if>
<if test="sex!=null">
sex=#{sex}
</if>
</trim>
<!-- </set>-->
WHERE id=#{id}
</update>
mybatis动态修改sql
最新推荐文章于 2024-05-16 14:13:04 发布