| | |
| | | |
| | | </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,py.coursePackageId |
| | | FROM t_course_package_payment py |
| | | LEFT JOIN t_course_package cp ON py.coursePackageId = cp.id |
| | | GROUP BY studentId |
| | | ORDER BY studentId, length(name) desc ,totalClassHours |
| | | ) subquery |
| | | ) a |
| | | <where> |
| | | <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} |
| | | select |
| | | appUserId, |
| | | studentId, |
| | | coursePackageId, |
| | | count(1) as number |
| | | from ( |
| | | select |
| | | appUserId, |
| | | studentId, |
| | | coursePackageId |
| | | from t_course_package_scheduling |
| | | where `status` != 4 |
| | | <if test="null != appUserIds"> |
| | | and appUserId in |
| | | <foreach collection="appUserIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | |
| | | <if test="null != start and '' != start and null != end and '' != end"> |
| | | and DATE_FORMAT(classDate, '%Y-%m-%d') between #{start} and #{end} |
| | | </if> |
| | | order by classDate |
| | | ) as a |
| | | group by a.appUserId, a.studentId, a.coursePackageId |
| | | </select> |
| | | <select id="pacQueryDto" resultType="map"> |
| | | |