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类 ...
随机推荐
- HDU 1312 http://acm.hdu.edu.cn/showproblem.php?pid=1312
#include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> #de ...
- codeforces 629BFar Relative’s Problem
B. Far Relative’s Problem time limit per test 2 seconds memory limit per test 256 megabytes input st ...
- Chapter 8. Classes
8.1. Class Declarations 8.1.1. Class Modifiers 8.1.1.1. abstract Classes 8.1.1.2. final Classes 8.1. ...
- VS2015中DataGridView的DataGridViewComBoboxCell列值无效及数据绑定错误的解决方法
在VS2015中练习DataGridView的使用, 发现其中的DataGridViewComBoboxCell列存在着绑定数据库列后出现值无效的提示 根据网上的解决办法,添加了DataError后可 ...
- Banach—steinhaus定理的应用
- 【SQL】导出表数据到Excel中
打开数据库之后点击新建表查询: ------------------------------------------------------------------------------------ ...
- Python requests模块在Windows下安装
发现一个爬虫库太方便了,而且支持python3! 安装方法在http://docs.python-requests.org/en/latest/user/install/#install很详细 只不过 ...
- Cocos2d-x——支持多触点
1:在AppController的didFinishLaunchingWithOptions中,加入 [__glView setMultipleTouchEnabled:YES]; 2:在CCLaye ...
- Android Studio升级后projectBuild failed.
近期在升级Android Studio后,发现原先能编译通过的project,突然就编译只是了,原因是生成的AndroidManifest.xml文件里有乱码. 升级后: android studio ...
- 关于Android与pc通信时中文乱码的分析和解决
初步实现了Android与pc服务器的通信之后,又碰到了传说中令人头疼不已的中文乱码问题.既然出现了乱码,那么原因自然是协议不通了.我们知道eclipse中默认的编码标准是GBK,而安卓程序开发所默认 ...