mapper接口:
AgentMerchantVO selectSumOrderStatistical(@Param("agentId") Long agentId, @Param("merchantId")Long merchantId,@Param("payType") Integer[] payType);
mapping:
<select id="selectSumOrderStatistical" resultMap="vo"> SELECT count(od.order_id),SUM(od.actual_cost) FROM aasy.order od LEFT JOIN shop sh ON od.shop_id = sh.shop_id LEFT JOIN adm_user aus ON sh.adm_user_id = aus.adm_user_id <where> od.state = 3 <if test="agentId != null"> AND aus.agent_id = #{agentId} </if> <if test="merchantId != null"> AND aus.adm_user_id = #{merchantId} </if> <if test="payType != null">
AND shop_id IN<foreach collection="payType" open="(" close=")" separator=" or " item="value"> #{value} </foreach> </if> </where> </select>