1.传入参数是数组
<select id="Test" resultClass="dto"> select * from UserInfo where userId in <iterate open="(" close=")" conjunction="," > #[]# </iterate> </select>使用
string[] arrays = new string[] { "1", "2", "3" }; Reader.QueryForList<?>("Ibatisnet.dao.<span style="font-family: Arial, Helvetica, sans-serif;">Test</span><span style="font-family: Arial, Helvetica, sans-serif;">", strValue ); </span>
2.使用上面的数组还可以使用对象中数组方式,写法有点区别
<select id="Test" resultClass="dto"> select * from UserInfo where userId in <iterate open="(" close=")" conjunction="," property="ArrValue" > #ArrValue[]# </iterate> </select>
<select id="queryAllUserinfo" parameterClass="dto" resultClass="dto"> SELECT u.USERID,ui.id, u.USERNAME,u.ACCOUNT,u.SEX,ui.specialty,ui.address,ui.idnumber,ui.school,ui.nation,ui.political_landscape,ui.phone,ui.email,ui.qq,ui.job_category,ui.stu_class,ui.create_tm,ui.modify_tm from eauser u,TB_USER_INFO ui WHERE u.ACCOUNT = ui.ACCOUNT <dynamic> <isNotEmpty prepend="AND" property="userids"> ui.id in ($userids$) </isNotEmpty> </dynamic> </select>