动态sql 单选变多选

实体类

添加数组存储值

private ArrayList tssjfjList;

复制代码
<!--            <if test="tssjfj != null  and tssjfj != ''">and tssjfj = #{tssjfj}</if>-->

            <if test="tssjfjList != null and tssjfjList.size() > 0">
                AND tssjfj IN
                <foreach item="item" index="index" collection="tssjfjList" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>

存在循环且模糊匹配的情况

复制代码
  <if test="corpbqList != null and corpbqList.size() > 0">
                AND (
                <foreach item="item" index="index" collection="corpbqList" open="(" separator=" OR " close=")">
                    typed LIKE CONCAT('%', #{item}::text, '%')
                </foreach>
                )
            </if>
相关推荐
谢亮_vipxieliang9 分钟前
Stream API 不是银弹:常见坑与性能建议
java·开发语言
源码宝22 分钟前
Web‑PACS 云影像源码|Java+Vue3 医院影像管理系统完整方案
java·源码·影像pacs·成品源码·医院影像系统
ShineWinsu32 分钟前
对于Redis:string类型的解析
java·c++·redis·分布式·缓存·面试·string
杨云龙UP1 小时前
一次数据库查询缓慢故障复盘:大表数据增长、SQL全表扫描导致系统响应异常
linux·运维·服务器·数据库·sql·mysql
2501_932750261 小时前
Android 自定义 View 入门
android
2501_933670791 小时前
2027 应用统计学秋招选岗指南:统计、SQL、业务指标如何对应岗位
数据库·sql
三8443 小时前
Fastjson 漏洞 · 02 · autoType 机制与 checkAutoType
java·fastjson
无限码力3 小时前
小红书笔试真题 9.17 - 待发热度重排(C++/Py/Java /Js/Go)
java·小红书·小红书笔试真题·小红书技术岗笔试真题
卓怡学长3 小时前
w194基于ssm新能源汽车充电系统小程序
java·小程序·intellij-idea