| | |
| | | toc.pay_money payMoney, |
| | | CASE WHEN toc.unbinding_flag = 0 THEN toc.shop_id WHEN toc.unbinding_flag = 1 AND toc.order_from = 1 THEN toc.shop_id WHEN toc.order_status = 3 THEN toc.shop_id ELSE NULL END shopId, |
| | | toc.use_time verifyTime, |
| | | CASE toc.order_from WHEN 1 THEN '小程序' WHEN 2 THEN '秒杀活动' WHEN 3 THEN '线下创建' END orderFrom, |
| | | CASE toc.order_from |
| | | WHEN 1 THEN '小程序' |
| | | WHEN 2 THEN '秒杀活动' |
| | | WHEN 3 THEN '线下创建' |
| | | WHEN 4 THEN '抽奖' |
| | | WHEN 5 THEN '美团' |
| | | WHEN 6 THEN '抖音' |
| | | WHEN 7 THEN '快手' |
| | | END orderFrom, |
| | | #{param.keyword} AS keyword |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND (toc.order_from = 1 OR toc.order_from = 3) |
| | | WHERE toc.del_flag = 0 AND toc.order_from != 2 -- 不查找秒杀活动的订单 |
| | | <if test="param.orderStatus != null"> |
| | | AND toc.order_status = #{param.orderStatus} |
| | | </if> |
| | |
| | | <select id="getPlTotalOrderTotalOrderFrom" resultType="com.ruoyi.order.domain.vo.MgtTotalOrderTotalVo"> |
| | | SELECT |
| | | COUNT(order_id) orderTotal, |
| | | IFNULL(SUM(CASE WHEN order_from = 1 THEN 1 ELSE 0 END),0) onlineTotal, |
| | | IFNULL(SUM(CASE WHEN order_from in (1,5,6,7) THEN 1 ELSE 0 END),0) onlineTotal, |
| | | IFNULL(SUM(CASE WHEN order_from = 3 THEN 1 ELSE 0 END),0) offlineTotal, |
| | | IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityTotal, |
| | | IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END),0) orderMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = in (1,5,6,7) THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 3 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) offlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) activityMoney |
| | | FROM t_order WHERE del_flag = 0 AND order_status = 3 |
| | |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND toc.user_id = #{param.userId} AND toc.shop_id = #{param.shopId} AND toc.order_status IN (2,3) |
| | | </select> |
| | | <select id="pageMgtThirdOrder" resultType="com.ruoyi.order.domain.vo.MgtThirdOrderPageVo"> |
| | | SELECT |
| | | toc.order_no orderNo, |
| | | CASE toc.order_from |
| | | WHEN 1 THEN '小程序' |
| | | WHEN 2 THEN '秒杀活动' |
| | | WHEN 3 THEN '线下创建' |
| | | WHEN 4 THEN '抽奖' |
| | | WHEN 5 THEN '美团' |
| | | WHEN 6 THEN '抖音' |
| | | WHEN 7 THEN '快手' |
| | | END orderFrom, |
| | | tog.goods_name goodsName, |
| | | toc.order_money orderMoney, |
| | | toc.validity_time validityTime, |
| | | CASE WHEN toc.order_status = 3 THEN toc.shop_id ELSE NULL END shopId, |
| | | toc.use_time verifyTime |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 AND toc.order_from in (5,6,7) |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} |
| | | </if> |
| | | <if test="param.shopIds != null and param.shopIds != ''"> |
| | | AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR toc.activity_name LIKE CONCAT('%',#{param.keyword},'%') OR FIND_IN_SET(toc.user_id, #{param.userIds}) > 0) |
| | | </if> |
| | | <if test="param.createTimeBegin != null and param.createTimeBegin != ''"> |
| | | AND Date(toc.create_time) >= #{param.createTimeBegin} |
| | | </if> |
| | | <if test="param.createTimeEnd != null and param.createTimeEnd != ''"> |
| | | AND Date(toc.create_time) <= #{param.createTimeEnd} |
| | | </if> |
| | | <if test="param.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |
| | | </if> |
| | | <if test="param.verifyEndTime != null and param.verifyEndTime != ''"> |
| | | AND Date(toc.use_time) <= #{param.verifyEndTime} |
| | | </if> |
| | | ORDER BY toc.create_time DESC |
| | | </select> |
| | | <select id="getPlTotalThirdOrderStatics" |
| | | resultType="com.ruoyi.order.domain.vo.MgtPlTotalThirdOrderStaticsVO"> |
| | | SELECT |
| | | -- 订单数量统计 |
| | | COUNT(order_id) AS orderTotal, |
| | | IFNULL(SUM(CASE WHEN order_from = 5 THEN 1 ELSE 0 END), 0) AS meituan, |
| | | IFNULL(SUM(CASE WHEN order_from = 6 THEN 1 ELSE 0 END), 0) AS douyin, |
| | | IFNULL(SUM(CASE WHEN order_from = 7 THEN 1 ELSE 0 END), 0) AS kuaishou, |
| | | IFNULL(SUM(CASE WHEN order_from = 8 THEN 1 ELSE 0 END), 0) AS xiaoeyun, |
| | | |
| | | -- 订单金额统计(取order_money) |
| | | IFNULL(SUM(order_money), 0) AS orderTotalMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 5 THEN order_money ELSE 0 END), 0) AS meituanMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 6 THEN order_money ELSE 0 END), 0) AS douyinMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 7 THEN order_money ELSE 0 END), 0) AS kuaishouMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 8 THEN order_money ELSE 0 END), 0) AS xiaoeyunMoney |
| | | FROM |
| | | t_order |
| | | WHERE |
| | | del_flag = 0 -- 未删除 |
| | | AND order_from IN (5, 6, 7, 8) -- 仅统计三方平台订单 |
| | | -- 可选条件:按商户筛选 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND shop_id IN |
| | | <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | </mapper> |