示例代码如下:

<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. JAVA中List<Long> 转long[]的方法

    之前每次都是通过循环去写,感觉代码不够优雅,百度了一下,查到如下的写法,先记下来: List<Long> list = new ArrayList<Long>(); list. ...

  2. JAVA程序打包成exe文件详细图解

    我们都知道Java可以将二进制程序打包成可执行jar文件,双击这个jar和双击exe效果是一样一样的,但感觉还是不同.其实将java程序打包成exe也需要这个可执行jar文件. 准备: eclipse ...

  3. [BZOJ2946] [Poi2000]公共串解题报告|后缀数组

    给出几个由小写字母构成的单词,求它们最长的公共子串的长度. 单词个数<=5,每个单词长度<=2000     尽管最近在学的是SAM...但是看到这个题还是忍不住想写SA... (其实是不 ...

  4. webstorm es6 语法报错

    设置settings javascript language version后 <script>标签加个 type <script type="text/ecmascrip ...

  5. 【bzoj4272】筐子放球

    看题解会的系列…… 详细解释先坑着,以后补…… #include<bits/stdc++.h> #define N 200005 using namespace std; ,tot=,cn ...

  6. [ Python - 9 ] 高阶函数map和reduce连用实例

    1. 利用map和reduce编写一个str2float函数,把字符串'123.456'转换成浮点数123.456: from functools import reduce def str2num( ...

  7. [ 总结 ] nginx 安装过程

    本次安装使用源码编译安装: 在安装nginx之前需要先安装三个源码包:pcre.zilb.openssl    pcre:用于rewrite重写    zlib: 用于gzip压缩    openss ...

  8. 使用DRF视图集时自定义action方法

    在我们用DRF视图集完成了查找全部部门,创建一个新的部门,查找一个部门,修改一个部门,删除一个部门的功能后,views.py的代码是这样子的: class DepartmentViewSet(Mode ...

  9. Solidity 文档--第一章:智能合约入门

    一个简单的智能合约 先从一个非常基础的例子开始,不用担心你现在还一点都不了解,我们将逐步了解到更多的细节. 存储 contract SimpleStorage { uint storedData; f ...

  10. 用WP Super Cache和七牛为你的WordPress网站加速

    众所周知,WordPress一直都是博客建站的首选程序,而现在也有越来越多的企业网站都选择采用WordPress来搭建. WordPress虽好但其过于臃肿且响应速度慢等缺点也为站长们所诟病,目前网上 ...