From ded7b20c06c16646a1f718c32a78e463844da6da Mon Sep 17 00:00:00 2001
From: luo <2855143437@qq.com>
Date: 星期日, 08 十月 2023 15:11:01 +0800
Subject: [PATCH] 10.8

---
 cloud-server-course/src/main/resources/mapper/TCoursePackagePaymentMapper.xml |   68 ++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/cloud-server-course/src/main/resources/mapper/TCoursePackagePaymentMapper.xml b/cloud-server-course/src/main/resources/mapper/TCoursePackagePaymentMapper.xml
index cbbc616..69dabbb 100644
--- a/cloud-server-course/src/main/resources/mapper/TCoursePackagePaymentMapper.xml
+++ b/cloud-server-course/src/main/resources/mapper/TCoursePackagePaymentMapper.xml
@@ -134,6 +134,74 @@
 
 
     </select>
+    <select id="getStudentTotal" resultType="map">
+
+        SELECT * from(
+                         SELECT studentId, totalClassHours, name as courseName, laveClassHours,cashPayment as cashPayment,hasHours,appUserId,insertTime
+                         FROM (
+                                  SELECT studentId, totalClassHours, name, laveClassHours,cashPayment, (totalClassHours - laveClassHours) AS hasHours,py.appUserId,py.insertTime
+                                  FROM t_course_package_payment py
+                                           LEFT JOIN t_course_package cp ON py.coursePackageId = cp.id
+                                  UNION ALL
+                                  SELECT studentId, SUM(totalClassHours) AS totalClassHours,'总计' as name, SUM(laveClassHours) AS laveClassHours, SUM(cashPayment) AS cashPayment,
+                                         (SUM(totalClassHours) - SUM(laveClassHours)) AS hasHours,py.appUserId,py.insertTime
+                                  FROM t_course_package_payment py
+                                           LEFT JOIN t_course_package cp ON py.coursePackageId = cp.id
+                                  GROUP BY studentId
+                                  ORDER BY studentId, totalClassHours
+                              ) subquery
+                     ) a
+        <where>
+            <if test="null != start and '' != start and null != end and '' != end">
+                  a.insertTime between #{start} and #{end}
+            </if>
+
+        </where>
+
+    </select>
+    <select id="pacQueryDto" resultType="map">
+
+        SELECT
+            coursePackageId,
+            SUM( cashPayment ) AS cashPayment,
+            SUM( totalClassHours ) AS totalClassHours,
+            SUM( totalClassHours - laveClassHours ) AS hasHours,
+            ROUND( SUM(( totalClassHours - laveClassHours ) * ( cashPayment / totalClassHours )), 2 ) AS lavePay,
+            cp.`name` ,
+            cp.province,
+            cp.city,
+            cp.storeId,cp.cityCode,cp.provinceCode,py.insertTime
+        FROM
+            t_course_package_payment py
+                LEFT JOIN t_course_package cp ON py.coursePackageId = cp.id
+
+
+        <where>
+            <if test="null != start and '' != start and null != end and '' != end">
+                py.insertTime between #{start} and #{end}
+            </if>
+            <if test="null != cityCode and '' != cityCode">
+               and cityCode =#{cityCode}
+            </if>
+
+            <if test="null != provinceCode and '' != provinceCode">
+                and provinceCode =#{provinceCode}
+            </if>
+
+            <if test="null != name and '' != name">
+                and name like CONCAT('%', #{name}, '%')
+            </if>
+
+
+        </where>
+        GROUP BY
+            coursePackageId
+
+
+
+
+    </select>
+
 
     <update id="updateBytime">
         update  t_course_package_payment

--
Gitblit v1.7.1