动态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>
相关推荐
vHelios5 小时前
【电商项目】测试 授权功能 遇到的问题与解决方案
java·spring boot·sql
2401_894915535 小时前
GEO 定位优化源码搭建常见报错排查:数据库、伪静态、接口调试
java·数据库·网络协议·tcp/ip·spring·unity
bbq粉刷匠5 小时前
ArrayList 整体认识
java·jvm·数据结构
水无痕simon5 小时前
15 转账对接文档
java·区块链
西凉的悲伤5 小时前
Java 基于 MySQL 行锁实现高并发业务序列号生成器
java·mysql·springboot·序列号生成
lv__pf6 小时前
servlet与jsp
java·开发语言·servlet
xieliyu.6 小时前
Java 文件IO :File 文件类、字节流、字符流讲解
java·ide·笔记·javaee
你听得到116 小时前
排查 App 问题:别只盯着报错,把前后发生的事情串起来
android·前端·flutter
johnny2336 小时前
用SQL查MQ:Trino、PGMQ、KsqlDB、Proton、OpenLooKeng、KarelDB
sql
云烟成雨TD6 小时前
Micrometer 系列【28】Spring Boot Actuator | 其他指标速览
java·spring boot·云原生