MybatisPlus之trim标签
<trim prefix="" suffix="" suffixOverrides="" prefixOverrides=""></trim>
prefix:在trim标签内sql语句加上前缀。
suffix:在trim标签内sql语句加上后缀。
prefixOverrides:指定去除多余的前缀内容
suffixOverrides:指定去除多余的后缀内容,如:suffixOverrides=",",去除trim标签内sql语句多余的后缀","。
<update id="updateWork" >
update
contract_work cw
<trim prefix="set" suffixOverrides="," suffix="where cw.id = #{work.id}">
cw.value = #{work.value},
cw.begin_date = #{work.beginDate},
cw.end_date = #{work.beginDate},
cw.meet_topic = #{work.meetTopic},
cw.meet_place = #{work.meetPlace},
cw.serve_object = #{work.serveObject},
cw.check_serial = #{work.checkSerial},
cw.name = #{work.name},
cw.modifier_id = #{work.modifierId},
cw.gmt_modified = #{work.gmtModified} ,
</trim>
</update>
翻译过后的最终sql就是:
update contract_work cw set cw.value = #{work.value},cw.begin_date = #{work.beginDate} ..省略逗号..cw.gmt_modified = #{work.gmtModified}
标签:trim,MybatisPlus,标签,work,value,sql,prim,cw
From: https://www.cnblogs.com/zheng-s/p/17705056.html