示例代码如下:

<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>

【mybatis】mybatis 中update 更新操作,null字段不更新,有值才更新的更多相关文章

  1. [技术干货-算子使用] Mindspore 控制流中存在原地更新操作类副作用算子时循环值不更新问题记录

    关于mindspore 原地更新类算子的一点思考记录如下: 现象记录: 原始测试代码 错误结果复现: 分析: 如果在场景中加入42行的copy()操作此时cpu的结果就会正确,但是gpu的结果则不受c ...

  2. Mybatis系列(二):优化MyBatis配置文件中的配置和解决字段名与实体类属性名不相同的冲突

    原文链接:http://www.cnblogs.com/xdp-gacl/p/4264301.html     http://www.cnblogs.com/xdp-gacl/p/4264425.ht ...

  3. 在oracle中,select语句查询字段中非纯数字值

    最近,将原来的数字符字段转换为数字时,总报错误:无效数字. 如何找出其中哪些是非数字字符的记录?比较麻烦的事.下面是用Oracle DB自带的函数translate可以找出来的 1.创建测试表 Cre ...

  4. Oracle 11g对大表中添加DEFAULT值的NOT NULL字段速度有大幅度的提升

    在一张2000万的表上增加了一个字段并字段一个默认值,执行这条语句(alter table tablename add new_col default ‘col’)一个小时没有执行完,问我有没有其他解 ...

  5. java-int类型:int默认为0导致更新操作未赋值的情况下将值更新为0

    日常开发中,做更新操作的时候的处理方法为:当这个字段有值则更新,没有值就不更新,在mybatis的xml中表现为: <!-- 修改记录,只修改只不为空的字段 --> <update ...

  6. 关于SubSonic3.0插件使用Json反序列化获得的实体进行更新操作时,只能执行添加而不能执行修改(编辑)操作的处理

    由于目前开发的项目使用云计算技术,客户端只进行UI与相关事件的功能开发,而所有的计算与处理都放到了服务器端,客户端与数据库没有任何关联,所以服务器端与客户端使用我们自己开发的通讯加密方式进行,而具体的 ...

  7. mysql批量update更新,mybatis中批量更新操作

    在日常开发中,有时候会遇到批量更新操作,这时候最普通的写法就是循环遍历,然后一条一条地进行update操作.但是不管是在服务端进行遍历,还是在sql代码中进行遍历,都很耗费资源,而且性能比较差,容易造 ...

  8. 【mybatis】mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wait timeout exceeded; try restarting transaction

    今天使用mybatis和jpa的过程中,发现这样一个问题: mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wai ...

  9. 【mybatis】mybatis中update更新原来的值加1

    示例代码: floor的值 = floor原来的值+要更新的差距值 <update id="updateFloor" parameterType="com.pise ...

随机推荐

  1. 51nod 1254 最大子段和 V2 ——单调栈

    N个整数组成的序列a[1],a[2],a[3],…,a[n],你可以对数组中的一对元素进行交换,并且交换后求a[1]至a[n]的最大子段和,所能得到的结果是所有交换中最大的.当所给的整数均为负数时和为 ...

  2. JavaScript DOM编程艺术 读书笔记

    2. JavaScript语法 2.1 注释      HTML允许使用"<!--"注释跨越多个行,但JavaScript要求这种注释的每行都必须在开头加上"< ...

  3. UpdateData的用法(转)

    原文转自 https://blog.csdn.net/ddjj_1980/article/details/51452289 UpdateData(TRUE)——刷新控件的值到对应的变量.(外部输入值交 ...

  4. UVALIVE 3307 Adventurous Driving

    一开始重新建图搞的.然后参照了别人的博客.这个解法比较好 利用在SPFA维护入队次数.入队次数大于节点数目的位于负环. 那么负环中的点如何DFS到终点.(SPFA从起点开始如果能找到入队大于N那么一定 ...

  5. python 使用装饰器并记录log

    1.首先定义一个log文件 # -*- coding: utf-8 -*- import os import time import logging import sys log_dir1=os.pa ...

  6. PL/SQL 05 存储过程 procedure

    --存储过程(不带参数) create or replace procedure 存储过程名as  变量.常量声明;begin  代码;end; --存储过程(带输入参数) create or rep ...

  7. gdrive无限网盘挂载systemd文件

    我的博客新地址:www.liuquanhao.com --------------------------------------------------------------------- 首先应 ...

  8. Mac-安装itellij idea

    1.安装解压 Unzip and copy JetbrainsCrack.jar to /Applications/CLion.app/Contents/bin/JetbrainsCrack.jar ...

  9. python 多进程multiprocessing 模块

    multiprocessing 常用方法: cpu_count():统计cpu核数 multiprocessing.cpu_count() active_children() 获取所有子进程 mult ...

  10. 使用kubeadm安装kubernetes1.12.1

    kubeadm是kubernetes官方用来自动化高效安装kubernetes的工具,手动安装,特别麻烦. 使用kubeadm安装无疑是一种不错的选择. 1.环境准备 1.1系统配置 系统是CentO ...