动态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>
相关推荐
摇滚侠1 小时前
《On Java 中文版 基础卷》阅读笔记 内部类 20
java·笔记·python
好的佩奇1 小时前
Dart 之 JSON
android·flutter·dart
_祝你今天愉快2 小时前
Android 事件传递机制:[一] 事件分发机制详解
android
FYKJ_20104 小时前
springboot贫困生认定管理系统59009-计算机毕业设计、课程设计
java·javascript·vue.js·spring boot·后端·django·课程设计
考虑考虑4 小时前
JDK27中的结构化并发
java·后端·java ee
吃我一窝jio6 小时前
Java IO流核心分类与应用
java·开发语言·笔记
Digitally7 小时前
如何将电脑上的联系人传输到安卓手机(4 种方法)
android
这个昵称不容易7 小时前
租房管理系统设计与实现:16 张表、185 个接口的 SpringBoot 前后台项目
java·springboot·毕设
拖延症晚期的Liu8 小时前
数据表的操作
大数据·数据库·sql
nice_lcj5208 小时前
Spring 事务:声明式事务怎么生效
java·spring·面试·事务·transactional·传播机制