<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.dsh.course.mapper.TCoursePackagePaymentMapper">
|
|
<!-- 通用查询映射结果 -->
|
<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"/>
|
</resultMap>
|
<update id="updateUseTime">
|
update t_course_package_payment
|
set useTime = #{date}
|
where id = #{id}
|
</update>
|
<update id="updateHoursById">
|
update t_course_package_payment set classHours =classHours+#{i},laveClassHours =laveClassHours+#{i} where id =#{id}
|
</update>
|
<update id="updateHoursById1">
|
update t_course_package_payment set totalClassHours = totalClassHours+#{i},classHours =classHours+#{i},laveClassHours =laveClassHours+#{i} where id =#{id}
|
</update>
|
|
<select id="queryCountNumber" resultType="int">
|
SELECT
|
count( 1 ) AS num
|
FROM (
|
SELECT studentId FROM t_course_package_payment WHERE payStatus = 2 AND state = 1 and coursePackageId = #{coursePackageId} GROUP BY studentId
|
) AS aa
|
</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>
|
|
<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)
|
<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>
|
<if test="null != appUserId and '' != appUserId ">
|
and appUserId = #{appUserId}
|
</if>
|
</select>
|
|
|
<select id="queryRegistrationRecord" resultType="map">
|
select
|
CAST(id AS CHAR(20)) as id,
|
appUserId,
|
studentId,
|
DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as insertTime,
|
totalClassHours,
|
laveClassHours,
|
absencesNumber,
|
`status`
|
from t_course_package_order_student where state = 1
|
<if test="null != coursePackageId">
|
and coursePackageId = #{coursePackageId}
|
</if>
|
<if test="null != userIds">
|
and appUserId in
|
<foreach collection="userIds" item="item" index="index" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="null != studentIds">
|
and studentId in
|
<foreach collection="studentIds" item="item" index="index" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</if>
|
order by
|
CASE
|
WHEN laveClassHours < 3 THEN 0
|
ELSE 1
|
END, insertTime DESC
|
|
</select>
|
|
<select id="queryRegistrationRecord1" resultType="map">
|
select
|
CAST(id AS CHAR(20)) as id,
|
appUserId,
|
studentIds,
|
DATE_FORMAT(insertTime, '%Y-%m-%d %H:%i') as insertTime,
|
`status`
|
from t_course_package_order where state = 1
|
<if test="null != coursePackageId">
|
and coursePackageId = #{coursePackageId}
|
</if>
|
<if test="null != userIds">
|
and appUserId in
|
<foreach collection="userIds" item="item" index="index" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="null != studentIds">
|
and studentId in
|
<foreach collection="studentIds" item="item" index="index" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</if>
|
order by
|
insertTime DESC
|
</select>
|
|
|
|
<select id="queryWalkInStudentList" resultType="map">
|
select
|
CAST(id AS CHAR(20)) as id,
|
appUserId,
|
studentId
|
from t_course_package_payment where payStatus = 2 and state = 1
|
<if test="null != coursePackageId">
|
and coursePackageId = #{coursePackageId}
|
</if>
|
<if test="null != coursePackagePaymentId">
|
and id not in
|
<foreach collection="coursePackagePaymentId" item="item" index="index" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="null != userIds">
|
and appUserId in
|
<foreach collection="userIds" item="item" index="index" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="null != studentIds">
|
and studentId in
|
<foreach collection="studentIds" item="item" index="index" separator="," open="(" close=")">
|
#{item}
|
</foreach>
|
</if>
|
order by insertTime desc
|
</select>
|
<select id="getStudentIds" resultType="java.lang.Integer">
|
SELECT studentId
|
FROM t_course_package_payment
|
WHERE appUserId = #{appId} AND id != #{id} and coursePackageId=#{classId}
|
|
|
</select>
|
<select id="getStudentTotal" resultType="map">
|
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>
|
<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">
|
select
|
id,
|
name,
|
province,
|
city,
|
storeId,
|
count(1) as number
|
from (
|
select
|
b.id,
|
b.`name`,
|
b.province,
|
b.city,
|
b.storeId
|
from t_course_package_scheduling a
|
left join t_course_package b on (a.coursePackageId = b.id)
|
where a.`status` != 4 and b.status != 4 and b.auditStatus = 2 and b.state = 1
|
<if test="null != storeIds and storeIds.size() > 0">
|
and b.storeId in
|
<foreach collection="storeIds" item="item" index="index" open="(" separator="," close=")">
|
#{item}
|
</foreach>
|
</if>
|
<if test="null != start and '' != start and null != end and '' != end">
|
and DATE_FORMAT(a.classDate, '%Y-%m-%d') between #{start} and #{end}
|
</if>
|
<if test="null != name and '' != name">
|
and b.name like CONCAT('%', #{name}, '%')
|
</if>
|
order by classDate
|
) as aa group by aa.id, aa.name, aa.province, aa.city, aa.storeId
|
</select>
|
|
<select id="listOne" resultType="com.dsh.course.entity.TCoursePackagePayment">
|
select a.*,b.coursePackageTypeId as type from t_course_package_order_student a
|
left join t_course_package b on (a.coursePackageId = b.id)
|
where a.appUserId in
|
<foreach collection="ids" separator="," open="(" item="id" close=")">#{id}</foreach>
|
</select>
|
<select id="queryStore" resultType="java.lang.Integer">
|
SELECT
|
tc.storeId
|
FROM
|
t_payment_competition pc
|
LEFT JOIN t_competition tc on pc.competitionId = tc.id
|
WHERE pc.code=#{code}
|
</select>
|
<select id="queryRegistrationRecord3" resultType="java.util.Map">
|
SELECT CAST(id AS CHAR(20)) as id,
|
appUserId, studentId,
|
DATE_FORMAT(classDate, '%Y-%m-%d %H:%i') as insertTime,
|
DATE_FORMAT(DATE(MIN(classDate)), '%Y-%m-%d') AS totalClassHours,
|
DATE_FORMAT( DATE(MAX(endDate)), '%Y-%m-%d') AS laveClassHours,
|
'' as absencesNumber,
|
7 as status,
|
3 as type
|
FROM t_course_package_scheduling where type = 3
|
GROUP BY coursePackageId, studentId;
|
|
|
</select>
|
|
<update id="updateBytime">
|
update t_course_package_payment
|
set laveClassHours = #{coursePackagePayment.laveClassHours},absencesNumber=#{coursePackagePayment.absencesNumber}
|
where id = #{coursePackagePayment.id}
|
</update>
|
</mapper>
|