动态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>
相关推荐
h***04773 小时前
SpringBoot(7)-Swagger
java·spring boot·后端
v***91304 小时前
Spring boot创建时常用的依赖
java·spring boot·后端
5***E6857 小时前
【SQL】写SQL查询时,常用到的日期函数
数据库·sql
代码or搬砖7 小时前
MyBatisPlus讲解(二)
java·mybatis
c***21297 小时前
Springboot3学习(5、Druid使用及配置)
android·学习
lcu1117 小时前
Java 学习42:抽象
java
Mr.朱鹏7 小时前
RocketMQ安装与部署指南
java·数据库·spring·oracle·maven·rocketmq·seata
雨中飘荡的记忆7 小时前
Spring表达式详解:SpEL从入门到实战
java·spring
Coder-coco7 小时前
个人健康管理|基于springboot+vue+个人健康管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·后端·mysql·论文
修炼者7 小时前
【Android 进阶】别再强转 Context 了!手把手教你优雅解耦 View 与 Activity
android·android studio