1. 程式人生 > >Mybatis多個in查詢

Mybatis多個in查詢

Map<String, Object> params = null;
List<Map<String, Object>> list=new ArrayList();
for (String one:bigCodes) {
    params = new HashMap<String, Object>(2);
    params.put("number", one);
    params.put("agentId", agentId);
    list.add(params);
}
List<Usednumber400> usednumber400List = usednumber400Dao.selectInIn(list);
		
		
List<Usednumber400> selectInIn(List<Map<String, Object>> list
); <select id="selectInIn" resultType="com.wftdlx.carApi.entity.Usednumber400"> SELECT * from usednumber400 WHERE agentID in <foreach collection="list" item="item" index="index" open="(" close=")" separator=","> #{item.agentId} </foreach> and number IN <foreach collection="list" item="item" index="index" open="(" close=")" separator=","> #{item.number} </foreach> </select>