mybatis中update时set和if的用法

<update id="updateByPrimaryKeySelective" parameterType="org.wcy.gen.model.College" >
        update college
        <set >
            <if test="collegename != null" >
                collegeName = #{collegename,jdbcType=VARCHAR},
            </if>
        </set>
        where collegeID = #{collegeid,jdbcType=INTEGER}
</update>

update时set和if的用法 每个修改都加逗号 set能够智能的去掉最后一个逗号

参考:https://blog.csdn.net/qq_39940205/article/details/79517742

猜你喜欢

转载自blog.csdn.net/weixin_40569991/article/details/88725771