【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 ...
随机推荐
- 在Servlet中出现一个输出中文乱码的问题
添加:reqeust.setCharacterEncoding("utf-8");
- loj6087 毒瘤题
传送门:https://loj.ac/problem/6087 [题解] 这垃圾题目卡空间啊... k=1相信大家都会,把所有数异或起来就是答案了. 考虑k=2,把所有数异或起来得到两个答案数的异或值 ...
- 金中欢乐赛 C题
题目传送门 这道题 hash就可以写了 弄了半天有点智障 强行压一压就okay了的说 #include<cstdio> #include<cstring> #include&l ...
- [bzoj1798][Ahoi2009]Seq——线段树+多重标记下传
题意 请你写一个数据结构,支持: 子序列同加 子序列同乘 统计子序列和 题目 线段树裸题,但对于我这种初学者还是非常难写. 我们维护两个标记,一个是在这个节点上作过的所有乘法操作,一个是加法操作,始终 ...
- 关于jQuery.extend
这次来了解下jQuery的extend吧,作为菜鸟的我学艺不精,看插件时经常看到extend函数的使用,从网上看到一篇不错的介绍,特地转载过来留给自己收藏学习: ------------------- ...
- <script>中的async与defer属性
1.script元素中的defer属性 1.1说明 使用该属性可以使脚本延迟到文档完全被解析和显示之后再按照原本的顺序执行,即告诉浏览器立即下载脚本,但延迟执行,该属性只对外部脚本有效 1.2使用方法 ...
- 转:布局【ViewGroup】
转: http://www.cnblogs.com/leehyuan/p/3389527.html 像素单位的变化:是用dip,而不是px,主要用于宽高的设置 在Android中支持的描述大小区域的类 ...
- Django-Form 补充
一.Form的前端循环 class LoginForm(Form): name = ... pwd = ... def func(request): form = LoginForm() return ...
- 【反演复习计划】【bzoj2154】Crash的数字表格
膜拜cdc……他的推导详细到我这种蒟蒻都能看得懂! 膜拜的传送门 所以我附一下代码就好了. #include<bits/stdc++.h> #define N 10000005 #defi ...
- Long类型的坑,第一次遇见
注意下面标红的code,如果不加这段代码会有问题,原因是一个比较的是地址,一个比较的是value,会导致不同,程序逻辑出错!加上后比较的就是值!!! allViewMap.put("proj ...