• list查询list


     参考: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>
  • 相关阅读:
    LayUI上传图片
    快递查询
    安装 Python
    HTML5 WebSocket
    反射实例
    反射
    工厂模式之工厂方法案例
    工厂模式之简单工厂案例
    第三方登录
    封装条形码MaHelper
  • 原文地址:https://www.cnblogs.com/wanhua-wu/p/9353564.html
Copyright © 2020-2023  润新知