<select id="queryByCondTotal" resultType="int" parameterType="java.util.Map" >
select count(id)
from notice_task
<where>
<if test="bldgIds!=null and bldgIds.size()>0">
<foreach item="item" index="index" collection="bldgIds"
open="(" separator=" OR " close=")">
find_in_set(#{item}, bldgId)
</foreach>
</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>
数据库字段是逗号分隔字符串,传入值是字符串list,判断二者是否有交集
最新推荐文章于 2023-03-09 17:52:16 发布