动态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>
相关推荐
三少爷的鞋5 小时前
代码越来越便宜,判断力越来越贵:AI 时代的 Android 架构与协程避坑指南
android
Decay__5 小时前
VMware 安装 SQL Server 双节点 AlwaysOn 可用性组教程 —— WSFC、AG 与侦听器完整部署(系列核心篇)
运维·数据库·sql·mysql·架构
茶栀(*´I`*)6 小时前
SQL 性能分析:从慢查询日志到执行计划的完整定位方法
数据库·sql
文丑颜不良啊6 小时前
LeetCode2761~2780题目解析
java·leetcode
IT枫斗者枫哥7 小时前
子线程断言失败,JUnit 为什么还显示通过?
java·后端
Gracker7 小时前
SmartPerfetto 1.19.0:换过分析引擎之后,这次更新了什么
android
考虑考虑9 小时前
JDK27中的Set.ofLazy
java·后端·java ee
文丑颜不良啊9 小时前
LeetCode2841~2860题目解析
java·leetcode
小南家的青蛙9 小时前
Tomcat与Jetty深度对比
java·tomcat·jetty
乌暮11 小时前
Spring AOP 与 Spring 事务:用大白话彻底理解原理与实践
java·数据库·spring boot·后端·sql·学习·spring