ibatis的iterate使用 方便or的使用
来源:互联网 发布:广西都市频道网络电视 编辑:程序博客网 时间:2024/05/29 07:44
Iterate:这属性遍历整个集合,并为 List 集合中的元素重复元素体的内容。
Iterate 的属性:
prepend - 可被覆盖的 SQL 语句组成部分,添加在语句的前面(可选)
property - 类型为 java.util.List 的用于遍历的元素(必选)
open - 整个遍历内容体开始的字符串,用于定义括号(可选)
close -整个遍历内容体结束的字符串,用于定义括号(可选)
conjunction - 每次遍历内容之间的字符串,用于定义 AND 或 OR(可选)
遍历类型为 java.util.List的元素。
例子:
<iterate prepend=”AND” property=”userNameList”
open=”(” close=”)” conjunction=”OR”>
username=#userNameList[]#
</iterate>
ibatis中如何配置in语句,需要迭代,不能直接用string的写法
<select id="sql_test" parameterclass="myPramBean" resultclass="myResult">
select *from tablewhere name in
<iterate property="ids" conjunction="," close=")" open="(" />
#value[]#
</iterate>
and code=#code#
</select>
myPramBean
{
private String code;
private List ids;
...
}
eg:
<delete id="member.batchDelete" parameterClass="java.util.List">
DELETE FROM member where id IN
<iterate conjunction="," open="(" close=")" >
#value[]#
</iterate>
</delete>
注意:使用<iterate>时,在List元素名后面包括方括号[]非常重要,方括号[]将
对象标记为List,以防解析器简单地将List输出成String。
Iterate 的属性:
prepend - 可被覆盖的 SQL 语句组成部分,添加在语句的前面(可选)
property - 类型为 java.util.List 的用于遍历的元素(必选)
open - 整个遍历内容体开始的字符串,用于定义括号(可选)
close -整个遍历内容体结束的字符串,用于定义括号(可选)
conjunction - 每次遍历内容之间的字符串,用于定义 AND 或 OR(可选)
遍历类型为 java.util.List的元素。
例子:
<iterate prepend=”AND” property=”userNameList”
open=”(” close=”)” conjunction=”OR”>
username=#userNameList[]#
</iterate>
ibatis中如何配置in语句,需要迭代,不能直接用string的写法
<select id="sql_test" parameterclass="myPramBean" resultclass="myResult">
select *from tablewhere name in
<iterate property="ids" conjunction="," close=")" open="(" />
#value[]#
</iterate>
and code=#code#
</select>
myPramBean
{
private String code;
private List ids;
...
}
eg:
<delete id="member.batchDelete" parameterClass="java.util.List">
DELETE FROM member where id IN
<iterate conjunction="," open="(" close=")" >
#value[]#
</iterate>
</delete>
注意:使用<iterate>时,在List元素名后面包括方括号[]非常重要,方括号[]将
对象标记为List,以防解析器简单地将List输出成String。
- ibatis的iterate使用 方便or的使用
- ibatis的iterate使用
- ibatis的iterate使用
- Ibatis Iterate的使用
- ibatis中iterate的使用
- ibatis的iterate使用 1
- ibatis实现Iterate的使用
- Ibatis中iterate的使用
- ibatis实现Iterate的使用
- ibatis.net中Iterate的使用
- ibatis实现Iterate的使用 ibatis里面in的实现
- ibatis iterate使用
- ibatis iterate使用
- ibatis iterate 使用,里面有批量添加操作的遍历
- ibats iterate的使用
- ibatis中iterate的用法(conjunction="or" ",")
- ibatis中iterate的用法(conjunction="or" ",") .
- ibatis Iterate in 使用数组
- HDU 1671 静态trie(字典树)
- vs2010中C++调用python脚本并制作安装包
- RAC之负载均衡
- 《编程珠玑》第二章2.1 二分查找不存在的数
- C# HMACSHA1 加密
- ibatis的iterate使用 方便or的使用
- Servlet源码深入学习
- RAC之FAILOVER
- 我在学习编程中犯的两个最大错误
- 在线编程协作平台FriendCode获15万美元种子期融资,并开放注册
- Activity设置singleInstance后不能启用startActivityForResult()进行数据回调
- linux 标准目录结构
- 简单工厂模式和工厂方法模式
- 1)从本地磁盘读取图片 2)将输入流转换为字节数组 3)使用字节数组创建Image对象