| | |
| | | <select id="totalOrderFirst" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal"> |
| | | SELECT |
| | | COUNT(temp.order_id) orderTotal, |
| | | IFNULL(SUM(CASE WHEN 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} 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 |
| | | 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) |
| | |
| | | <select id="totalOrderSecond" resultType="com.ruoyi.order.domain.vo.MgtOrderTotal"> |
| | | SELECT |
| | | COUNT(temp.order_id) shopOrderTotal, |
| | | IFNULL(SUM(CASE WHEN 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 temp.change_receivable_money = 0 THEN temp.receivable_money ELSE temp.change_receivable_money END) > temp.pay_money THEN temp.change_receivable_money - 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 temp.change_receivable_money - 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} 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 |
| | | 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.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 |
| | | 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) |
| | |
| | | |
| | | <select id="boardOrderTotal" resultType="com.ruoyi.system.api.domain.vo.MgtBulletinBoardVo"> |
| | | SELECT |
| | | IFNULL(SUM(CASE WHEN order_status = 3 THEN change_receivable_money 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) 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 |
| | | WHERE del_flag = 0 AND order_status IN (2,3) |
| | | <if test="null != shopIds and shopIds.size() > 0"> |
| | | and order_status = 3 and shop_id in |
| | | and ( |
| | | order_from = 2 and order_status = 3 and shop_id in |
| | | <foreach collection="shopIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) or ( |
| | | order_from = 1 and shop_id in |
| | | <foreach collection="shopIds" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | </select> |
| | | |