`

ibatis中sql in语句的配置

 
阅读更多
ibatis中sql in语句的配置
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>
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics