ibatis中isEquals、isNotEmpty的用法
一:isEquals用于动态拼接sql
如下实例:
如果status的状态为0,则更新attribute1;状态为1,则更新attribute2;
状态为2,则更新attribute3。
<update id="topup.doEffect" parameterClass="java.util.HashMap">
update cis_customer set code_id = #codeId# ,
<isEqual property="status" compareValue="0" prepend=",">
attribute1=#attribute1#</isEqual>
<isEqual property="status" compareValue="1" prepend=",">
attribute2=#attribute2#</isEqual>
<isEqual property="status" compareValue="2" prepend=",">
attribute3=#attribute3#</isEqual>
where id = #id#
</update>
二:isNotEmpty
如下实例:
查询cis_customer这张表,如果属性aaa不为空,则将条件aaa=#aaa#拼接;
如果bbb不为空,则将条件bbb=#bbb#拼接;如果属性ccc不为空,则将条件ccc=#ccc#拼接;
<select id="topup.querySuccessCount" parameterClass="java.util.HashMap">
select id,name from cis_customer where 1=1
<isNotEmpty property="aaa" prepend="and">
aaa=#aaa#
</isNotEmpty >
<isNotEmpty property="bbb" prepend="and">
bbb=#bbb#
</isNotEmpty >
<isNotEmpty property="ccc" prepend="and">
ccc=#ccc#
</isNotEmpty >
</select>
ibatis中isEquals、isNotEmpty的用法的更多相关文章
- ibatis 中isNull, isNotNull与isEmpty, isNotEmpty区别
在iBATIS中isNull用于判断参数是否为Null,isNotNull相反 isEmpty判断参数是否为Null或者空,满足其中一个条件则其true isNotEmpty相反,当参数既不为Null ...
- 【转】ibatis 中isNull, isNotNull与isEmpty, isNotEmpty区别
转自:http://blog.csdn.net/fanfanjin/article/details/6676566 在iBATIS中 isNull用于判断参数是否为Null,isNotNull相反 i ...
- ibatis中的$和#的区别
介绍 在Ibatis中我们使用SqlMap进行Sql查询时需要引用参数,在参数引用中遇到的符号#和$之间的区分为,#可以进行与编译,进行类型匹配,而$不进行数据类型匹配,例如: select * fr ...
- mybatis中动态update中的isNotEmpty和isNotNull标签
一,简介 在iBATIS中isNull用于判断参数是否为Null,isNotNull相反isEmpty判断参数是否为Null或者空,满足其中一个条件则其trueisNotEmpty相反,当参数既不为N ...
- ibatis中使用缓存
简单在ibatis中使用cache 首先设置SqlMapConfig.xml中<settings/>节点的属性cacheModelsEnabled="true" ...
- Java中的Socket的用法
Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...
- ecshop中foreach的详细用法归纳
ec模版中foreach的常见用法. foreach 语法: 假如后台:$smarty->assign('test',$test); {foreach from=$test item=list ...
- matlab中patch函数的用法
http://blog.sina.com.cn/s/blog_707b64550100z1nz.html matlab中patch函数的用法——emily (2011-11-18 17:20:33) ...
- C#中timer类的用法
C#中timer类的用法 关于C#中timer类 在C#里关于定时器类就有3个 1.定义在System.Windows.Forms里 2.定义在System.Threading.Timer类 ...
随机推荐
- codeforces 631A Interview
A. Interview time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- 自定义使用AVCaptureSession 拍照,摄像,载图
转载自 http://blog.csdn.net/andy_jiangbin/article/details/19823333 拍照,摄像,载图总结 1 建立Session 2 添加 input ...
- JavaScript继承方式详解
原文链接 : http://segmentfault.com/a/1190000002440502 js继承的概念 js里常用的如下两种继承方式: 原型链继承(对象间的继承) 类式继承(构造函数间的继 ...
- hdu4614Vases and Flowers(线段树,段设置,更新时范围的右边值为变量)
Problem Description Alice is so popular that she can receive many flowers everyday. She has N vases ...
- java 指导 (Java Tutorial)
case1: site:docs.oracle.com -xmx -xms case2: site:docs.oracle.com thread case3: site:docs.oracle.com ...
- Row_Number()over(order by....) as
出自:http://www.2cto.com/database/201307/227103.html Sql Server Row_Number()学习 Row_Number(): row_n ...
- 学习LINQ,发现一个好的工具。LINQPad!!
今日学习LINQ,发现一个好的工具.LINQPad!! 此工具的好处在于,不需要在程序内执行,直接只用工具测试.然后代码通过即可,速度快,简洁方便. 可以生成其LINQ查询对应的lambda和SQL语 ...
- VS~单步调试DLL
有时我们从第三方下载DLL库之后,在使用VS进行调试时还是很麻烦的,现在我总结一下,在开发过过程中调试DLL的方法,希望对各位在开发中有帮助. 1 VS下载插件.Net Refector 2 引用你的 ...
- 【灵感】wifi通过wifi发送优惠信息
1.[灵感]wifi通过wifi发送优惠信息 http://content.businessvalue.com.cn/post/15362.html 2.手机彩票大爆发 http://content. ...
- 在Android Eclipse 开发如何 使用 (*.aar)文件
http://www.cnblogs.com/shortboy/p/4424944.html 开场白:其实这篇文章有点白费心机. 详细说明是:http://blog.csdn.net/qiujuer/ ...