mybatis动态更新sql语句

ⅰ亾dé卋堺 提交于 2019-12-27 16:38:13
注意参数是实体
<!--更新-->
<update id="updateOne" parameterType="com.entity.GovernmentDetail">
    UPDATE GOVERNMENT_DETAIL
    <trim prefix="set" suffixOverrides=",">
        <if test="UNIT_TYPE!=null">unitType=#{unitType},</if>
        <if test="PLAT_CODE!=null">plateCode=#{plateCode},</if>
        <if test="DESCRIP!=null">descrip=#{descrip},</if>
        <if test="BUSINESS_GUID!=null">businessGuid=#{businessGuid},</if>
        <if test="HOT_LINE!=null">hotLine=#{hotLine},</if>
        <if test="LINE_ADRESS!=null">lineAdress=#{lineAdress},</if>
        <if test="EXTEND1!=null">extend1=#{extend1},</if>
        <if test="EXTEND2!=null">extend2=#{extend2},</if>
    </trim>
    WHERE ID=#{id}
</update>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!