参考:https://stackoverflow.com/questions/8352115/mysql-list-in-list
1,使用IN方法
注:有bug(条件:01,02,03; 数据库:01,02可以匹配, 但是02,03无法匹配)
SELECT * from tb_sys_article_shop where MODULAR in (01,03)
2,使用find_in_set
WHERE find_in_set(optionNumber1, choices) > 0 OR find_in_set(optionNumber2, choices) > 0 OR find_in_set(optionNumber3, choices) > 0
select * from tb_sys_article_shop WHERE DELETE_TAG = 0 AND ( find_in_set("02", MODULAR) > 0 OR find_in_set("03", MODULAR) > 0 OR find_in_set("04", MODULAR) > 0 )
<if test="modulars != null and modulars.size() > 0"> AND <foreach item="item" index="index" collection="modulars" open="(" separator="OR" close=")"> find_in_set(#{item}, MODULAR) > 0 </foreach> </if>