| | |
| | | </resultMap>--> |
| | | |
| | | |
| | | |
| | | <resultMap id="merOrderResultMap" type="com.ruoyi.order.domain.vo.MerOrderPageVo"> |
| | | <result column="userId" property="userId"/> |
| | | <result column="orderId" property="orderId"/> |
| | |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR |
| | | EXISTS( SELECT 1 FROM t_order_goods tog WHERE tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')) ) |
| | | EXISTS( SELECT 1 FROM t_order_goods tog WHERE tog.order_id = toc.order_id AND tog.goods_name LIKE |
| | | CONCAT('%',#{param.keyword},'%')) ) |
| | | </if> |
| | | ORDER BY toc.create_time DESC |
| | | </select> |
| | |
| | | toc.order_money orderGoodsMoney, |
| | | toc.coupon_money couponDiscount, |
| | | toc.pay_type payType, |
| | | CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney, |
| | | CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN |
| | | toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney, |
| | | toc.receivable_deposit receivableDeposit, |
| | | toc.pay_money payMoney, |
| | | (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) relReceiveMoney, |
| | | (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE |
| | | toc.change_receivable_money END) relReceiveMoney, |
| | | CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN IFNULL(toc.offline_pay_money,0) END receiveMoney, |
| | | (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) - (CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN IFNULL(toc.offline_pay_money,0) END) unPaidMoney, |
| | | (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE |
| | | toc.change_receivable_money END) - (CASE toc.pay_type WHEN 1 THEN toc.pay_money WHEN 2 THEN |
| | | IFNULL(toc.offline_pay_money,0) END) unPaidMoney, |
| | | toc.create_time createTime, |
| | | toc.close_flag closeFlag |
| | | FROM t_order toc |
| | |
| | | AND Date(toc.create_time) <= #{param.endOrderDate} |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR EXISTS( SELECT 1 FROM t_order_goods tog WHERE tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')) |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR EXISTS( SELECT 1 FROM t_order_goods tog WHERE |
| | | tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')) |
| | | <if test="param.memberUserIdList != null and param.memberUserIdList.size()>0"> |
| | | OR toc.user_id IN |
| | | <foreach collection="param.memberUserIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | IFNULL(SUM(IFNULL(toc.receivable_money,0)),0) totalReceivableMoney, |
| | | IFNULL(SUM(IFNULL(toc.discount_money,0)),0) totalDiscountMoney, |
| | | IFNULL(SUM(IFNULL(toc.pay_money,0)),0) totalPayMoney, |
| | | IFNULL(SUM((CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END)),0) totalReceiveMoney |
| | | IFNULL(SUM((CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN |
| | | toc.receivable_money ELSE toc.change_receivable_money END)),0) totalReceiveMoney |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND toc.user_id = #{param.memberUserId} |
| | | <if test="param.orderStatus != null"> |
| | |
| | | WHEN 2 THEN "待核销" |
| | | WHEN 3 THEN "已完成" |
| | | END orderStatus, |
| | | 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, |
| | | 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.order_money orderGoodsMoney, |
| | | toc.discount_money discountMoney, |
| | | toc.receivable_money receivableMoney, |
| | | toc.pay_money payMoney, |
| | | (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) receiveMoney, |
| | | (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE |
| | | toc.change_receivable_money END) receiveMoney, |
| | | toc.create_time createTime, |
| | | toc.order_from orderFrom, |
| | | CASE toc.order_from |
| | |
| | | AND toc.order_status = #{param.orderStatus} |
| | | </if> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from |
| | | = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | </if> |
| | | <if test="param.orderFrom != null and param.orderFrom != ''"> |
| | | AND toc.order_from = #{param.orderFrom} |
| | |
| | | AND Date(toc.create_time) <= #{param.endOrderDate} |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') EXISTS( SELECT 1 FROM t_order_goods tog WHERE tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%'))) |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') EXISTS( SELECT 1 FROM t_order_goods tog WHERE |
| | | tog.order_id = toc.order_id AND tog.goods_name LIKE CONCAT('%',#{param.keyword},'%'))) |
| | | </if> |
| | | ORDER BY toc.create_time DESC |
| | | </select> |
| | |
| | | AND tog.goods_type = #{param.goodsType} |
| | | </if> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from |
| | | = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | </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) |
| | | 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.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |
| | |
| | | <select id="totalOrderFirst" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal"> |
| | | SELECT |
| | | COUNT(temp.order_id) orderTotal, |
| | | IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END),0) orderMoneyTotal |
| | | IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN |
| | | temp.receivable_money ELSE temp.change_receivable_money END),0) orderMoneyTotal |
| | | FROM |
| | | (SELECT toc.order_id,toc.change_receivable_money,toc.receivable_money,toc.pay_money |
| | | FROM t_order toc |
| | |
| | | <!--AND toc.shop_id = #{param.shopId}--> |
| | | <!--</if>--> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from |
| | | = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | </if> |
| | | <if test="param.shopIds != null and param.shopIds != ''"> |
| | | AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) > 0 |
| | | </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) |
| | | 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.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |
| | |
| | | <select id="totalOrderSecond" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal"> |
| | | SELECT |
| | | COUNT(temp.order_id) shopOrderTotal, |
| | | IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END),0) shopOrderMoneyTotal, |
| | | IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN |
| | | temp.receivable_money ELSE temp.change_receivable_money END),0) shopOrderMoneyTotal, |
| | | IFNULL(SUM(temp.pay_money),0) shopPayMoneyTotal, |
| | | IFNULL(SUM(CASE WHEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) > temp.pay_money THEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) - temp.pay_money ELSE 0 END),0) shopUnPayMoneyTotal |
| | | IFNULL(SUM(CASE WHEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN |
| | | temp.receivable_money ELSE temp.change_receivable_money END) > temp.pay_money THEN (CASE WHEN null = |
| | | temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE |
| | | temp.change_receivable_money END) - temp.pay_money ELSE 0 END),0) shopUnPayMoneyTotal |
| | | FROM |
| | | (SELECT toc.order_id,toc.change_receivable_money,toc.receivable_money,toc.pay_money |
| | | FROM t_order toc |
| | |
| | | <!--AND toc.shop_id = #{param.shopId}--> |
| | | <!--</if>--> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from |
| | | = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | </if> |
| | | <if test="param.shopIds != null and param.shopIds != ''"> |
| | | AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) > 0 |
| | | </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) |
| | | 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.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |
| | |
| | | <select id="totalOrderThird" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal"> |
| | | SELECT |
| | | COUNT(temp.order_id) activityOrderTotal, |
| | | IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END),0) activityOrderMoneyTotal, |
| | | IFNULL(SUM(CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN |
| | | temp.receivable_money ELSE temp.change_receivable_money END),0) activityOrderMoneyTotal, |
| | | IFNULL(SUM(temp.pay_money),0) activityPayMoneyTotal, |
| | | IFNULL(SUM(CASE WHEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) > temp.pay_money THEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) - temp.pay_money ELSE 0 END),0)activityUnPayMoneyTotal |
| | | IFNULL(SUM(CASE WHEN (CASE WHEN null = temp.change_receivable_money or temp.change_receivable_money = 0 THEN |
| | | temp.receivable_money ELSE temp.change_receivable_money END) > temp.pay_money THEN (CASE WHEN null = |
| | | temp.change_receivable_money or temp.change_receivable_money = 0 THEN temp.receivable_money ELSE |
| | | temp.change_receivable_money END) - temp.pay_money ELSE 0 END),0)activityUnPayMoneyTotal |
| | | FROM |
| | | (SELECT toc.order_id,toc.change_receivable_money,toc.receivable_money,toc.pay_money |
| | | FROM t_order toc |
| | |
| | | <!--AND toc.shop_id = #{param.shopId}--> |
| | | <!--</if>--> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from |
| | | = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | </if> |
| | | <if test="param.shopIds != null and param.shopIds != ''"> |
| | | and toc.order_status = 3 AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) > 0 |
| | | </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) |
| | | 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.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |
| | |
| | | AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) > 0 |
| | | </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) |
| | | 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.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |
| | |
| | | toc.receivable_money receivableMoney, |
| | | toc.create_time createTime, |
| | | 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, |
| | | -- 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.shop_id shopId, |
| | | toc.use_time verifyTime, |
| | | CASE toc.order_from |
| | |
| | | AND tog.goods_type = #{param.goodsType} |
| | | </if> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from |
| | | = 1) OR (toc.unbinding_flag = 1 AND toc.order_from = 2 AND toc.order_status = 3)) |
| | | </if> |
| | | <if test="param.shopIds != null and param.shopIds != ''"> |
| | | AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) > 0 |
| | | </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) |
| | | 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.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |
| | |
| | | |
| | | <select id="boardOrderTotal" resultType="com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo"> |
| | | SELECT |
| | | IFNULL(SUM(CASE WHEN order_status = 3 THEN (CASE WHEN null = change_receivable_money or 0 = change_receivable_money THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) salesTotal, |
| | | IFNULL(SUM(CASE WHEN order_status = 3 THEN (CASE WHEN null = change_receivable_money or 0 = |
| | | change_receivable_money THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) salesTotal, |
| | | IFNULL(SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END),0) UnUseOrderTotal, |
| | | IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityOrderTotal |
| | | FROM t_order |
| | |
| | | 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(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 = 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 |
| | | 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 = 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 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND shop_id = #{param.shopId} |
| | |
| | | SELECT |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey, |
| | | COUNT(order_id) AS mapValueFirst, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 |
| | | THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = |
| | | change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + |
| | | online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_status = 3 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | |
| | | WHEN 2 THEN "秒杀订单" |
| | | WHEN 3 THEN "线下订单" |
| | | END mapKey, |
| | | IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) WHEN toc.pay_type = 2 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) + toc.online_pay_money ELSE 0 END),0) mapValue |
| | | IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN (CASE WHEN null = toc.change_receivable_money or |
| | | toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) WHEN |
| | | toc.pay_type = 2 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN |
| | | toc.receivable_money ELSE toc.change_receivable_money END) + toc.online_pay_money ELSE 0 END),0) mapValue |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND toc.order_status = 3 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | |
| | | <select id="getTotalActivityTotal" resultType="com.ruoyi.order.domain.vo.MgtTotalActivityTotalVo"> |
| | | SELECT |
| | | 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 (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) orderMoney, |
| | | IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or |
| | | change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND |
| | | pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money |
| | | ELSE change_receivable_money END) + 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 =3 AND shop_id = #{param.shopId} |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | |
| | | SELECT |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey, |
| | | COUNT(DISTINCT order_id) AS mapValueFirst, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 |
| | | THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = |
| | | change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + |
| | | 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 shop_id = #{param.shopId} |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | |
| | | |
| | | <select id="getTotalDataMemberTotal" resultType="com.ruoyi.order.domain.vo.MgtTotalDataTotalVo"> |
| | | SELECT |
| | | COUNT(DISTINCT CASE WHEN goods_type_1_count > 0 AND goods_type_3_count = 0 THEN user_id ELSE NULL END) AS onlyCyclePerson, |
| | | COUNT(DISTINCT CASE WHEN goods_type_1_count = 0 AND goods_type_3_count > 0 THEN user_id ELSE NULL END) AS onlyExperiencePerson, |
| | | COUNT(DISTINCT CASE WHEN goods_type_1_count > 0 AND goods_type_3_count > 0 THEN user_id ELSE NULL END) AS experienceCyclePerson, |
| | | COUNT(DISTINCT CASE WHEN goods_type_1_count > 0 OR goods_type_2_count > 0 OR goods_type_3_count > 0 OR goods_type_4_count > 0 THEN user_id ELSE NULL END) AS orderPerson |
| | | COUNT(DISTINCT CASE WHEN goods_type_1_count > 0 AND goods_type_3_count = 0 THEN user_id ELSE NULL END) AS |
| | | onlyCyclePerson, |
| | | COUNT(DISTINCT CASE WHEN goods_type_1_count = 0 AND goods_type_3_count > 0 THEN user_id ELSE NULL END) AS |
| | | onlyExperiencePerson, |
| | | COUNT(DISTINCT CASE WHEN goods_type_1_count > 0 AND goods_type_3_count > 0 THEN user_id ELSE NULL END) AS |
| | | experienceCyclePerson, |
| | | COUNT(DISTINCT CASE WHEN goods_type_1_count > 0 OR goods_type_2_count > 0 OR goods_type_3_count > 0 OR |
| | | goods_type_4_count > 0 THEN user_id ELSE NULL END) AS orderPerson |
| | | FROM ( |
| | | SELECT |
| | | o.user_id, |
| | |
| | | </select> |
| | | |
| | | <select id="shopSalesTotal" resultType="java.math.BigDecimal"> |
| | | SELECT IFNULL(SUM(CASE pay_type WHEN 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) |
| | | SELECT IFNULL(SUM(CASE pay_type WHEN 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money |
| | | = 0 THEN receivable_money ELSE change_receivable_money END) WHEN 2 THEN (CASE WHEN null = |
| | | change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money |
| | | END)+online_pay_money ELSE 0 END),0) |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_status = 3 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | |
| | | IFNULL(SUM(CASE WHEN order_from = 6 THEN receivable_money ELSE 0 END),0) douyinAmount, |
| | | IFNULL(SUM(CASE WHEN order_from = 7 THEN 1 ELSE 0 END),0) kuaishou, |
| | | IFNULL(SUM(CASE WHEN order_from = 7 THEN receivable_money ELSE 0 END),0) kuaishouAmount, |
| | | 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 = 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 |
| | | 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 = 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 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | | AND shop_id IN |
| | |
| | | SELECT |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey, |
| | | COUNT(order_id) AS mapValueFirst, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 |
| | | THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = |
| | | change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + |
| | | online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | FROM |
| | | t_order |
| | | WHERE del_flag = 0 AND order_status = 3 |
| | |
| | | WHEN 3 THEN "线下订单" |
| | | WHEN 4 then "抽奖订单" |
| | | END mapKey, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) mapValue |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 |
| | | THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = |
| | | change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + |
| | | online_pay_money ELSE 0 END),0) mapValue |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND order_status = 3 |
| | | <if test="param.shopIdList != null and param.shopIdList.size() > 0"> |
| | |
| | | <select id="getPlTotalActivityTotal" resultType="com.ruoyi.order.domain.vo.MgtPlTotalActivityTotalVo"> |
| | | SELECT |
| | | 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 (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) orderMoney, |
| | | IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or |
| | | change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND |
| | | pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money |
| | | ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) orderMoney, |
| | | COUNT(DISTINCT user_id) orderJoinPerson |
| | | FROM t_order WHERE del_flag = 0 AND order_from = 2 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | |
| | | COUNT(DISTINCT CASE WHEN tog.goods_type = 2 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 AND toc.shop_id = #{param.shopId} |
| | | WHERE toc.del_flag = 0 AND toc.order_from = 2 AND toc.order_status = 3 AND toc.new_member_flag = 1 AND |
| | | toc.shop_id = #{param.shopId} |
| | | <if test="param.startDate!=null and param.startDate!=''"> |
| | | AND Date(toc.create_time) >= #{param.startDate} |
| | | </if> |
| | |
| | | SELECT |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') AS mapKey, |
| | | COUNT(DISTINCT order_id) AS mapValueFirst, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 |
| | | THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = |
| | | change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) + |
| | | online_pay_money ELSE 0 END),0) AS mapValueSecond |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_from = 2 AND order_status = 3 |
| | | <if test="param.activityId!=null and param.activityId!=''"> |
| | |
| | | <select id="listPlTotalShopActivitySalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | | SELECT |
| | | shop_id AS mapKey, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) AS mapValue |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 |
| | | THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = |
| | | change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money |
| | | END)+online_pay_money ELSE 0 END),0) AS mapValue |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_from = 2 AND order_status = 3 |
| | | <if test="param.activityId!=null and param.activityId!=''"> |
| | |
| | | <select id="listPlTotalActivitySalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | | SELECT |
| | | activity_name AS mapKey, |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) AS mapValue |
| | | IFNULL(SUM(CASE WHEN pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 |
| | | THEN receivable_money ELSE change_receivable_money END) WHEN pay_type = 2 THEN (CASE WHEN null = |
| | | change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money |
| | | END)+online_pay_money ELSE 0 END),0) AS mapValue |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_from = 2 AND order_status = 3 |
| | | <if test="param.activityId!=null and param.activityId!=''"> |
| | |
| | | </select> |
| | | |
| | | <select id="getMerHomeShopTotalVo" resultType="com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo"> |
| | | |
| | | SELECT sum(aa.unHandleOrder) as unHandleOrder,sum(aa.shopTurnover) as shopTurnover FROM ( |
| | | SELECT |
| | | IFNULL(SUM(CASE WHEN order_status = 2 AND order_from = 1 THEN 1 ELSE 0 END),0) unHandleOrder, |
| | | IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) shopTurnover |
| | | IFNULL(SUM(CASE WHEN order_status = 2 THEN 1 ELSE 0 END),0) unHandleOrder, |
| | | 0 AS shopTurnover |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND shop_id = #{shopId} AND order_status IN (2,3) |
| | | UNION ALL |
| | | SELECT |
| | | 0, |
| | | IFNULL(SUM(CASE WHEN order_status = 3 AND pay_type = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN order_status = 3 AND pay_type = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) shopTurnover |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND shop_id = #{shopId} AND order_status IN (2,3) and DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m') |
| | | ) AS aa |
| | | </select> |
| | | |
| | | <select id="getMerHomeShopServiceTotalVo" resultType="com.ruoyi.system.api.domain.vo.MerHomeShopTotalVo"> |
| | |
| | | IFNULL(SUM(CASE WHEN order_from in (1,4,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 in (1,4,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 |
| | | 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 in (1,4,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 |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND shop_id = #{param.shopId} |
| | |
| | | <select id="totalMerOrder" resultType="com.ruoyi.order.domain.vo.MerTotalOrderVo"> |
| | | SELECT |
| | | COUNT(toc.order_id) orderTotal, |
| | | IFNULL(SUM(CASE toc.pay_type WHEN 1 THEN toc.receivable_money WHEN 2 THEN order_money-coupon_money-online_pay_money END),0) receivableMoney, |
| | | IFNULL(SUM(CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END),0) relReceiveMoney, |
| | | IFNULL(SUM(IF(toc.order_from = 3, toc.offline_pay_money, IF(toc.order_from != 3 AND toc.pay_type = 1, toc.online_pay_money, IFNULL(toc.offline_pay_money,0)))),0) relPayMoney, |
| | | IFNULL(SUM((CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END)-IFNULL(IF(toc.order_from = 3, toc.offline_pay_money, IF(toc.order_from != 3 AND toc.pay_type = 1, toc.online_pay_money, IFNULL(toc.offline_pay_money,0))),0)),0) unpaidMoney, |
| | | IFNULL(SUM(CASE toc.pay_type WHEN 1 THEN toc.receivable_money WHEN 2 THEN |
| | | order_money-coupon_money-online_pay_money END),0) receivableMoney, |
| | | IFNULL(SUM(CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN |
| | | toc.receivable_money ELSE toc.change_receivable_money END),0) relReceiveMoney, |
| | | IFNULL(SUM(IF(toc.order_from = 3, toc.offline_pay_money, IF(toc.order_from != 3 AND toc.pay_type = 1, |
| | | toc.online_pay_money, IFNULL(toc.offline_pay_money,0)))),0) relPayMoney, |
| | | IFNULL(SUM((CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN |
| | | toc.receivable_money ELSE toc.change_receivable_money END)-IFNULL(IF(toc.order_from = 3, toc.offline_pay_money, |
| | | IF(toc.order_from != 3 AND toc.pay_type = 1, toc.online_pay_money, IFNULL(toc.offline_pay_money,0))),0)),0) |
| | | unpaidMoney, |
| | | IFNULL(SUM(CASE toc.pay_type WHEN 2 THEN toc.online_pay_money ELSE 0 END),0) receivableDeposit |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId} and if(toc.order_from = 1, 1 = 1, toc.order_status = 3)<!--临时增加过滤--> |
| | | WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId} and if(toc.order_from = 1, 1 = 1, toc.order_status = |
| | | 3)<!--临时增加过滤--> |
| | | <if test="param.memberUserId != null and param.memberUserId != ''"> |
| | | AND toc.user_id = #{param.memberUserId} |
| | | </if> |
| | |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (toc.order_no LIKE CONCAT('%',#{param.keyword},'%') OR |
| | | toc.order_id IN (SELECT DISTINCT tog.order_id FROM t_order_goods tog WHERE tog.goods_name LIKE CONCAT('%',#{param.keyword},'%')) |
| | | toc.order_id IN (SELECT DISTINCT tog.order_id FROM t_order_goods tog WHERE tog.goods_name LIKE |
| | | CONCAT('%',#{param.keyword},'%')) |
| | | <if test="param.memberUserIdList != null and param.memberUserIdList.size()>0"> |
| | | OR toc.user_id IN |
| | | <foreach collection="param.memberUserIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | toc.user_id userId, |
| | | toc.order_money orderMoney, |
| | | toc.discount_money discountMoney, |
| | | CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney, |
| | | (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) payMoney, |
| | | CASE toc.order_from WHEN 1 THEN '小程序' WHEN 2 THEN CONCAT('秒杀活动(',toc.activity_name,')') WHEN 3 THEN '线下创建' END orderFrom, |
| | | CASE toc.pay_type WHEN 1 THEN toc.order_money-toc.coupon_money WHEN 2 THEN |
| | | toc.order_money-toc.coupon_money-toc.online_pay_money END receivableMoney, |
| | | (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE |
| | | toc.change_receivable_money END) payMoney, |
| | | CASE toc.order_from WHEN 1 THEN '小程序' WHEN 2 THEN CONCAT('秒杀活动(',toc.activity_name,')') WHEN 3 THEN '线下创建' END |
| | | orderFrom, |
| | | CASE toc.order_status |
| | | WHEN 0 THEN "已取消" |
| | | WHEN 1 THEN "待支付" |
| | |
| | | <select id="getStaffActivityOrderTotal" resultType="com.ruoyi.order.domain.vo.StaffActivityOrderTotalVo"> |
| | | SELECT |
| | | COUNT(DISTINCT toc.order_id) orderTotal, |
| | | IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) WHEN toc.pay_type = 2 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) + toc.online_pay_money ELSE 0 END),0) orderMoney, |
| | | IFNULL(SUM(CASE WHEN toc.pay_type = 1 THEN (CASE WHEN null = toc.change_receivable_money or |
| | | toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END) WHEN |
| | | toc.pay_type = 2 THEN (CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN |
| | | toc.receivable_money ELSE toc.change_receivable_money END) + toc.online_pay_money ELSE 0 END),0) orderMoney, |
| | | COUNT(DISTINCT toc.user_id) memberTotal |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 AND toc.shop_id = #{param.shopId} AND toc.order_from = 2 AND toc.order_status = 3 |
| | |
| | | SELECT |
| | | COUNT(DISTINCT toc.order_id) orderTotal, |
| | | IFNULL(SUM(toc.order_money),0) totalOrderMoney, |
| | | IFNULL(SUM(CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN toc.receivable_money ELSE toc.change_receivable_money END),0) totalReceiveMoney, |
| | | IFNULL(SUM(CASE WHEN null = toc.change_receivable_money or toc.change_receivable_money = 0 THEN |
| | | toc.receivable_money ELSE toc.change_receivable_money END),0) totalReceiveMoney, |
| | | IFNULL(SUM(CASE WHEN toc.pay_type = 2 THEN toc.online_pay_money ELSE 0 END),0) totalDepositMoney |
| | | FROM t_order toc |
| | | WHERE toc.del_flag = 0 |
| | |
| | | <select id="shopSalesRank" resultType="com.ruoyi.system.api.domain.vo.MgtMapBigTotalVo"> |
| | | SELECT |
| | | shop_id mapKey, |
| | | SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) mapValue |
| | | SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE |
| | | change_receivable_money END) mapValue |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_status = 3 AND shop_id IN |
| | | <foreach collection="shopIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | |
| | | <select id="getAgencyTotalVo" resultType="com.ruoyi.system.api.domain.vo.AgencyTotalVo"> |
| | | SELECT |
| | | IFNULL(SUM(CASE pay_type WHEN 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) WHEN 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 END),0) areaTurnover |
| | | IFNULL(SUM(CASE pay_type WHEN 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 |
| | | THEN receivable_money ELSE change_receivable_money END) WHEN 2 THEN (CASE WHEN null = change_receivable_money or |
| | | change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END)+online_pay_money ELSE 0 |
| | | END),0) areaTurnover |
| | | FROM t_order |
| | | WHERE del_flag = 0 AND order_status = 3 AND shop_id IN |
| | | <foreach collection="shopIdList" item="item" open="(" separator="," close=")"> |
| | |
| | | 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) |
| | | 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 toc.create_time >= #{param.createTimeBegin} |
| | |
| | | COUNT(temp.order_id) thirdOrderTotal, |
| | | IFNULL(SUM( temp.receivable_money ),0) thirdOrderMoneyTotal, |
| | | IFNULL(SUM(temp.pay_money),0) thirdPayMoneyTotal, |
| | | IFNULL(SUM(CASE WHEN (temp.receivable_money ) > temp.pay_money THEN ( temp.receivable_money ) - temp.pay_money ELSE 0 END),0)thirdUnPayMoneyTotal |
| | | IFNULL(SUM(CASE WHEN (temp.receivable_money ) > temp.pay_money THEN ( temp.receivable_money ) - |
| | | temp.pay_money ELSE 0 END),0)thirdUnPayMoneyTotal |
| | | FROM |
| | | (SELECT toc.order_id,toc.receivable_money,toc.pay_money |
| | | FROM t_order toc |
| | |
| | | <!--AND toc.shop_id = #{param.shopId}--> |
| | | <!--</if>--> |
| | | <if test="param.shopId != null and param.shopId != ''"> |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from in (5,6,7)) OR (toc.unbinding_flag = 1 AND toc.order_from in (5,6,7) AND toc.order_status = 3)) |
| | | AND toc.shop_id = #{param.shopId} AND (toc.unbinding_flag = 0 OR (toc.unbinding_flag = 1 AND toc.order_from |
| | | in (5,6,7)) OR (toc.unbinding_flag = 1 AND toc.order_from in (5,6,7) AND toc.order_status = 3)) |
| | | </if> |
| | | <if test="param.shopIds != null and param.shopIds != ''"> |
| | | and toc.order_status = 3 AND FIND_IN_SET(toc.shop_id, #{param.shopIds}) > 0 |
| | | </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) |
| | | 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.verifyStartTime != null and param.verifyStartTime != ''"> |
| | | AND Date(toc.use_time) >= #{param.verifyStartTime} |