mybatis中foreach详解(传参Map类型)
来源:互联网 发布:北上广失败的数据 编辑:程序博客网 时间:2024/06/05 21:03
项目遇到:需要根据一个字段的集合遍历查询数据,需要在mybatis使用传入个Map<String Object>参数进行foreach遍历查询。
xml代码如下:
<select id="selectByMr" resultMap="BaseResultMap">select <include refid="Base_Column_List"/>from cell_info<where><foreach collection="coverage" item="item" index="index" open="and objectid in(" separator="," close=")">#{item}</foreach></where></select>其中,collection的值是coverage,是传入的参数Map的key。
mapper代码如下:
List<Cell_info> selectByMr(Map<String, Object> map);
serviceImpl代码如下:
@Overridepublic List<Cell_info> searchWeakCoverage(Map<String, Object> map,Page page) {List<Cell_info> cellList = null;Map<String, Object> mapL = new HashMap<String, Object>();List<String> list = complaintsAnalysisDao.searchWeakCoverage(map);//查询多条结果,当做查询条件if(0!=list.size()){mapL.put("coverage", list);mapL.put("page", page);//分页用的cellList = cellInfoDao.selectByMr(mapL);}return cellList;}
0 0
- mybatis中foreach详解(传参Map类型)
- mybatis中foreach标签详解
- mybatis map foreach遍历
- foreach属性-动态-mybatis中使用map类型参数,其中key为列名,value为列值
- Mybatis foreach循环map集合
- mybatis foreach collection详解(转)
- mybatis foreach标签详解
- MyBatis foreach语句详解
- Mybatis的foreach详解
- js中forEach、map
- mybatis中foreach用法
- mybatis中foreach使用方法
- Mybatis中foreach循环
- mybatis中foreach使用
- mybatis中foreach使用方法
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- MyBatis的foreach语句详解
- 剑指offer系列之55:删除链表汇总重复的节点
- 如何用SSH密钥远程登录腾讯云linux服务器
- Ceph浅析
- mysql-python安装的各种坑
- mamp装swoole扩展
- mybatis中foreach详解(传参Map类型)
- Remove Duplicates from Sorted Array
- HTML5新特性之工作线程Web Worker
- URAL 1960 Palindromes and Super Abilities
- visual studio installer制作安装包——Installer 类
- Android天气预报程序(一)
- android使用webview加载网页
- PHP-异常处理Exception,及错误日志处理
- Objective-C的Block