首页 > 移动平台 > 详细

Mybatis下 Mapper(Update)逗号位置

时间:2019-02-12 13:44:08      阅读:616      评论:0      收藏:0      [点我收藏+]
<update id="update" parameterType="map">
        update t_role
        <set> 
        <if test="name != null and name !=‘‘">
            name=#{name},
        </if>
        <if test="msg != null and msg !=‘‘">
            msg=#{msg},
        </if>
        <if test="type != null and type !=‘‘">
            type=#{type},
        </if>
        <if test="creator_id != null and creator_id !=‘‘">
            creator_id=#{creator_id},
        </if>
        <if test="level != null and level !=‘‘">
            level=#{level}
        </if>
</set>
where id=#{id} </update>

使用 <set></set>可以智能去掉最后一个逗号,十分方便!

Mybatis下 Mapper(Update)逗号位置

原文:https://www.cnblogs.com/DeBugger-/p/10364699.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!