我的sql:
SELECT member_id from access_layer where node_id in("1,2,3","1,2,4","1,3,4","1,3,5") and node_id like "%1,3%";
<select id="findCPByNode_id" parameterType="map"
resultType="string">
SELECT member_id from access_layer where node_id in
<foreach collection="list" item="node_id" index="index"
open="(" separator="," close=")">
#{node_id}
</foreach>
and node_id like CONCAT(CONCAT('%',#{node_id}), '%')
</select>
List list = new ArrayList<>();
list.add("1,2,3");
list.add("1,2,4");
list.add("1,3,4");
list.add("1,3,5");
Map<String, Object> map = new HashedMap();
map.put("list", list);
map.put("node_id", "1,3");
如果是接口中传参的map,应该是上面这种形式。
直接传个list就行了,mybatis会自动识别,最好在接口上确定参数名称