Mybatis中查询条件为map中嵌套list

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>




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值