1、使用iterate属性,status为数组。
<isNotNull property="status">
<![CDATA[ status in ]]>
<iterate property="status" conjunction="," open="(" close=")">
#status[]#
</iterate>
</isNotNull>
2、使用$,但这种写法存在一定的风险,可能会引起sql注入。
SELECT * FROM test WHERE status in ($status$);
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;
...
}