动态sql传集合參

传list集合:

传list集合
SQL:
<select id="queryDeptListByBankLevelAndBankName" parameterType="java.util.HashMap"resultMap="queryDeptListByBankLevelAndBankNameResult">select DEPTSEQ ,DEPTNAME,DEPTIDfrom DEPTWHERE 1=1<if test="DeptLevel != null and DeptLevel != ''">And DeptLevel=#{DeptLevel}</if><if test="DeptName != null and DeptName != ''"> and DeptName LIKE '%' || #{DeptName} || '%'</if><if test="DeptSeq != null and DeptSeq != ''"> and DeptSeq=#{DeptSeq}</if><if test="deptIdList != null and deptIdList.size > 0 ">and DEPTID not in<foreach collection="deptIdList" item ="deptId" index="i" open="(" close=")" separator=",">#{deptId}</foreach></if>ORDER BY DEPTID</select>接口:ArrayList deptIdList = new ArrayList();String [] deptIds = {"006001", "006002", "006003", "006004", "006005", "006006", "006007","006008", "006009", "006010", "006011", "006012", "006013", "006015","006016", "006017", "006018", "006019", "006020", "006021", "006022","006023", "006024", "006025", "006026", "006027", "006028", "006029","006030", "006031", "006032", "006033", "006034", "006035", "006036","006037", "006038", "006039", "006040", "006041", "006042", "006043","006044", "006045", "006501", "009801", "009802", "009803", "009809","009810", "009811", "014001", "015001", "016001", "016501", "019801","019802", "019803", "019804", "019805", "019806", "026501", "027006","027106", "027206", "027306", "027406", "027506", "029801", "036501","037006", "039801", "046501", "047006", "049801", "056501", "057006","809801", "059801", "066501", "067006", "069801", "076501", "077006","079801", "086501", "087006", "089801", "097006", "099801", "107006","109801", "117006", "117106", "119801", "127006", "129801", "806501","809801", "816501", "819801", "9802"};Collections.addAll(deptIdList, deptIds);Map map = new HashMap();map.put("deptIdList",deptIdList);subList = this.sqlMap.queryForList("mcmmcif.queryDeptListByBankLevelAndBankName", map);   

传数组:

 传数组:
SQL:<select id="queryDeptListByBankLevelAndBankName" parameterType="java.util.HashMap"resultMap="queryDeptListByBankLevelAndBankNameResult">select DEPTSEQ ,DEPTNAME,DEPTIDfrom DEPTWHERE 1=1<if test="DeptLevel != null and DeptLevel != ''">And DeptLevel=#{DeptLevel}</if><if test="DeptName != null and DeptName != ''"> and DeptName LIKE '%' || #{DeptName} || '%'</if><if test="DeptSeq != null and DeptSeq != ''"> and DeptSeq=#{DeptSeq}</if><if test="deptIdList != null and deptIdList.length > 0 ">and DEPTID  in<foreach collection="deptIdList" item ="deptId" index="i" open="(" close=")" separator=",">#{deptId}</foreach></if>ORDER BY DEPTID</select>接口:String [] deptIds = {"006007","006010","006011","006024","006025","006034","006035","006037","016501","016601","016701","016801","016901","017001","017101","017201","017301","017401","017501","017601","017605","017701","017801","017901","018001","018101","018301","018401","018501","018601","018701","018801","018901","019001","019101","019201","019301","019401","019501","019802","019803","019804","019805","019806","026501","027001","027101","027201","027301","027401","027501","037001","047001","047002","057001","067001","077001","087001","097001","107001","117001","117101","127001","800101","800102","800103","810101","810102","810103"};Map map = new HashMap();map.put("deptIds",deptIds);subList = this.sqlMap.queryForList("mcmmcif.queryDeptListByBankLevelAndBankName", map);

mybatis动态sql传ist集合參与传数组参数相关推荐

  1. 9.mybatis动态SQL标签的用法

    mybatis动态SQL标签的用法 动态 SQL MyBatis 的强大特性之一便是它的动态 SQL.如果你有使用 JDBC 或其他类似框架的经验,你就能体会到根据不同条件拼接 SQL 语句有多么痛苦 ...

  2. 关于 MyBatis动态sql,这里有 10 种超好用的写法

    mybatis=<>的写法 第一种写法(1): 原符号 < <= > >= & ' " 替换符号 < <= > >= &a ...

  3. Mybatis动态sql是做什么的?都有哪些动态sql?简述一下动态sql的执行原理?

    Mybatis的动态sql的作用: 动态sql就是(在进行sql操作的时候)动态的根据属性值(所匹配的条件)来拼接数据库执行的sql语句,也就是多次查询或变更操作,根据传入的属性值不同,动态拼接出不同 ...

  4. 详解mybatis动态SQL

    什么是动态SQL? 动态 SQL 是 MyBatis 的强大特性之一.顾名思义,就是会动的SQL,即是能够灵活的根据某种条件拼接出完整的SQL语句.这种类似于MySQL中的 case when the ...

  5. mybatis动态sql,常用元素介绍

    mybatis动态sql,常用元素介绍 if元素 choose.when.otherwise foreach元素 bing元素 if元素 <select id="findRole1&q ...

  6. MyBatis动态SQL(认真看看, 以后写SQL就爽多了)

    点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 来源:cnblogs.com/homejim/p/9909657. ...

  7. 认真看看, 以后写 SQL 就爽多了:MyBatis 动态 SQL:

    点击上方蓝色"程序猿DD",选择"设为星标" 回复"资源"获取独家整理的学习资料! 作者 | 阿进的写字台 来源 | cnblogs.com ...

  8. MyBatis动态SQL,写SQL更爽

    点击上方 好好学java ,选择 星标 公众号重磅资讯,干货,第一时间送达 今日推荐:分享一套基于SpringBoot和Vue的企业级中后台开源项目,这个项目有点哇塞!个人原创100W +访问量博客: ...

  9. 认真看看, 以后写 SQL 就爽多了:MyBatis 动态 SQL

    点击上方 好好学java ,选择 星标 公众号 重磅资讯.干货,第一时间送达今日推荐:2020年7月程序员工资统计,平均14357元,又跌了,扎心个人原创100W+访问量博客:点击前往,查看更多 整理 ...

最新文章

  1. 数组公式基本功修炼之数组公式解读
  2. 如何将C#nullable int转换为int
  3. 300多工程师死磕2年,vivo终于发布自研芯片V1,降低功耗50%全片上储存
  4. Windows 2000和WindowsXP中神秘的数字签名
  5. 堆(heap)和栈(stack)
  6. CVPR 2019 开源论文 | 基于空间自适应归一化的图像语义合成
  7. 开放下载!《阿里云实时数仓Hologres最佳实践合集》
  8. 网络编程+Python
  9. 一个正则表达式酿成的惨案
  10. python图片转字符_二十行python代码实现图片转字符
  11. JAVA岗位比嵌入式岗位_java嵌入式职业选择?
  12. 论文写作思路_2018年的16个写作思路
  13. 【10分钟】入门人工智能
  14. 刚嘲讽过iPhone 12,三星就打算“抄”了:取消赠送充电头和耳机?
  15. 基于javaweb+SpringBoot+MyBatis网上书店管理系统在线购书系统(前台、后台)
  16. 树莓派crt安装中文字库和中文输入法
  17. html播放mkv,如何在Windows Media Player上播放MKV文件 | MOS86
  18. android的otg功能,Android实现OTG功能
  19. python 多线程 假的_天啦噜!Python多线程居然是骗人的
  20. Windows系统设置多账户步骤

热门文章

  1. 参加工作第三个月的感悟
  2. 高性能网站建设之减少Http连接数
  3. github中的各种操作
  4. An Implemention of Realtime Gobal Illumination
  5. 计算机网络知识梳理(1)——网络层次
  6. 弹性布局(Flex)布局介绍
  7. [Yii2] 前台用户与后台用户分离
  8. Android ui 测试课堂笔记
  9. MFC修改窗口无标题和标题信息,修改执执行文件图标
  10. 感觉自己应该重新读一次Javascript