Mybatis中查询条件为map中嵌套list
来源:互联网 发布:蓝月传奇官印升级数据 编辑:程序博客网 时间:2024/06/05 18:23
1、问题,map接受参数为HashMap<String,Object>;怎么根据他查询呢
sql语句:select result as orderRsult,IFNULL(sum(amount),0) as orderAmount,count(1) as orderCount from user_order WHERE app_id IN ( ? ) group by result
对应的mapper:
public List<Map<String,Object>> merOrderView(Map<String,Object>parametersMap);其中map的结构:
{app_ids=[4110,4111], begaindate=2017-07-08, enddate=2017-07-09}mapper.xml为<resultMap id="merOrderViewResult" type="HashMap"> <result column="orderRsult" property="orderRsult"/> <result column="orderAmount" property="orderAmount" /> <result column="orderCount" property="orderCount" /> </resultMap> <select id="merOrderView" parameterType="map" resultMap="merOrderViewResult"> select result as orderRsult,IFNULL(sum(amount),0) as orderAmount,count(1) as orderCount from user_order <where> <!-- <if test="null != app_id and '' != app_id"> and app_id=#{app_id} </if>--> <if test="app_ids !=null"> AND app_id IN <foreach collection="app_ids" item="appid" open="(" separator="," close=")"> #{appid} </foreach> </if> <if test="null != begaindate"> and insert_date >=#{begaindate} </if> <if test="null != enddate"> and insert_date <=#{enddate} </if> </where> group by result </select>
阅读全文
0 0
- Mybatis中查询条件为map中嵌套list
- Mybatis查询实例,sql中的in在Mybatis中怎么写--以list为查询条件
- Mybatis查询实例,sql中的in在Mybatis中怎么写--以list为查询条件
- mybatis中根据多条件list查询
- Mybatis中查询的参数为Map条件中是in 数据组参数
- mybatis中传入一个List或Map集合作为查询条件的参数
- Mybatis 批量查询 Map 嵌套 List
- Mybatis中查询条件和返回的结果Map封装
- jstl中list嵌套map
- Map集合中嵌套list
- MyBatis传入参数为集合 map中包含 list 数组
- struts2中List嵌套Map的现实
- jstl中list嵌套map, 取值
- freemarker map 中 嵌套list的例子
- MyBatis 中使用 Association 嵌套查询
- MyBatis 中使用 Collection 嵌套查询
- mybatis 查询参数为list、数组、map的情况
- mybatis中数组空值查询条件
- 文献管理与信息分析(课堂笔记前六章)
- CSS布局汇总
- Go 通道(chan)关闭和后续读取操作
- 对Http协议的长连接和短连接新的认识
- git diff 将当前改动的文件作为patch
- Mybatis中查询条件为map中嵌套list
- 彻底删除Oracle11g
- Windows下批处理修改文件名
- C#中静态方法和非静态方法的区别
- 2017美团点评前端开发岗位面试题
- LeetCode 437. Path Sum III
- 笔试复习_C++_指针(二)
- because its architectures 'arm64' didn't contain all required architectures 'armv7 arm64'
- UVA 131