From 63170eb558babf81890cb23a453680e1054ecf85 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Fri, 09 Apr 2021 17:48:27 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/score_shop' into score_shop

---
 zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
index 2cfc1a1..ddb5b13 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
@@ -636,7 +636,7 @@
                     )totalPay,
                 (select IFNULL(sum(a.amount),0) from sys_order_flow a
                     inner join sys_order b on a.order_id=b.id and b.statu!='已取消'
-                    where a.pay_method not in ('储值卡', '欠款') and a.flow_type != '退款' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
+                    where a.pay_method not in ('储值卡', '欠款') and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
                     <if test="shopId != null">
                         and a.shop_id=#{shopId}
                     </if>
@@ -716,6 +716,28 @@
                         and a.company_id=#{companyId}
                     </if>
                 ) refund,
+                (select sum(IFNULL(amount, 0))
+                    from sys_order_flow a
+                    inner join sys_order b on a.order_id=b.id and b.STATU!='已取消'
+                    where a.pay_method='储值卡' and a.is_gift='N' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
+                    <if test="shopId != null">
+                        and a.shop_id=#{shopId}
+                    </if>
+                    <if test="companyId != null">
+                        and a.company_id=#{companyId}
+                    </if>
+                ) cardAmount,
+                (select sum(IFNULL(amount, 0))
+                    from sys_order_flow a
+                    inner join sys_order b on a.order_id=b.id and b.STATU!='已取消'
+                    where a.pay_method='储值卡' and a.is_gift='Y' and <![CDATA[ a.create_time > #{item.beginTime} and a.create_time < #{item.endTime}]]>
+                    <if test="shopId != null">
+                        and a.shop_id=#{shopId}
+                    </if>
+                    <if test="companyId != null">
+                        and a.company_id=#{companyId}
+                    </if>
+                ) cardFreeAmount,
                 (select IFNULL(count(1),0) from sys_order
                     where STATU in ('已付款', '欠款') and orderType=1 and <![CDATA[ ORDER_TIME > #{item.beginTime} and ORDER_TIME < #{item.endTime} ]]>
                     <if test="shopId != null">

--
Gitblit v1.9.1