• 【mybatis】mybatis 中update 更新操作,null字段不更新,有值才更新


    示例代码如下:

    <update id="updateGoodsConfigQuery" parameterType="com.pisen.cloud.luna.ms.goods.base.common.UpdateGoodsQueryBean">
            update goods_config_query
            <trim prefix="set" suffixOverrides=",">
                <if test="configQuery.innerFrist != null">inner_frist=#{configQuery.innerFrist},</if>
                <if test="configQuery.innerNormal != null">inner_normal=#{configQuery.innerNormal},</if>
                <if test="configQuery.innerDanger != null">inner_frist=#{configQuery.innerDanger},</if>
                <if test="configQuery.outFrist != null">inner_frist=#{configQuery.outFrist},</if>
                <if test="configQuery.outNormal != null">inner_frist=#{configQuery.outNormal},</if>
                <if test="configQuery.outDanger != null">inner_frist=#{configQuery.outDanger},</if>
                <if test="configQuery.share != null">inner_frist=#{configQuery.share},</if>
                <if test="configQuery.notAct != null">inner_frist=#{configQuery.notAct},</if>
                <if test="configQuery.notSub != null">inner_frist=#{configQuery.notSub},</if>
                <if test="configQuery.exceedMaxQueryTime != null">inner_frist=#{configQuery.exceedMaxQueryTime},</if>
                <if test="configQuery.scanCodeLimit != null">inner_frist=#{configQuery.scanCodeLimit},</if>
                <if test="configQuery.innerSafetyTime != null">inner_frist=#{configQuery.innerSafetyTime},</if>
                <if test="configQuery.outerSafetyTime != null">inner_frist=#{configQuery.outerSafetyTime},</if>
                <if test="configQuery.scanCodeLimitTime != null">inner_frist=#{configQuery.scanCodeLimitTime},</if>
    
                <if test="configQuery.qaDay != null">inner_frist=#{configQuery.qaDay},</if>
                <if test="configQuery.giveQaDay != null">inner_frist=#{configQuery.giveQaDay},</if>
                <if test="configQuery.qaActType != null">inner_frist=#{configQuery.qaActType},</if>
                <if test="configQuery.giveQaActType != null">inner_frist=#{configQuery.giveQaActType},</if>
    
                <if test="configQuery.qualityDay != null">inner_frist=#{configQuery.qualityDay},</if>
                <if test="configQuery.qualityType != null">inner_frist=#{configQuery.qualityType},</if>
    
                <if test="configQuery.scanRateSys != null">inner_frist=#{configQuery.scanRateSys},</if>
                <if test="configQuery.scanRateTen != null">inner_frist=#{configQuery.scanRateTen},</if>
    
                <if test="configQuery.yuyueType != null">inner_frist=#{configQuery.yuyueType},</if>
                <if test="configQuery.yuyueVal != null">inner_frist=#{configQuery.yuyueVal},</if>
    
                <if test="configQuery.msgId != null">inner_frist=#{configQuery.msgId},</if>
    
                <if test="configQuery.qaId != null">inner_frist=#{configQuery.qaId},</if>
    
                <if test="configQuery.qualityId != null">inner_frist=#{configQuery.qualityId},</if>
    
                <if test="configQuery.scanRateId != null">inner_frist=#{configQuery.scanRateId},</if>
    
                <if test="configQuery.yuyueId != null">inner_frist=#{configQuery.yuyueId},</if>
            </trim>
    
            where goods_uid in
            <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
    
        </update>
  • 相关阅读:
    2017 ACM-ICPC西安网赛B-Coin
    Codeforces389D(SummerTrainingDay01-J)
    Codeforces672D(SummerTrainingDay01-I)
    VS2017.滚动条选项
    VS.自动调试
    ffmpeg.mp4.格式资料
    vs2017.unresolved external symbol __imp__fprintf&__imp____iob_func
    vs2017."const char *"的实参与"char *"的形参不兼容_goto跳过类型声明
    vue项目开发时怎么解决跨域
    vue奇怪的知识点又增加了
  • 原文地址:https://www.cnblogs.com/sxdcgaq8080/p/9150565.html
Copyright © 2020-2023  润新知