【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>
【mybatis】mybatis 中update 更新操作,null字段不更新,有值才更新的更多相关文章
- [技术干货-算子使用] Mindspore 控制流中存在原地更新操作类副作用算子时循环值不更新问题记录
关于mindspore 原地更新类算子的一点思考记录如下: 现象记录: 原始测试代码 错误结果复现: 分析: 如果在场景中加入42行的copy()操作此时cpu的结果就会正确,但是gpu的结果则不受c ...
- Mybatis系列(二):优化MyBatis配置文件中的配置和解决字段名与实体类属性名不相同的冲突
原文链接:http://www.cnblogs.com/xdp-gacl/p/4264301.html http://www.cnblogs.com/xdp-gacl/p/4264425.ht ...
- 在oracle中,select语句查询字段中非纯数字值
最近,将原来的数字符字段转换为数字时,总报错误:无效数字. 如何找出其中哪些是非数字字符的记录?比较麻烦的事.下面是用Oracle DB自带的函数translate可以找出来的 1.创建测试表 Cre ...
- Oracle 11g对大表中添加DEFAULT值的NOT NULL字段速度有大幅度的提升
在一张2000万的表上增加了一个字段并字段一个默认值,执行这条语句(alter table tablename add new_col default ‘col’)一个小时没有执行完,问我有没有其他解 ...
- java-int类型:int默认为0导致更新操作未赋值的情况下将值更新为0
日常开发中,做更新操作的时候的处理方法为:当这个字段有值则更新,没有值就不更新,在mybatis的xml中表现为: <!-- 修改记录,只修改只不为空的字段 --> <update ...
- 关于SubSonic3.0插件使用Json反序列化获得的实体进行更新操作时,只能执行添加而不能执行修改(编辑)操作的处理
由于目前开发的项目使用云计算技术,客户端只进行UI与相关事件的功能开发,而所有的计算与处理都放到了服务器端,客户端与数据库没有任何关联,所以服务器端与客户端使用我们自己开发的通讯加密方式进行,而具体的 ...
- mysql批量update更新,mybatis中批量更新操作
在日常开发中,有时候会遇到批量更新操作,这时候最普通的写法就是循环遍历,然后一条一条地进行update操作.但是不管是在服务端进行遍历,还是在sql代码中进行遍历,都很耗费资源,而且性能比较差,容易造 ...
- 【mybatis】mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wait timeout exceeded; try restarting transaction
今天使用mybatis和jpa的过程中,发现这样一个问题: mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wai ...
- 【mybatis】mybatis中update更新原来的值加1
示例代码: floor的值 = floor原来的值+要更新的差距值 <update id="updateFloor" parameterType="com.pise ...
随机推荐
- ACM-ICPC 2018 南京赛区网络预赛 Sum
A square-free integer is an integer which is indivisible by any square number except 11. For example ...
- Python基础(4)_集合、布尔类型
一.集合 集合的作用一:关系运算集合的作用二:去重 定义集合:集合内的元素必须是唯一的:集合内的元素必须是可hash的,也是就不可变类型:集合是无序的 s={'egon',123,'egon','1' ...
- AQS同步组件及ReentrantLock和synchronized的区别
AQS同步组件 CountDownLatch(只有一个线程对他进行操作): 主线程必须在启动其它线程后立即调用await()方法.这样主线程的操作就会在这个方法上阻塞,直到其它线程完成各自的任务. S ...
- Tomcat部署时war和war exploded区别及验证
war和war exploded的区别 在使用IDEA开发项目的时候,部署Tomcat的时候通常会出现下边的情况: 是选择war还是war exploded 这里首先看一下他们两个的区别: war模式 ...
- Liberty中应用的contextroot
参考:http://www-01.ibm.com/support/knowledgecenter/api/content/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ ...
- 常见协议基础知识总结--FTP协议
FTP协议是一种基于客户端和服务器的文件传输协议,属于应用层协议,基于传输层的TCP协议: FTP主要分成主动模式和被动模式两种传输方式, 方式是相对服务器而言的,服务器主动发起数据连接即主动方式,使 ...
- C++ 迭代器容器学习
set的一个用法 . difference找差集 union合并set intersection找到交集 #include<iostream> #include<string> ...
- JAVA中“==”和equals
A."=="可用于基本类型和引用类型: 当用于基本类型时候,是比较值是否相同:1==2: false: 当用于引用类型的时候,是比较是否指向同一个对象. B.基本类型int.c ...
- springboot 404返回自定义json(只进入过滤器)
今天在公司没事干,记一次springboot遇到的一些坑,在百度上也没有搜到类似的问题和答案(或者说 答案不是我想要的) 当我们在SpringBoot遇到了404或者500的错误的时候,你们会怎么办? ...
- [ MongoDB ] 分片集群及测试
分片 在Mongodb里面存在另一种集群,就是分片技术,可以满足MongoDB数据量大量增长的需求. 当MongoDB存储海量的数据时,一台机器可能不足以存储数据,也可能不足以提供可接受的读写吞吐量. ...