zoukankan      html  css  js  c++  java
  • 【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>
  • 相关阅读:
    【hibernate】自定义转换器
    【hibernate】存储图片
    【hibernate】映射可嵌入式组件
    【hibernate】应用程序级别的视图
    adb shell模拟点击事件(input tap)
    Android UIAutomator 定位
    adb devices连接不上设备
    获取元素属性get_attribute
    wait_activity
    webview定位 & native和webview切换
  • 原文地址:https://www.cnblogs.com/sxdcgaq8080/p/9150565.html
Copyright © 2011-2022 走看看