select * from cz_project_info where 1=1 and
<if test="rolesList!=null and rolesList.size() >0">
<foreach collection="rolesList" index="index" item="item" open="(" separator="or" close=")">
locate(#{item}, roles_id)
</foreach>
</if>
and
<if test="deptsList!=null and deptsList.size() >0">
<foreach collection="deptsList" index="index" item="item" open="(" separator="or" close=")">
locate(#{item}, depts_id)
</foreach>
</if>
筛选,模糊搜索,时间范围搜索(辨别数字和字符串类型)
<if test="itemHistory.projectId!=null">
and cz_item_history.project_id=#{itemHistory.projectId}
</if>
<if test="itemHistory.itemName!=null and itemHistory.itemName!=''">
and cz_item_history.item_name like concat(concat('%', #{itemHistory.itemName}), '%')
</if>
<if test="dataTmRangeBegin != null and dataTmRangeBegin != '' and dataTmRangeEnd != null and dataTmRangeEnd!= ''">
and DATE_FORMAT(data_tm, '%Y-%m-%d %H:%i:%s' ) between #{dataTmRangeBegin} and
#{dataTmRangeEnd}
</if>
<if test="max!=null and max!=''">
and aqi <![CDATA[<=]]> #{max}
</if>
in 方法
update cz_user_message set is_deleted=1
where 1=1 and table_id in
<if test="toLongList!=null and toLongList.size() >0">
<foreach collection="toLongList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>