动态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>
相关推荐
石山代码3 小时前
ArrayList / HashMap / ConcurrentHashMap
java·开发语言
这个DBA有点耶4 小时前
云上运维新挑战:当数据库不再“看得见摸得着”
数据库·sql·程序人生·云原生·运维开发·学习方法·dba
针叶4 小时前
Google Play加固保护导致的崩溃
android·安全·google
AskHarries5 小时前
系统提示词、开发者指令和用户输入的优先级
java·前端·数据库
九皇叔叔5 小时前
PostgreSQL/openGauss pg_stats 视图从入门到精通:统计信息、执行计划与慢 SQL 优化实战
数据库·sql·postgresql
daidaidaiyu5 小时前
ThingsBoard 规则链系统源码分析和自定义定时器
java
小毛驴8506 小时前
spring-boot-maven-plugin,maven-compiler-plugin 功能对比
java·python·maven
南极企鹅6 小时前
MySQL间隙锁&临键锁
数据库·sql·mysql
csdn_aspnet6 小时前
Java 霍尔分区算法(Hoare‘s Partition Algorithm)
java·开发语言·算法
霸道流氓气质6 小时前
通义灵码 IDEA 插件完全使用指南
java·ide·intellij-idea