update语句

    <update id="updateOrgEntity">
        UPDATE t_base_org t
        <trim prefix="set" suffixOverrides=",">
            <if test="orgCode!=null">t.org_code=#{orgCode},</if>
            <if test="orgName!=null">t.org_name=#{orgName},</if>
            <if test="companyCode!=null">t.company_code=#{companyCode},</if>
            <if test="companyName!=null">t.company_name=#{companyName},</if>
            <if test="province!=null">t.province=#{province},</if>
            <if test="city!=null">t.city=#{city},</if>
            <if test="county!=null">t.county=#{county},</if>
            <if test="street!=null">t.street=#{street},</if>
            <if test="provinceName!=null">t.province_name=#{provinceName},</if>
            <if test="cityName!=null">t.city_name=#{cityName},</if>
            <if test="countyName!=null">t.county_name=#{countyName},</if>
            <if test="streetName!=null">t.street_name=#{streetName},</if>
            <if test="orgAddress!=null">t.org_address=#{orgAddress},</if>
            <if test="orgActive!=null">t.org_active=#{orgActive},</if>
            <if test="orgKind!=null">t.org_kind=#{orgKind},</if>
            <if test="orgPerson!=null">t.org_person=#{orgPerson},</if>
            <if test="orgPersonMobile!=null">t.org_person_mobile=#{orgPersonMobile},</if>
            <if test="modifyTime!=null">t.modify_time=#{modifyTime},</if>
            <if test="modifyUserCode!=null">t.modify_user_code=#{modifyUserCode},</if>
            <if test="modifyUserName!=null">t.modify_user_name=#{modifyUserName},</if>
            <if test="orgType!=null">t.org_type=#{orgType},</if>
            <if test="orgPhone!=null">t.org_phone=#{orgPhone},</if>
            <if test="jingwei!=null">t.jingwei=#{jingwei},</if>
            <if test="parentCode!=null">t.parent_code=#{parentCode},</if>
        </trim>
        <choose>
            <when test="id !=null">
                where id=#{id}
            </when>
            <otherwise>
                WHERE t.org_code=#{orgCode} AND  t.company_code=#{companyCode}
            </otherwise>
        </choose>
    </update>

  

posted on 2018-10-18 15:59  o_0的园子  阅读(343)  评论(0编辑  收藏  举报