动态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>
相关推荐
云和恩墨35 分钟前
OceanBase企业版会话级SQL跟踪实操:DBMS_MONITOR(类Oracle 10046事件)
数据库·sql·oracle·oceanbase
为什么不问问神奇的海螺呢丶36 分钟前
oracle 数据库巡检 sql
数据库·sql·oracle
Lei活在当下7 小时前
【Perfetto从入门到精通】4.使用 heapprofd 工具采样追踪 Java/Native 内存分配
android·性能优化·架构
陈文锦丫7 小时前
MQ的学习
java·开发语言
乌暮7 小时前
JavaEE初阶---线程安全问题
java·java-ee
爱笑的眼睛117 小时前
GraphQL:从数据查询到应用架构的范式演进
java·人工智能·python·ai
alexhilton7 小时前
学会在Jetpack Compose中加载Lottie动画资源
android·kotlin·android jetpack
Seven977 小时前
剑指offer-52、正则表达式匹配
java
聪明努力的积极向上8 小时前
【MYSQL】字符串拼接和参数化sql语句区别
数据库·sql·mysql
代码or搬砖8 小时前
RBAC(权限认证)小例子
java·数据库·spring boot