in the service, put the parameters in the HashMap list<String> list =NewArraylist<string>(); List.add ("X"); List.add ("Y"); List.add ("Z"); String s= "A"Date D=NewDate (); HashMap<String,Object> param =NewHashmap<string,object>();p aram.put ("List", list);p Aram.put ("S", s);p Aram.put ("D", D); Xxxdao.queryxxx (param); in MyBatis's mapper, it reads:<select id = "Queryxxx", Resulttype = "XXX", Paramtertype = "Java.lang.HashMap" >Select* from tab where Zi_duan1 = #{s} and zi_duan2 =#{d}and zi_duan3 in<foreach item= "Item" index= "index" collection= "list" open= "("Separator= "," close= ")" >#{item}</foreach></select>
In the service, place the parameters in the HashMap list<string> list = new arraylist<string>() list.add ("x"); List.add ("Y" ); List.add ("Z"); String s = "A"Date d = new date (); hashmap<string,object> param = new hashmap<string,object>();p aram.put ("list", list);p aram.put (" S ", s);p aram.put (" D ", D); Xxxdao.queryxxx (param); in MyBatis's mapper, it reads: <select id = "Queryxxx", Resulttype = "XXX", Paramtertype = " Java.lang.HashMap ">select * from tab where Zi_duan1 = #{s} and zi_duan2 = #{d}and zi_duan3 in <foreach ite M= "Item" index= "index" collection= "list" open= "(" separator= "," close= ")" > #{item} </foreach></ select>
MyBatis Query instance, how does the in SQL write in MyBatis--the query condition with list