任务目标:
查询数据,同时去掉一些前台过滤掉的数据(个数任意可变)。
SQL语句
<select id="searchEMP" parameterType="msgInfoPut" resultMap="msgInfoPut">
select EMP_CD,EMP_NM,TEAM_NM
from BD_QC_EMP
where 1=1
<if test=" rows2 != null and rows2.size()>0" >
and EMP_CD NOT IN
<foreach item="row" index="index" collection="rows2" open="(" close=")" separator=",">
#{row}
</foreach>
</if>
</select>
参数意义
collection 可迭代的数组
item 迭代出来的值
类似java中
List(String) list =new ArrayList(String);
....
for(String string : list ){
}
collection 类似 list
item 类似 string