| | |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.dsh.course.entity.TCoursePackagePayment"> |
| | | <id column="id" property="id" /> |
| | | <result column="appUserId" property="appUserId" /> |
| | | <result column="studentId" property="studentId" /> |
| | | <result column="coursePackageId" property="coursePackageId" /> |
| | | <result column="payType" property="payType" /> |
| | | <result column="classHours" property="classHours" /> |
| | | <result column="cashPayment" property="cashPayment" /> |
| | | <result column="playPaiCoin" property="playPaiCoin" /> |
| | | <result column="totalClassHours" property="totalClassHours" /> |
| | | <result column="laveClassHours" property="laveClassHours" /> |
| | | <result column="absencesNumber" property="absencesNumber" /> |
| | | <result column="payUserType" property="payUserType" /> |
| | | <result column="payStatus" property="payStatus" /> |
| | | <result column="orderNumber" property="orderNumber" /> |
| | | <result column="payUserId" property="payUserId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="withdrawalTime" property="withdrawalTime" /> |
| | | <result column="certificate" property="certificate" /> |
| | | <result column="state" property="state" /> |
| | | <result column="insertTime" property="insertTime" /> |
| | | <id column="id" property="id"/> |
| | | <result column="appUserId" property="appUserId"/> |
| | | <result column="studentId" property="studentId"/> |
| | | <result column="coursePackageId" property="coursePackageId"/> |
| | | <result column="payType" property="payType"/> |
| | | <result column="classHours" property="classHours"/> |
| | | <result column="cashPayment" property="cashPayment"/> |
| | | <result column="playPaiCoin" property="playPaiCoin"/> |
| | | <result column="totalClassHours" property="totalClassHours"/> |
| | | <result column="laveClassHours" property="laveClassHours"/> |
| | | <result column="absencesNumber" property="absencesNumber"/> |
| | | <result column="payUserType" property="payUserType"/> |
| | | <result column="payStatus" property="payStatus"/> |
| | | <result column="orderNumber" property="orderNumber"/> |
| | | <result column="payUserId" property="payUserId"/> |
| | | <result column="status" property="status"/> |
| | | <result column="withdrawalTime" property="withdrawalTime"/> |
| | | <result column="certificate" property="certificate"/> |
| | | <result column="state" property="state"/> |
| | | <result column="insertTime" property="insertTime"/> |
| | | </resultMap> |
| | | <update id="updateUseTime"> |
| | | update t_course_package_payment |
| | |
| | | </select> |
| | | |
| | | <select id="getCoursePackagePaymentByCode" resultType="com.dsh.course.entity.TCoursePackagePayment"> |
| | | select * from t_course_package_payment where 1=1 |
| | | <if test="code != null"> |
| | | and `code` = #{code} |
| | | </if> |
| | | select * from t_course_package_payment where 1=1 |
| | | <if test="code != null"> |
| | | and `code` = #{code} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="billingDataRequestVo" resultType="com.dsh.course.model.BillingRequest"> |
| | | SELECT DATE_FORMAT(insertTime, '%m-%d %H:%i')as `time`,IFNULL(playPaiCoin, cashPayment) AS amount |
| | | from t_course_package_payment |
| | | where payStatus = 2 and state = 1 and payType in (1,2) |
| | | where payStatus = 2 and state = 1 and payType in (1,2) |
| | | <if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd"> |
| | | and DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd} |
| | | </if> |
| | |
| | | and appUserId = #{appUserId} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="queryRegistrationRecord" resultType="map"> |
| | |
| | | </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 |
| | | 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} |
| | | a.insertTime between #{start} and #{end} |
| | | </if> |
| | | <if test="coursePackageIds != null and coursePackageIds.size()>0"> |
| | | AND a.coursePackageId IN |
| | |
| | | <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 |
| | | 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 |
| | | 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 |
| | |
| | | py.insertTime between #{start} and #{end} |
| | | </if> |
| | | <if test="null != cityCode and '' != cityCode"> |
| | | and cityCode =#{cityCode} |
| | | and cityCode =#{cityCode} |
| | | </if> |
| | | |
| | | <if test="null != provinceCode and '' != provinceCode"> |
| | |
| | | |
| | | </where> |
| | | GROUP BY |
| | | coursePackageId |
| | | |
| | | |
| | | coursePackageId |
| | | |
| | | |
| | | </select> |
| | | |
| | | <select id="listOne" resultType="com.dsh.course.entity.TCoursePackagePayment"> |
| | | select * from t_course_package_payment where appUserId in <foreach collection="ids" separator="," open="(" item="id" close=")">#{id}</foreach> |
| | | select * from t_course_package_payment where appUserId in |
| | | <foreach collection="ids" separator="," open="(" item="id" close=")">#{id}</foreach> |
| | | </select> |
| | | <select id="queryStore" resultType="java.lang.Integer"> |
| | | SELECT |