map.put("school","beida");
List<map<string,string>> stuList= new List<map<string,string>>() ;
map stu = new HashMap<String,String>();
stu.put("name","s1");
stu.put("age","18");
stuList.add(stu);
...
..
map.put("students",stuList);
mybatis 里
<select id="selectStudent' >
select * from sudent
where
school = #{school} and
(
<foreach collection = "stuList" item="s" , split = "or">
(name =# {s.name} and age=#{s.age})
</foreach>
)
</select>
大概这个意思
我想where 的 and 里
school = "beida" and(
(name="小金“ and age=”18“) or
(name=”小王“ and age=”20“) or
。。
。。
)
能不能 只用selectList 写这个循环呢?
大家帮帮我哦 弄了一天没弄完
高手帮忙
------解决方案--------------------
你这样写是不是太麻烦了,直接把and语句写成字符串不就行了?至于条件就在后台判断喽