动态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>
相关推荐
叫致寒吧2 小时前
Tomcat详解
java·tomcat
p***92483 小时前
深入理解与实战SQL IFNULL()函数
数据库·sql·oracle
踢球的打工仔4 小时前
PHP面向对象(7)
android·开发语言·php
安卓理事人4 小时前
安卓socket
android
S***26756 小时前
基于SpringBoot和Leaflet的行政区划地图掩膜效果实战
java·spring boot·后端
马剑威(威哥爱编程)6 小时前
鸿蒙6开发视频播放器的屏幕方向适配问题
java·音视频·harmonyos
JIngJaneIL6 小时前
社区互助|社区交易|基于springboot+vue的社区互助交易系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·社区互助
Y***98516 小时前
DVWA靶场通关——SQL Injection篇
数据库·sql
V***u4536 小时前
MS SQL Server partition by 函数实战二 编排考场人员
java·服务器·开发语言
蒋士峰DBA修行之路6 小时前
实验二十八 SQL PATCH调优
数据库·sql·gaussdb