数据库字段是逗号分隔字符串,传入值是字符串list,判断二者是否有交集

<select id="queryByCondTotal" resultType="int" parameterType="java.util.Map" >
  select  count(id)
  from notice_task
  <where>
    <if test="bldgIds!=null and bldgIds.size()>0">
      "item" index="index" collection="bldgIds"
               open="(" separator=" OR " close=")">
        find_in_set(#{item}, bldgId)
      
    if>
    <if test="bldgIds==null or bldgIds.size()==0">
      and 0=1
    if>
    <if test="bldgId!=null and bldgId!='' " >
      and find_in_set(#{bldgId,jdbcType=VARCHAR}, bldgId)
    if>
    <if test="selType!=null" >
      and selType = #{selType,jdbcType=INTEGER}
    if>
    <if test="keyWord!=null and keyWord!='' " >
      and upper(title) LIKE CONCAT('%',#{keyWord,jdbcType=VARCHAR},'%')
    if>

  where>
select>

你可能感兴趣的:(技术)