| | |
| | | |
| | | <select id="getTotalActivityTotal" resultType="com.ruoyi.order.domain.vo.MgtTotalActivityTotalVo"> |
| | | SELECT |
| | | COUNT(order_id) orderTotal, |
| | | IFNULL(SUM(order_money),0) orderMoney, |
| | | COUNT(DISTINCT user_id) orderPerson |
| | | FROM t_order WHERE del_flag = 0 AND order_from = 2 |
| | | COUNT(CASE WHEN order_status = 3 THEN order_id ELSE NULL END) orderTotal, |
| | | IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN change_receivable_money WHEN order_status = 3 AND pay_type = 2 THEN change_receivable_money + online_pay_money ELSE 0 END),0) orderMoney, |
| | | COUNT(DISTINCT user_id) orderJoinPerson |
| | | FROM t_order WHERE del_flag = 0 AND order_from = 2 AND order_status IN (2,3) |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND shop_id = #{param.shopId} |
| | | </if> |
| | |
| | | tog.goods_type mapKey, |
| | | COUNT(DISTINCT toc.order_id) AS mapValueFirst, |
| | | IFNULL(SUM(tog.goods_total_money),0) AS mapValueSecond, |
| | | COUNT(DISTINCT toc.user_id) AS mapValueThird, |
| | | FROM |
| | | t_order toc |
| | | COUNT(DISTINCT toc.user_id) AS mapValueThird |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 AND order_from = 2 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | |
| | | SELECT |
| | | tog.goods_type mapKey, |
| | | COUNT(DISTINCT toc.order_id) AS mapValueFirst, |
| | | IFNULL(SUM(tog.goods_total_money),0) AS mapValueSecond |
| | | 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 |
| | |
| | | <select id="listPlTotalOrderTotalGoodsRank" 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, |
| | | COUNT(DISTINCT toc.order_id) mapTotalValue |
| | | FROM t_order toc |
| | | INNER JOIN t_order_goods tog ON tog.order_id = toc.order_id |
| | | WHERE toc.del_flag = 0 |
| | |
| | | |
| | | <select id="getPlTotalActivityTotal" resultType="com.ruoyi.order.domain.vo.MgtPlTotalActivityTotalVo"> |
| | | SELECT |
| | | COUNT(order_id) orderTotal, |
| | | IFNULL(SUM(order_money),0) orderMoney, |
| | | COUNT(DISTINCT user_id) orderPerson |
| | | FROM t_order WHERE del_flag = 0 AND order_from = 2 |
| | | COUNT(CASE WHEN order_status = 3 THEN order_id ELSE NULL END) orderTotal, |
| | | IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN change_receivable_money WHEN order_status = 3 AND pay_type = 2 THEN change_receivable_money + online_pay_money ELSE 0 END),0) orderMoney, |
| | | COUNT(DISTINCT user_id) orderJoinPerson |
| | | 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=")"> |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getPlTotalActivityMemberTotal" resultType="com.ruoyi.order.domain.vo.MgtPlTotalActivityTotalVo"> |
| | | SELECT |
| | | COUNT(DISTINCT toc.user_id) orderPerson, |
| | | COUNT(DISTINCT CASE WHEN tog.goods_type = 1 THEN toc.user_id ELSE NULL END) cyclePerson, |
| | | COUNT(DISTINCT CASE WHEN tog.goods_type = 2 THEN toc.user_id ELSE NULL END) experiencePerson, |
| | | 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 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND toc.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(toc.create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getTotalActivityMemberTotal" resultType="com.ruoyi.order.domain.vo.MgtTotalActivityTotalVo"> |
| | | SELECT |
| | | COUNT(DISTINCT toc.user_id) orderPerson, |
| | | COUNT(DISTINCT CASE WHEN tog.goods_type = 1 THEN toc.user_id ELSE NULL END) cyclePerson, |
| | | COUNT(DISTINCT CASE WHEN tog.goods_type = 2 THEN toc.user_id ELSE NULL END) experiencePerson, |
| | | 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 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND toc.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(toc.create_time) >= #{param.startDate} |
| | | </if> |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listPlTotalActivityTotalGoodsType" 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, |
| | | IFNULL(SUM(tog.goods_receivable_money),0) AS mapValueSecond, |
| | | COUNT(DISTINCT toc.user_id) AS mapValueThird |
| | | 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 |
| | | WHERE toc.del_flag = 0 AND toc.order_from = 2 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=")"> |
| | |
| | | SELECT |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey, |
| | | COUNT(DISTINCT order_id) AS mapValueFirst, |
| | | IFNULL(SUM(order_money),0) AS mapValueSecond |
| | | 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 |
| | | 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.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND shop_id IN |
| | |
| | | shop_id AS mapKey, |
| | | COUNT(order_id) 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=")"> |
| | | #{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 shop_id |
| | | ORDER BY COUNT(order_id) DESC LIMIT 15 |
| | |
| | | <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 activity_name |
| | | ORDER BY SUM(order_money) DESC LIMIT 15 |
| | |
| | | <if test="param.endDate!=null and param.endDate!=''"> |
| | | AND Date(toc.create_time) <= #{param.endDate} |
| | | </if> |
| | | GROUP BY mapValue |
| | | GROUP BY mapKey |
| | | ORDER BY mapValue DESC LIMIT 15 |
| | | </select> |
| | | |
| | |
| | | GROUP BY mapKey |
| | | </select> |
| | | |
| | | <select id="getMgtActivityGetMemberTotal" 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.order_from = 2 AND toc.new_member_flag = 1 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=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="param.userIdList !=null and param.userIdList.size()>0"> |
| | | AND toc.user_id IN |
| | | <foreach collection="param.userIdList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </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="getStaffActivityMemberTotal" 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.shop_id = #{param.shopId} AND toc.order_from = 2 |
| | | WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId} AND toc.order_from = 2 AND toc.order_staus IN (2,3) |
| | | <if test="param.activityId !=null and param.activityId != ''"> |
| | | AND toc.activity_id = #{param.activityId} |
| | | </if> |
| | |
| | | GROUP BY mapKey |
| | | </select> |
| | | |
| | | |
| | | <select id="getMgtActivityMemberTotal" 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_staus 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=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="param.userIdList !=null and param.userIdList.size()>0"> |
| | | AND toc.user_id IN |
| | | <foreach collection="param.userIdList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </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 |