【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 ...
随机推荐
- Chrome 本地通信
http://blog.csdn.net/ztmaster/article/details/52684772
- idea 从远程仓库导入git项目
File--new --Project from vision control -- git 输入远程仓库地址 即可.
- NGINX: 限制连接的实践 (Defense DDOS)
参考: [ nginx防止DDOS攻击配置 ] 关于限制用户连接,Nginx 提供的模块: [ ngx_http_limit_req_module ] [ ngx_http_limit_conn_mo ...
- 手把手教你配置苹果APNS推送服务|钿畑的博客 | 钿畑的博客
http://www.360doc.com/content/15/0118/17/1073512_441822850.shtml# 钿畑的文章索引 1. 什么是推送通知 2. 什么是APNS? 3. ...
- android usb adb流程[转]
android adb 概述 android adb的代码分为两部分: kernel层的代码在如下路径: drivers/usb/gadget/f_adb.c drivers/usb/gadget/a ...
- springmvc formatter
以下,来自于Springmvc指南第二版,第93页. Spring的Formatter是可以将一种类型转为另一种类型. 例如用户输入的date类型可能有多种格式. 下面是才用 registrar方式注 ...
- 学习struts2
有部分内容转载牛人的博客: http://blog.csdn.net/hudie1234567/article/details/6730481 http://blog.csdn.net/lishuan ...
- 【 Linux 】lvs-dr模型实现HA,后端Nginx、PHP、MySQL分离 搭建wordpress站点
要求: 1. wordpress程序通过nfs共享给各个realserver 2. 后端realserver中的nginx和php分离 网络结构图: 环境说明: OS:centos6 ...
- js 集合
[深入理解javascript原型和闭包系列 ] 历时半月完稿,求推荐 jQuery 学习笔记(未完待续) JavaScript作用域原理(三)——作用域根据函数划分
- hdu 1115(多边形重心问题)
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...