|
|
@@ -1242,4 +1242,77 @@
|
|
|
</where>
|
|
|
order by a.create_time desc,a.order_id desc
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="orderCount" resultType="com.yami.shop.bean.vo.OrderCountVo">
|
|
|
+ select
|
|
|
+ count(a.order_number) as orderTotal,
|
|
|
+ sum(a.total) as orderMoneyTotal,
|
|
|
+ sum(c.product_total_amount) as shopMoneyTotal,
|
|
|
+ sum(IFNUll(a.freight_amount,0)) as carriageMoneyTotal,
|
|
|
+ sum(a.total) as payMoneyTotal,
|
|
|
+ ROUND(sum(IFNUll(a.offset_points,0)) / 100,2) as pointsMoneyTotal,
|
|
|
+ sum(IFNUll(a.actual_total,0)) as moneyTotal
|
|
|
+ FROM tz_order a
|
|
|
+ LEFT JOIN tz_user_addr_order b on a.addr_order_id=b.addr_order_id
|
|
|
+ LEFT JOIN tz_order_item c on a.order_number =c.order_number
|
|
|
+ left join tz_user e on a.user_id = e.user_id
|
|
|
+ <where>
|
|
|
+ <if test="orderParam.orderNumber != null and orderParam.orderNumber != ''">
|
|
|
+ and a.order_number = #{orderParam.orderNumber}
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.channelIdList != null and !orderParam.channelIdList.isEmpty()">
|
|
|
+ and a.channel_id in
|
|
|
+ <foreach collection="orderParam.channelIdList" item="channelId" open="(" close=")" separator=",">
|
|
|
+ #{channelId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.userAttrType != null and orderParam.userAttrType != '' and orderParam.userAttrType != 0">
|
|
|
+ AND e.user_attr_type = #{orderParam.userAttrType}
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.dvyType != null and orderParam.dvyType != ''">
|
|
|
+ and a.dvy_type = #{orderParam.dvyType}
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.shopId != null">
|
|
|
+ and a.shop_id = #{orderParam.shopId}
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.startTime != null">
|
|
|
+ and a.create_time > #{orderParam.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.endTime != null">
|
|
|
+ and a.create_time < #{orderParam.endTime}
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.refundStatus != null and orderParam.refundStatus != 0">
|
|
|
+ and a.refund_status = #{orderParam.refundStatus}
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.receiver != null">
|
|
|
+ and b.receiver LIKE concat("%",#{orderParam.receiver},"%")
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.userMobile != null">
|
|
|
+ and b.mobile LIKE concat("%",#{orderParam.userMobile},"%")
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="orderParam.orderStatus != null and orderParam.orderStatus != ''">
|
|
|
+ <if test="orderParam.orderStatus == 'all'">
|
|
|
+ AND a.hb_order_status in (0, 1,20,30,40,50,60,70,80)
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.orderStatus == 'paddingPay'">
|
|
|
+ AND a.hb_order_status in (0)
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="orderParam.orderStatus == 'paddingShipped'">
|
|
|
+ AND a.hb_order_status in (1)
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="orderParam.orderStatus == 'paddingReceived'">
|
|
|
+ AND a.hb_order_status in (20,30,40,70)
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.orderStatus == 'completed'">
|
|
|
+ AND a.hb_order_status in (80)
|
|
|
+ </if>
|
|
|
+ <if test="orderParam.orderStatus == 'cancel'">
|
|
|
+ AND a.hb_order_status in (50,60)
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
</mapper>
|