Mybatis多個in查詢
阿新 • • 發佈:2018-12-06
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>