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>





版权声明:本文为onealllei原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。