关于前端传以逗号分割的字符串的接收

mybatis

Vo包

public class OutPayLogGroupByOutIdVo {

private List<String> feeItem;

}

xml里面的写法

<if test="feeItem != null and feeItem.size>0">
AND log.fee_item in
<foreach item="feeItem" index="index" collection="feeItem" open="("
separator=","
close=")">
#{feeItem}
</foreach>
</if>

直接传参数的

List<Map<String, Object>> selectTFInfoByList(@Param("list")List<String> list, @Param("type")String type)

@Select("<script>"

    + " SELECT * "

 WHERE aaa IN "

     + " <foreach item='list' index='index' collection='list' open='(' separator=',' close=')'>" 

     + " #{list}"

     + " </foreach>" 

 + " </script>")

原文地址:https://www.cnblogs.com/xd1105/p/10688486.html