动态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>
相关推荐
棉花骑士4 分钟前
【AI Agent】面向 Java 工程师的Claude Code Harness 学习指南
java·开发语言
爱敲代码的小鱼19 分钟前
springboot(2)从基础到项目创建:
java·spring boot·spring
迈巴赫车主1 小时前
蓝桥杯19724食堂
java·数据结构·算法·职场和发展·蓝桥杯
i220818 Faiz Ul2 小时前
动漫商城|基于springboot + vue动漫商城系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·动漫商城系统
海兰2 小时前
【实战】MCP 服务在 Nacos 中注册状态分析与优化
android·java·github·银行系统·银行ai
bearpping2 小时前
MySQL压缩版安装详细图解
android·mysql·adb
Makoto_Kimur3 小时前
Java 打印模板大全
java·开发语言·排序算法
程序员榴莲3 小时前
Java(十)super关键字
java·开发语言
HAPPY酷3 小时前
Python高级架构师之路——从原理到实战
java·python·算法
ybwycx3 小时前
SpringBoot下获取resources目录下文件的常用方法
java·spring boot·后端