1. mybatis根据某一个字段根据以及集合中的列表进行模糊匹配
mapper
List<Message> selectByLinkList(@Param("userId") String userId, @Param("messageName") String messageName, @Param("anJinGoodsNameList") List<String> anJinGoodsNameList, @Param("sjDate") Date sjDate);
xml
<select id="selectByLinkList" resultMap="BaseResultMap">
select * from message
WHERE 1=1
<if test="anJinGoodsNameList != null and anJinGoodsNameList.size() > 0">
AND (
<foreach item="descr" collection="anJinGoodsNameList" separator=" OR">
`descr` LIKE CONCAT('%', #{descr}, '%')
</foreach>
)
</if>
AND user_id = #{userId,jdbcType=VARCHAR}
AND name = #{messageName}
AND create_time > #{sjDate}
</select>