FIND_IN_SET使用場景

場景:表中有一個字段數據是以這種形式存儲,想查詢包含01的數據

代碼

    List<ParameterPurchaseLimitConf> selectAllEffectiveModuleConfineProductOrgInfos(@Param("moduleConfine") String moduleConfine);
 <select id="selectAllEffectiveModuleConfineProductOrgInfos" resultType="com.yonghui.yh.rme.srm.ordercenter.dao.entity.ParameterPurchaseLimitConf">
    select <include refid="Base_Column_List"/>
    from parameter_purchase_limit_conf
    where `status` = 1
    <if test="moduleConfine != null and moduleConfine != ''">
      and FIND_IN_SET(#{moduleConfine,jdbcType=VARCHAR},module_confine)
    </if>
  </select>
 select *
    from
        parameter_purchase_limit_conf 
    where
        `status` = 1 
        and FIND_IN_SET('01',module_confine)

參考:https://www.cnblogs.com/lixinjun8080/p/11246632.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章