| | |
| | | IFNULL(SUM(CASE WHEN order_from = 1 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(order_money),0) orderMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 1 THEN order_money ELSE 0 END),0) onlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 3 THEN order_money ELSE 0 END),0) offlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 2 THEN order_money ELSE 0 END),0) activityMoney |
| | | FROM t_order WHERE del_flag = 0 |
| | | IFNULL(SUM(change_receivable_money),0) orderMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 1 THEN change_receivable_money ELSE 0 END),0) onlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 3 THEN change_receivable_money ELSE 0 END),0) offlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 2 THEN change_receivable_money ELSE 0 END),0) activityMoney |
| | | FROM t_order WHERE del_flag = 0 AND order_status = 3 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND shop_id = #{param.shopId} |
| | | </if> |
| | |
| | | SELECT |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey, |
| | | COUNT(order_id) AS mapValueFirst, |
| | | IFNULL(SUM(order_money),0) AS mapValueSecond |
| | | FROM |
| | | t_order |
| | | WHERE |
| | | del_flag = 0 |
| | | AND Date(create_time) >= DATE_SUB(CURDATE(), INTERVAL 6 DAY) |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN change_receivable_money WHEN pay_type = 2 THEN change_receivable_money + online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_status IN (2,3) |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND shop_id = #{param.shopId} |
| | | </if> |
| | | GROUP BY |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') |
| | | ORDER BY |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') ASC |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY mapKey |
| | | ORDER BY mapKey ASC |
| | | </select> |
| | | |
| | | <select id="listTotalOrderTotalGoodsType" resultType="com.ruoyi.order.domain.vo.MgtMapTotalPlusVo"> |
| | | SELECT |
| | | tog.goods_type mapKey, |
| | | COUNT(DISTINCT toc.order_id) AS mapValueFirst, |
| | | IFNULL(SUM(tog.goods_total_money),0) AS mapValueSecond |
| | | FROM |
| | | t_order toc |
| | | IFNULL(SUM(tog.goods_receivable_money),0) AS mapValueSecond |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 |
| | | WHERE toc.del_flag = 0 AND toc.order_status IN (2,3) |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} |
| | | </if> |
| | | GROUP BY tog.goods_type |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(toc.create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY mapKey |
| | | </select> |
| | | |
| | | <select id="listTotalOrderTotalGoodsRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | | SELECT |
| | | tog.goods_name mapKey, |
| | | IFNULL(SUM(tog.goods_total_money),0) mapValue |
| | | IFNULL(SUM(tog.goods_receivable_money),0) mapValue |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 |
| | | WHERE toc.del_flag = 0 AND toc.order_status = 3 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} |
| | | </if> |
| | |
| | | WHEN 2 THEN "秒杀活动订单" |
| | | WHEN 3 THEN "线下创建订单" |
| | | END mapKey, |
| | | IFNULL(SUM(toc.order_money),0) mapValue |
| | | IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN toc.change_receivable_money WHEN toc.pay_type = 2 THEN toc.change_receivable_money + toc.online_pay_money ELSE 0 END),0) mapValue |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 |
| | | WHERE toc.del_flag = 0 AND toc.order_status IN (2,3) |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} |
| | | </if> |
| | |
| | | WHERE toc.del_flag = 0 AND order_from = 2 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} |
| | | </if> |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(toc.create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY tog.goods_type |
| | | </select> |
| | |
| | | IFNULL(SUM(CASE WHEN order_from = 1 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(order_money),0) orderMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 1 THEN order_money ELSE 0 END),0) onlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 3 THEN order_money ELSE 0 END),0) offlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 2 THEN order_money ELSE 0 END),0) activityMoney |
| | | FROM t_order WHERE del_flag = 0 |
| | | IFNULL(SUM(change_receivable_money),0) orderMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 1 THEN change_receivable_money ELSE 0 END),0) onlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 3 THEN change_receivable_money ELSE 0 END),0) offlineMoney, |
| | | IFNULL(SUM(CASE WHEN order_from = 2 THEN change_receivable_money ELSE 0 END),0) activityMoney |
| | | FROM t_order WHERE del_flag = 0 AND order_status = 3 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND shop_id IN |
| | | <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | SELECT |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey, |
| | | COUNT(order_id) AS mapValueFirst, |
| | | IFNULL(SUM(order_money),0) AS mapValueSecond |
| | | IFNULL(SUM(receivable_money),0) AS mapValueSecond |
| | | FROM |
| | | t_order |
| | | WHERE |
| | | del_flag = 0 |
| | | AND Date(create_time) >= DATE_SUB(CURDATE(), INTERVAL 6 DAY) |
| | | WHERE del_flag = 0 AND order_status = 3 |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(create_time) <= #{param.endDate} |
| | | </if> |
| | | <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> |
| | | GROUP BY |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') |
| | | ORDER BY |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') ASC |
| | | GROUP BY mapKey |
| | | ORDER BY mapKey ASC |
| | | </select> |
| | | |
| | | <select id="listPlTotalOrderTotalGoodsType" resultType="com.ruoyi.order.domain.vo.MgtMapTotalPlusVo"> |
| | |
| | | FROM |
| | | t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 |
| | | WHERE toc.del_flag = 0 AND toc.order_status IN (2,3) |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND toc.shop_id IN |
| | | <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | <select id="listPlTotalOrderTotalGoodsRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | | SELECT |
| | | tog.goods_name mapKey, |
| | | IFNULL(SUM(tog.goods_receivable_money),0) mapValue, |
| | | COUNT(DISTINCT toc.order_id) mapTotalValue |
| | | IFNULL(SUM(tog.goods_receivable_money),0) mapValue |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 |
| | | WHERE toc.del_flag = 0 AND order_status = 3 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND toc.shop_id IN |
| | | <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY tog.goods_name |
| | | ORDER BY SUM(tog.goods_total_money) DESC LIMIT 10 |
| | | GROUP BY mapKey |
| | | ORDER BY mapValue DESC LIMIT 15 |
| | | </select> |
| | | |
| | | <select id="listPlTotalOrderTotalOrderFrom" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | |
| | | END mapKey, |
| | | IFNULL(SUM(toc.order_money),0) mapValue |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 |
| | | WHERE toc.del_flag = 0 AND order_status = 3 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND toc.shop_id IN |
| | | <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY toc.order_from |
| | | ORDER BY SUM(toc.order_money) DESC LIMIT 10 |
| | | ORDER BY SUM(toc.order_money) DESC LIMIT 15 |
| | | </select> |
| | | |
| | | <select id="getPlTotalActivityTotal" resultType="com.ruoyi.order.domain.vo.MgtPlTotalActivityTotalVo"> |
| | |
| | | <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="param.activityId!=null and param.activityId!=''"> |
| | | AND toc.activity_id = #{param.activityId} |
| | | </if> |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(create_time) >= #{param.startDate} |
| | |
| | | COUNT(DISTINCT CASE WHEN tog.goods_type = 3 THEN toc.user_id ELSE NULL END) servicePerson |
| | | 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 = 2 AND toc.order_status = 3 AND toc.new_member_flag = 1 |
| | | WHERE toc.del_flag = 0 AND toc.order_from = 2 AND toc.order_status IN (2,3) AND toc.new_member_flag = 1 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND toc.shop_id IN |
| | | <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | </foreach> |
| | | </if> |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(create_time) >= #{param.startDate} |
| | | AND Date(toc.create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(create_time) <= #{param.endDate} |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY tog.goods_type |
| | | </select> |
| | |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN change_receivable_money WHEN pay_type = 2 THEN change_receivable_money + online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_from = 2 AND order_status = 3 |
| | | AND Date(create_time) >= DATE_SUB(CURDATE(), INTERVAL 6 DAY) |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(create_time) <= #{param.endDate} |
| | | </if> |
| | | <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> |
| | | GROUP BY |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') |
| | | ORDER BY |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') ASC |
| | | GROUP BY mapKey |
| | | ORDER BY mapKey ASC |
| | | </select> |
| | | |
| | | <select id="getPlUserIdAgeRank" resultType="java.lang.Long"> |
| | |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') |
| | | mapKey |
| | | ORDER BY |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') ASC |
| | | mapValue ASC |
| | | </select> |
| | | |
| | | <select id="listPlTotalShopActivityRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY shop_id |
| | | ORDER BY COUNT(order_id) DESC LIMIT 15 |
| | | GROUP BY mapKey |
| | | ORDER BY mapValue DESC LIMIT 15 |
| | | </select> |
| | | |
| | | <select id="listPlTotalShopActivitySalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | | SELECT |
| | | shop_id AS mapKey, |
| | | IFNULL(SUM(order_money),0) AS mapValue |
| | | shop_id AS mapKey, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN change_receivable_money WHEN pay_type = 2 THEN change_receivable_money+online_pay_money ELSE 0 END),0) AS mapValue |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_from = 2 |
| | | <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> |
| | | GROUP BY shop_id |
| | | ORDER BY SUM(order_money) DESC LIMIT 15 |
| | | </select> |
| | | |
| | | <select id="listPlTotalActivitySalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | | SELECT |
| | | activity_name AS mapKey, |
| | | IFNULL(SUM(order_money),0) AS mapValue |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_from = 2 |
| | | WHERE del_flag = 0 AND order_from = 2 AND order_status IN (2,3) |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND shop_id IN |
| | | <foreach collection="param.shopIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY activity_name |
| | | ORDER BY SUM(order_money) DESC LIMIT 15 |
| | | GROUP BY mapKey |
| | | ORDER BY mapValue DESC LIMIT 15 |
| | | </select> |
| | | |
| | | <select id="listPlTotalActivitySalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | | SELECT |
| | | activity_name AS mapKey, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN change_receivable_money WHEN pay_type = 2 THEN change_receivable_money+online_pay_money ELSE 0 END),0) AS mapValue |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_from = 2 AND order_status IN (2,3) |
| | | <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> |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY mapKey |
| | | ORDER BY mapValue DESC LIMIT 15 |
| | | </select> |
| | | |
| | | <select id="getMerHomeShopTotalVo" resultType="com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo"> |
| | |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | AND toc.create_time >= DATE_SUB(CURDATE(), INTERVAL 5 DAY) |
| | | AND toc.create_time >= DATE_SUB(CURDATE(), INTERVAL 4 DAY) |
| | | GROUP BY mapKey |
| | | </select> |
| | | |
| | |
| | | <if test="param.activityId !=null and param.activityId != ''"> |
| | | AND toc.activity_id = #{param.activityId} |
| | | </if> |
| | | AND toc.create_time >= DATE_SUB(CURDATE(), INTERVAL 5 DAY) |
| | | AND toc.create_time >= DATE_SUB(CURDATE(), INTERVAL 4 DAY) |
| | | GROUP BY mapKey |
| | | </select> |
| | | |
| | |
| | | GROUP BY mapKey |
| | | </select> |
| | | |
| | | <select id="getActivityMemberTotal" resultType="com.ruoyi.system.api.domain.vo.MgtMapIntTotalVo"> |
| | | SELECT |
| | | DATE(toc.create_time) AS mapKey, |
| | | COUNT(DISTINCT toc.user_id) AS mapValue |
| | | 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 = 2 AND toc.order_status IN (2,3) |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} |
| | | </if> |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(toc.create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY mapKey |
| | | </select> |
| | | |
| | | <select id="countUserBuyGoodsNum" resultType="java.lang.Integer"> |
| | | SELECT SUM(tog.buy_num) |
| | | FROM t_order toc |