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:
其中map的结构:public List<Map<String,Object>> merOrderView(Map<String,Object>parametersMap);
mapper.xml为{app_ids=[4110,4111], begaindate=2017-07-08, enddate=2017-07-09}
<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>