| | |
| | | |
| | | </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 |
| | |
| | | <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> |
| | |
| | | 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> |