44323
2023-11-05 75bac456c3d66f6b173b1213776158c3bc5f8b96
cloud-server-course/src/main/resources/mapper/TCoursePackagePaymentMapper.xml
@@ -134,16 +134,17 @@
    </select>
    <select id="getStudentTotal" resultType="map">
        SELECT * from(
                         SELECT studentId, totalClassHours, name as courseName, laveClassHours,cashPayment as cashPayment,hasHours,appUserId,insertTime
                         ,coursePackageId
                         FROM (
                                  SELECT studentId, totalClassHours, name, laveClassHours,cashPayment, (totalClassHours - laveClassHours) AS hasHours,py.appUserId,py.insertTime
                                    ,coursePackageId
                                  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
                                         (SUM(totalClassHours) - SUM(laveClassHours)) AS hasHours,py.appUserId,py.insertTime,py.coursePackageId
                                  FROM t_course_package_payment py
                                           LEFT JOIN t_course_package cp ON py.coursePackageId = cp.id
                                  GROUP BY studentId
@@ -154,7 +155,12 @@
            <if test="null != start and '' != start and null != end and '' != end">
                  a.insertTime between #{start} and #{end}
            </if>
            <if test="coursePackageIds != null and coursePackageIds.size()>0">
                AND a.coursePackageId IN
                <foreach collection="coursePackageIds" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
        </where>
    </select>
@@ -173,9 +179,13 @@
        FROM
            t_course_package_payment py
                LEFT JOIN t_course_package cp ON py.coursePackageId = cp.id
        <where>
            <if test="storeIds != null and storeIds.size()>0">
                AND cp.id IN
                <foreach collection="storeIds" separator="," item="id" open="(" close=")">
                    #{id}
                </foreach>
            </if>
            <if test="null != start and '' != start and null != end and '' != end">
                py.insertTime between #{start} and #{end}
            </if>