mybatis 传递selectList("id",map)
map.put("school","beida");List<map<string,string>>stuList=newList<map<string,string>>...
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 里
(name="小金“ and age=”18“) or
(name=”小王“ and age=”20“) or
。。
。。
能不能 只用selectList 写这个循环呢?
大家帮帮我哦 弄了一天没弄完
高手帮忙 展开
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 里
(name="小金“ and age=”18“) or
(name=”小王“ and age=”20“) or
。。
。。
能不能 只用selectList 写这个循环呢?
大家帮帮我哦 弄了一天没弄完
高手帮忙 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询