123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887 |
- <?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.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao">
- <resultMap type="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment" id="CourseScheduleStudentPayment">
- <result column="id_" property="id" />
- <result column="group_type_" property="groupType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="music_group_id_" property="musicGroupId"/>
- <result column="course_schedule_id_" property="courseScheduleId" />
- <result column="user_id_" property="userId" />
- <result column="original_price_" property="originalPrice"/>
- <result column="expect_price_" property="expectPrice" />
- <result column="actual_price_" property="actualPrice" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- <result column="settlement_time_" property="settlementTime" />
- <result column="class_group_id_" property="classGroupId" />
- <result column="batch_no_" property="batchNo"/>
- <result column="be_merged_" property="beMerged"/>
- </resultMap>
- <resultMap type="com.ym.mec.biz.dal.dto.StudentCourseTimesDto" id="studentCourseTimesDto">
- <result column="user_id_" property="userId" />
- <result column="totalTimes" property="totalCourseTimes"/>
- <result column="vipTimes" property="vipCourseTimes" />
- <result column="practiceTmes" property="practiceCourseTimes" />
- <result column="freePracticeTimes" property="freePracticeCourseTimes" />
- </resultMap>
- <resultMap id="CourseScheduleStudentPaymentDto" type="com.ym.mec.biz.dal.entity.CourseScheduleStudentPaymentDto" extends="CourseScheduleStudentPayment">
- <result column="course_status_" property="courseStatus" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result column="course_start_time_" property="courseStartTime"/>
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="CourseScheduleStudentPayment" >
- SELECT * FROM course_schedule_student_payment WHERE id_ = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="CourseScheduleStudentPayment">
- SELECT * FROM course_schedule_student_payment ORDER BY id_
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- INSERT INTO course_schedule_student_payment (id_,group_type_,music_group_id_,course_schedule_id_,user_id_,
- original_price_,expect_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_,be_merged_)
- VALUES(#{id},#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{musicGroupId},#{courseScheduleId},#{userId},
- #{originalPrice},#{expectPrice},#{actualPrice},#{createTime},NOW(),#{settlementTime},#{classGroupId},#{batchNo},#{beMerged})
- </insert>
- <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
- INSERT INTO course_schedule_student_payment (id_,group_type_,music_group_id_,course_schedule_id_,user_id_,expect_price_,
- original_price_,actual_price_,create_time_,update_time_,settlement_time_,class_group_id_,batch_no_,be_merged_)
- VALUE
- <foreach collection="list" item="data" separator=",">
- (#{data.id},#{data.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{data.musicGroupId},#{data.courseScheduleId},#{data.userId},#{data.expectPrice},
- #{data.originalPrice},#{data.actualPrice},now(),now(),#{data.settlementTime},#{data.classGroupId},#{data.batchNo},#{data.beMerged})
- </foreach>
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment">
- UPDATE course_schedule_student_payment
- <set>
- <if test="userId != null">
- user_id_ = #{userId},
- </if>
- <if test="courseScheduleId != null">
- course_schedule_id_ = #{courseScheduleId},
- </if>
- <if test="groupType != null">
- group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="musicGroupId != null">
- music_group_id_ = #{musicGroupId},
- </if>
- <if test="settlementTime != null">
- settlement_time_ = #{settlementTime},
- </if>
- <if test="expectPrice != null">
- expect_price_ = #{expectPrice},
- </if>
- <if test="actualPrice != null">
- actual_price_ = #{actualPrice},
- </if>
- <if test="createTime != null">
- create_time_ = #{createTime},
- </if>
- <if test="classGroupId != null">
- class_group_id_ = #{classGroupId},
- </if>
- <if test="batchNo != null">
- batch_no_ = #{batchNo},
- </if>
- <if test="originalPrice != null">
- original_price_ = #{originalPrice},
- </if>
- <if test="beMerged != null">
- be_merged_ = #{beMerged},
- </if>
- update_time_ = NOW()
- </set> WHERE id_ = #{id}
- </update>
- <update id="batchUpdate" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment">
- <foreach collection="courseScheduleStudentPayments" item="courseScheduleStudentPayment" separator=";">
- UPDATE course_schedule_student_payment
- <set>
- <if test="courseScheduleStudentPayment.userId != null">
- user_id_ = #{courseScheduleStudentPayment.userId},
- </if>
- <if test="courseScheduleStudentPayment.courseScheduleId != null">
- course_schedule_id_ = #{courseScheduleStudentPayment.courseScheduleId},
- </if>
- <if test="courseScheduleStudentPayment.groupType != null">
- group_type_ = #{courseScheduleStudentPayment.groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
- </if>
- <if test="courseScheduleStudentPayment.musicGroupId != null">
- music_group_id_ = #{courseScheduleStudentPayment.musicGroupId},
- </if>
- <if test="courseScheduleStudentPayment.settlementTime != null">
- settlement_time_ = #{courseScheduleStudentPayment.settlementTime},
- </if>
- <if test="courseScheduleStudentPayment.expectPrice != null">
- expect_price_ = #{courseScheduleStudentPayment.expectPrice},
- </if>
- <if test="courseScheduleStudentPayment.actualPrice != null">
- actual_price_ = #{courseScheduleStudentPayment.actualPrice},
- </if>
- <if test="courseScheduleStudentPayment.createTime != null">
- create_time_ = #{courseScheduleStudentPayment.createTime},
- </if>
- <if test="courseScheduleStudentPayment.classGroupId != null">
- class_group_id_ = #{courseScheduleStudentPayment.classGroupId},
- </if>
- <if test="courseScheduleStudentPayment.batchNo != null">
- batch_no_ = #{courseScheduleStudentPayment.batchNo},
- </if>
- <if test="courseScheduleStudentPayment.originalPrice != null">
- original_price_ = #{courseScheduleStudentPayment.originalPrice},
- </if>
- <if test="courseScheduleStudentPayment.beMerged != null">
- be_merged_ = #{courseScheduleStudentPayment.beMerged},
- </if>
- update_time_ = NOW()
- </set> WHERE id_ = #{courseScheduleStudentPayment.id}
- </foreach>
- </update>
- <update id="adjustPlayMidi">
- UPDATE course_schedule_student_payment cssp
- <set>
- <if test="content == null or content == ''">
- cssp.open_play_midi_ = NULL,cssp.update_time_ = NOW()
- </if>
- <if test="content != null and content != ''">
- cssp.open_play_midi_ = #{content},cssp.update_time_ = NOW()
- </if>
- </set>
- <where>
- cssp.course_schedule_id_ = #{courseScheduleId}
- <if test="userId != null and userId != ''">
- AND FIND_IN_SET(cssp.user_id_,#{userId})
- </if>
- </where>
- </update>
- <update id="adjustExamSong">
- UPDATE course_schedule_student_payment SET exam_song_download_json_ = #{examSongJson}
- WHERE course_schedule_id_ = #{roomId}
- <if test="userId != null">
- AND user_id_ = #{userId}
- </if>
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM course_schedule_student_payment WHERE id_ = #{id}
- </delete>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="CourseScheduleStudentPayment" parameterType="map">
- SELECT * FROM course_schedule_student_payment ORDER BY id_ <include refid="global.limit"/>
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM course_schedule_student_payment
- </select>
- <select id="findByCourseScheduleIds" resultMap="CourseScheduleStudentPayment">
- SELECT * FROM course_schedule_student_payment WHERE course_schedule_id_ IN
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <resultMap id="StudentAttendanceStatisticsResp" type="com.ym.mec.biz.dal.dto.StudentAttendanceStatisticsResponse">
- <result property="userId" column="user_id_"/>
- <result property="studentName" column="username_"/>
- </resultMap>
- <select id="findStudentByClassGroup" resultMap="StudentAttendanceStatisticsResp">
- SELECT
- cssp.user_id_,
- su.username_
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
- WHERE
- cssp.class_group_id_ = #{classGroupId}
- GROUP BY
- cssp.user_id_
- ORDER BY cssp.user_id_
- <include refid="global.limit"/>
- </select>
- <select id="countStudentByClassGroup" resultType="int">
- SELECT
- COUNT(DISTINCT cssp.user_id_)
- FROM
- course_schedule_student_payment cssp
- WHERE
- cssp.class_group_id_ = #{classGroupId}
- </select>
- <select id="countSurplusCourseFee" resultType="java.math.BigDecimal">
- SELECT
- SUM(expect_price_)
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- WHERE
- (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
- AND cssp.user_id_ = #{userId}
- AND CONCAT(cs.class_date_ ,' ',cs.start_class_time_) > NOW()
- AND cs.class_group_id_ = #{classGroupId} AND cs.pre_course_flag_ = 0
- </select>
- <select id="countAllCourseFee" resultType="java.math.BigDecimal">
- SELECT
- SUM(expect_price_)
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- WHERE
- (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
- AND cs.class_group_id_ = #{classGroupId} AND cs.pre_course_flag_ = 0
- </select>
- <select id="findNotStartCourseStudentPaymentIdsWithClassGroupAndStudent" resultType="int">
- SELECT
- cssp.id_
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
- WHERE
- cssp.class_group_id_ = #{classGroupId}
- AND cssp.user_id_ = #{userId}
- AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW() AND cs.pre_course_flag_ = 0
- </select>
- <select id="findVipGroupCoursePrice" resultType="java.math.BigDecimal">
- SELECT
- cssp.expect_price_
- FROM
- course_schedule cs
- LEFT JOIN course_schedule_student_payment cssp ON cs.id_ = cssp.course_schedule_id_
- WHERE
- cs.music_group_id_ = #{vipGroupId}
- AND cs.teach_mode_ = #{teachMode}
- AND cs.group_type_ = 'VIP'
- AND cssp.expect_price_ IS NOT NULL
- ORDER BY CONCAT(cs.class_date_,' ',cs.start_class_time_) DESC LIMIT 1
- </select>
- <select id="findStudentCourseNum" resultType="java.util.Map">
- SELECT COUNT(DISTINCT cssp.id_) 'value',cssp.music_group_id_ 'key' FROM course_schedule cs
- LEFT JOIN course_schedule_student_payment cssp ON cs.music_group_id_ = cssp.music_group_id_ AND cs.id_ = cssp.course_schedule_id_
- WHERE cs.music_group_id_ IN
- <foreach collection="musicGroupIds" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- AND cs.group_type_ = #{groupType} AND cssp.user_id_ = #{userId}
- AND cs.status_ = 'NOT_START' AND cs.del_flag_ = 0 AND cs.pre_course_flag_ = 0
- GROUP BY cssp.music_group_id_
- </select>
- <select id="countStudentCourseNumWithGroup" resultType="int">
- SELECT COUNT(id_) FROM course_schedule_student_payment WHERE group_type_=#{groupType} AND music_group_id_=#{groupId}
- </select>
- <select id="queryMusicStudentPer" resultType="java.lang.Integer">
- SELECT cssp.user_id_ FROM course_schedule_student_payment cssp
- LEFT JOIN music_group mg ON cssp.music_group_id_ = mg.id_ AND cssp.group_type_ = 'MUSIC'
- LEFT JOIN student_registration sr ON cssp.user_id_ = sr.user_id_ AND cssp.music_group_id_ = sr.music_group_id_
- WHERE mg.status_ = 'PROGRESS' AND sr.music_group_status_ != 'QUIT'
- GROUP BY cssp.user_id_
- </select>
- <select id="queryVipStudentPer" resultType="java.lang.Integer">
- SELECT cssp.user_id_ FROM course_schedule_student_payment cssp
- LEFT JOIN vip_group vg ON cssp.music_group_id_ = vg.id_
- WHERE vg.group_status_ IN (2,4) AND cssp.group_type_ = 'VIP'
- GROUP BY cssp.user_id_
- </select>
- <select id="countCourseStudentNum" resultType="java.util.Map">
- SELECT
- sa.course_schedule_id_ AS 'key',
- COUNT( DISTINCT sa.user_id_ ) AS 'value'
- FROM
- course_schedule_student_payment sa
- WHERE course_schedule_id_ IN
- <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
- #{courseId}
- </foreach>
- GROUP BY
- course_schedule_id_
- </select>
- <select id="checkStudentHaveCourse" resultType="int">
- SELECT COUNT(id_) FROM course_schedule_student_payment WHERE course_schedule_id_=#{courseScheduleId} AND user_id_=#{userId}
- </select>
- <select id="findByCourseSchedule" resultMap="CourseScheduleStudentPayment">
- SELECT * FROM course_schedule_student_payment WHERE course_schedule_id_ = #{courseScheduleId}
- </select>
- <resultMap id="VipGroupGiveCourseSortDto" type="com.ym.mec.biz.dal.dto.VipGroupGiveCourseSortDto" extends="CourseScheduleStudentPayment">
- <result property="courseStartTime" column="course_start_time_"/>
- <result property="courseEndTime" column="course_end_time_"/>
- <result property="teachMode" column="teach_mode_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- </resultMap>
- <select id="findVipGroupSortCourseByGroup" resultMap="VipGroupGiveCourseSortDto">
- SELECT
- cssp.*,
- cs.teach_mode_,
- CONCAT(cs.class_date_,' ',cs.start_class_time_) course_start_time_,
- CONCAT(cs.class_date_,' ',cs.end_class_time_) course_end_time_
- FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
- WHERE cssp.music_group_id_=#{groupId} AND cssp.group_type_='VIP'
- -- AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()
- AND cssp.settlement_time_ IS NULL
- </select>
- <select id="countStudentNum" resultType="java.lang.Integer">
- SELECT COUNT(id_) FROM course_schedule_student_payment WHERE course_schedule_id_ = #{courseScheduleId}
- </select>
- <select id="countCourseOnlyStudentNum" resultType="int">
- SELECT COUNT(user_id_) FROM course_schedule_student_payment WHERE course_schedule_id_ = #{courseScheduleId}
- </select>
- <select id="findStudents" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
- SELECT su.id_ user_id_,su.username_,su.avatar_ head_url_,su.gender_
- FROM course_schedule_student_payment cssp
- LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
- WHERE cssp.course_schedule_id_ = #{courseScheduleId}
- GROUP BY su.id_
- </select>
- <select id="getStudentIdMap" resultType="java.util.Map">
- SELECT cssp.course_schedule_id_ 'key',GROUP_CONCAT(DISTINCT cssp.user_id_) 'value'
- FROM course_schedule_student_payment cssp
- WHERE cssp.course_schedule_id_ IN
- <foreach collection="courseScheduleIds" item="scheduleId" open="(" close=")" separator=",">
- #{scheduleId}
- </foreach>
- GROUP BY cssp.course_schedule_id_
- </select>
- <resultMap id="Practice4ExercisesSituationDto" type="com.ym.mec.biz.dal.dto.Practice4ExercisesSituationDto">
- <result property="userId" column="user_id_"/>
- <result property="courseStartTime" column="start_class_time_"/>
- <result property="actualTeacherId" column="actual_teacher_id_"/>
- </resultMap>
- <select id="findNoPracticeStudentIdsOnWeek" resultMap="Practice4ExercisesSituationDto">
- SELECT
- cssp.user_id_,
- CONCAT(cs.class_date_, ' ', cs.start_class_time_) start_class_time_,
- pg.user_id_ actual_teacher_id_
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- LEFT JOIN practice_group pg ON cssp.music_group_id_=pg.id_
- LEFT JOIN student s ON cssp.user_id_=s.user_id_
- WHERE
- cssp.group_type_ = 'PRACTICE'
- AND s.service_tag_=1
- AND cssp.user_id_ NOT IN (
- SELECT
- cssp1.user_id_
- FROM
- course_schedule_student_payment cssp1
- LEFT JOIN course_schedule cs1 ON cssp1.course_schedule_id_ = cs1.id_
- WHERE cssp1.group_type_ = 'PRACTICE'
- AND cs1.class_date_ BETWEEN #{monday} AND #{sunday}
- )
- ORDER BY
- cssp.user_id_
- </select>
- <select id="findNoPracticeStudentTeacherId" resultType="java.lang.Integer">
- SELECT cs.actual_teacher_id_
- FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_
- WHERE cssp.group_type_='PRACTICE' AND cssp.user_id_=#{studentId} AND cs.actual_teacher_id_ IS NOT NULL
- ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) DESC LIMIT 1;
- </select>
- <delete id="deleteStudentCourseSchedule">
- DELETE FROM course_schedule_student_payment WHERE user_id_ = #{userId} AND course_schedule_id_ IN
- <foreach collection="courseScheduleIdList" item="courseScheduleId" index="index" open="(" close=")" separator=",">
- #{courseScheduleId}
- </foreach>
- </delete>
- <delete id="deleteByCourseSchedule">
- DELETE FROM course_schedule_student_payment WHERE course_schedule_id_ IN
- <foreach collection="courseScheduleIds" item="courseScheduleId" index="index" open="(" close=")" separator=",">
- #{courseScheduleId}
- </foreach>
- </delete>
- <delete id="batchDeleteWithID">
- DELETE FROM course_schedule_student_payment WHERE id_ IN
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </delete>
- <delete id="deleteStudentCourseScheduleByUserId">
- DELETE FROM course_schedule_student_payment WHERE course_schedule_id_ = #{courseScheduleId} AND user_id_ IN
- <foreach collection="userIdList" item="userId" index="index" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- </delete>
- <delete id="deleteByMusicGroupId" parameterType="map">
- DELETE cssp FROM course_schedule_student_payment cssp left join course_schedule cs on cssp.course_schedule_id_ = cs.id_ WHERE cssp.music_group_id_=#{musicGroupId} AND cssp.group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} and cs.status_ = 'NOT_START'
- </delete>
- <delete id="deleteByGroup">
- DELETE FROM course_schedule_student_payment WHERE music_group_id_=#{groupId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </delete>
- <delete id="deletePreCourse">
- DELETE FROM course_schedule_student_payment WHERE course_schedule_id_ IN (
- SELECT id_ FROM course_schedule WHERE music_group_id_ = #{musicGroupId} AND group_type_ = 'MUSIC' AND pre_course_flag_ = 1)
- </delete>
- <select id="queryStudentNotStartCourseTimesOfOnline" resultMap="studentCourseTimesDto">
- SELECT cssp.`user_id_`,count(*) totalTimes,
- sum(CASE pg.type_ WHEN 'FREE' THEN 0 WHEN 'CHARGE' THEN 1 END) practiceTmes,
- sum(case when (pg.type_='FREE' AND cssp.`group_type_` = 'PRACTICE' ) then 1 ELSE 0 END) freePracticeTimes
- FROM course_schedule_student_payment cssp LEFT JOIN course_schedule cs on cssp.course_schedule_id_ = cs.id_
- LEFT JOIN practice_group pg ON pg.id_ = cs.music_group_id_ AND cs.group_type_ = 'PRACTICE'
- WHERE cs.`teach_mode_` = 'ONLINE' AND cs.status_ = 'NOT_START'
- GROUP BY cssp.`user_id_`
- </select>
- <resultMap id="StudentTeacherCourseDto" type="com.ym.mec.biz.dal.dto.StudentTeacherCourseDto">
- <result property="studentId" column="student_id_"/>
- <result property="teacherId" column="teacher_id_"/>
- <result property="groupType" column="group_type_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result property="groupId" column="group_id_"/>
- <result property="courseScheduleType" column="course_schedule_type_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
- <result property="classesStartTime" column="classes_start_time_"/>
- </resultMap>
- <select id="findAllStudentCourseInfo" resultMap="StudentTeacherCourseDto">
- SELECT
- cssp.user_id_ student_id_,
- cssp.group_type_ group_type_,
- cssp.music_group_id_ group_id_,
- cs.type_ course_schedule_type_,
- CONCAT(cs.class_date_, ' ', cs.start_class_time_) classes_start_time_,
- cgtm.user_id_ teacher_id_
- FROM
- student s
- LEFT JOIN course_schedule_student_payment cssp ON s.user_id_=cssp.user_id_
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- LEFT JOIN class_group_teacher_mapper cgtm ON cssp.class_group_id_=cgtm.class_group_id_
- WHERE cs.type_ IN ('PRACTICE', 'VIP', 'SINGLE', 'MIX') AND cs.pre_course_flag_ = 0 AND cgtm.teacher_role_='BISHOP';
- </select>
- <select id="findCoursePayment" resultType="map">
- SELECT
- course_schedule_id_ AS 'key',
- SUM( CASE WHEN actual_price_ IS NULL THEN expect_price_ ELSE actual_price_ END ) AS 'value'
- FROM
- course_schedule_student_payment
- WHERE course_schedule_id_ IN
- <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
- #{courseScheduleId}
- </foreach>
- GROUP BY
- course_schedule_id_
- </select>
- <select id="countStudentNotStartCourseNumWithCourseType" resultType="int">
- SELECT COUNT(DISTINCT cssp.course_schedule_id_) FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_
- WHERE cssp.user_id_=#{studentId}
- <if test="courseScheduleType != null">
- AND cs.type_= #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) > NOW() AND cs.pre_course_flag_ = 0
- </select>
- <select id="countStudentsNotStartCourseNumWithCourseType" resultType="map">
- SELECT cssp.user_id_ 'key',COUNT(DISTINCT cssp.course_schedule_id_) 'value'
- FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_
- WHERE cssp.user_id_ IN
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
- #{studentId}
- </foreach>
- <if test="courseScheduleType != null">
- AND cs.type_= #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </if>
- AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) > NOW() AND cs.pre_course_flag_ = 0
- GROUP BY cssp.user_id_
- </select>
- <select id="queryMidiByUserIdsAndCourseId" resultType="java.util.Map">
- SELECT cssp.user_id_ 'key',CASE WHEN cssp.open_play_midi_ IS NULL THEN '' ELSE cssp.open_play_midi_ END 'value' FROM course_schedule_student_payment cssp
- WHERE cssp.user_id_ IN
- <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- AND cssp.course_schedule_id_ = #{courseScheduleId}
- </select>
- <select id="queryExamSongByUserIdsAndCourseId" resultType="java.util.Map">
- SELECT user_id_ 'key',CASE WHEN exam_song_download_json_ IS NULL THEN '' ELSE exam_song_download_json_ END 'value' FROM course_schedule_student_payment
- WHERE user_id_ IN
- <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- AND course_schedule_id_ = #{courseScheduleId}
- </select>
- <select id="getMidiByCourseIdAndUserId" resultType="java.lang.String">
- SELECT cssp.open_play_midi_ FROM course_schedule_student_payment cssp
- WHERE cssp.user_id_ = #{userId} AND cssp.course_schedule_id_ = #{courseScheduleId}
- </select>
- <select id="getExamJsonByCourseIdAndUserId" resultType="java.lang.String">
- SELECT cssp.exam_song_download_json_ FROM course_schedule_student_payment cssp
- WHERE cssp.user_id_ = #{userId} AND cssp.course_schedule_id_ = #{courseScheduleId}
- </select>
- <select id="findGroupCoursesUnitPrice" resultType="java.util.Map">
- SELECT
- music_group_id_ AS 'key',
- CONVERT ( SUM( expect_price_ ) / COUNT(DISTINCT course_schedule_id_ ), DECIMAL ( 10, 2 ) ) AS 'value'
- FROM
- course_schedule_student_payment
- WHERE
- group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- AND music_group_id_ IN
- <foreach collection="groupIds" item="groupId" separator="," open="(" close=")">
- #{groupId}
- </foreach>
- GROUP BY
- music_group_id_;
- </select>
- <resultMap id="RongyunBasicUserDto" type="com.ym.mec.biz.dal.dto.RongyunBasicUserDto">
- <result property="userName" column="username_"/>
- <result property="userId" column="user_id_"/>
- <result property="headUrl" column="avatar_"/>
- </resultMap>
- <select id="queryNoJoinStu" resultMap="RongyunBasicUserDto">
- SELECT CASE WHEN su.username_ IS NULL THEN su.real_name_ ELSE su.username_ END username_,
- su.avatar_,cssp.user_id_
- FROM course_schedule_student_payment cssp
- LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
- WHERE cssp.course_schedule_id_ = #{courseScheduleId}
- AND NOT EXISTS (SELECT * FROM rongyun_room_member rrm WHERE rrm.rid = #{roomId} AND rrm.uid = cssp.user_id_)
- </select>
- <select id="countNotStartCourseStudentNumWithGroup" resultType="int">
- SELECT
- COUNT( cssp.user_id_ )
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- WHERE
- cssp.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- AND cssp.music_group_id_ = #{groupId} AND cs.pre_course_flag_ = 0
- AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) > NOW( )
- </select>
- <select id="findByBatchNo" resultMap="CourseScheduleStudentPayment">
- SELECT * FROM course_schedule_student_payment WHERE batch_no_=#{batchNo}
- </select>
- <select id="getClassGroupNoStartCourse" resultMap="CourseScheduleStudentPayment">
- SELECT cssp.* FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- WHERE cssp.class_group_id_ IN
- <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
- #{classGroupId}
- </foreach>
- AND cs.status_ = 'NOT_START' AND cs.pre_course_flag_ = 0 ORDER BY cssp.id_ ASC
- </select>
- <select id="findStudentLastCourseSchedule" resultType="java.util.Map">
- SELECT
- cssp.user_id_ AS 'key',
- MAX(CONCAT( cs.class_date_, ' ', cs.start_class_time_ )) AS 'value'
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- WHERE
- cssp.user_id_ IN
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
- #{studentId}
- </foreach>
- AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) < NOW( ) AND cs.pre_course_flag_ = 0
- GROUP BY user_id_;
- </select>
- <sql id="queryAllCondition">
- <where>
- <if test="courseScheduleId != null">
- course_schedule_id_ = #{courseScheduleId}
- </if>
- </where>
- </sql>
- <select id="queryAll" resultMap="CourseScheduleStudentPayment">
- SELECT * FROM course_schedule_student_payment
- <include refid="queryAllCondition" />
- ORDER BY id_
- <include refid="global.limit"/>
- </select>
- <select id="countAll" resultType="int">
- SELECT COUNT(*) FROM course_schedule_student_payment
- <include refid="queryAllCondition" />
- </select>
- <select id="countStudentDouble11CourseTime" resultMap="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentVipDouble11Dto">
- SELECT
- cssp.user_id_ userId,
- SUM(CASE vgc.student_num_ WHEN 1 THEN 1 ELSE 0 END) course_one_to_one_time_,
- SUM(CASE vgc.student_num_ WHEN 2 THEN 1 ELSE 0 END) course_one_to_two_time_
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN vip_group vg ON cssp.music_group_id_ = vg.id_
- LEFT JOIN vip_group_category vgc ON vg.vip_group_category_id_ = vgc.id_
- WHERE
- cssp.group_type_ = 'VIP'
- AND cssp.create_time_ > '2020-11-11 00:00:00'
- AND cssp.user_id_ IN
- <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- AND vg.vip_group_activity_id_ IN
- <foreach collection="specialActivityIds" item="specialActivityId" open="(" close=")" separator=",">
- #{specialActivityId}
- </foreach>
- GROUP BY
- cssp.user_id_
- </select>
- <select id="findNeedUpdateActualPriceStudentCourses" resultMap="CourseScheduleStudentPaymentDto">
- SELECT
- cssp.*,
- CASE WHEN cs.new_course_id_ IS NULL THEN CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) ELSE CONCAT( cs1.class_date_, ' ', cs1.start_class_time_ ) END course_start_time_,
- CASE WHEN cs.new_course_id_ IS NULL THEN cs.status_ ELSE cs1.status_ END course_status_
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
- LEFT JOIN course_schedule cs1 ON cs.new_course_id_=cs1.id_
- WHERE
- cssp.batch_no_ IS NOT NULL
- AND cs.id_ IS NOT NULL AND cs.pre_course_flag_ = 0
- AND (((cs.status_ IN ('OVER', 'UNDERWAY') OR cs1.status_ IN ( 'OVER', 'UNDERWAY' ))
- AND (cssp.actual_price_ IS NULL OR cssp.actual_price_ < cssp.expect_price_))
- OR ( cs.status_ = 'NOT_START' AND cssp.actual_price_ IS NOT NULL AND cssp.actual_price_ > 0))
- <if test="groupIds!=null and groupIds.size()>0">
- AND cs.group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- AND cs.music_group_id_ IN
- <foreach collection="groupIds" item="groupId" open="(" close=")" separator=",">
- #{groupId}
- </foreach>
- </if>
- <if test="userIds!=null and userIds.size()>0">
- AND cssp.user_id_ IN
- <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- </if>
- </select>
- <select id="queryCourseByIdsAndStudentId" resultMap="CourseScheduleStudentPayment">
- SELECT cssp.* FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- WHERE cssp.course_schedule_id_ IN
- <foreach collection="courseIds" open="(" item="item" close=")" separator=",">
- #{item}
- </foreach>
- AND cssp.user_id_ = #{studentId} AND cs.type_ = #{courseType}
- </select>
- <select id="queryStudentNotStartByClassIdsAndStudentIds" resultType="java.lang.Long">
- SELECT cssp.id_ FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
- WHERE cssp.class_group_id_ IN
- <foreach collection="classGroupIds" open="(" close=")" separator="," item="item">
- #{item}
- </foreach>
- <if test="studentIds != null">
- AND cssp.user_id_ IN
- <foreach collection="studentIds" open="(" close=")" separator="," item="item">
- #{item}
- </foreach>
- </if>
- AND CONCAT(cs.class_date_," ",cs.start_class_time_) > NOW() AND cs.pre_course_flag_ = 0
- GROUP BY cssp.id_
- </select>
- <select id="queryByIdsAndStudentId" resultMap="CourseScheduleStudentPayment">
- SELECT cssp.* FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
- WHERE cssp.id_ IN
- <foreach collection="studentPaymentIds" open="(" item="item" close=")" separator=",">
- #{item}
- </foreach>
- AND cssp.user_id_ = #{studentId} AND cs.type_ = #{courseType}
- </select>
- <select id="countFinishCoursePriceWithMusicGroup" resultType="java.math.BigDecimal">
- SELECT SUM(expect_price_)-SUM(actual_price_) FROM course_schedule_student_payment
- WHERE music_group_id_=#{groupId} AND user_id_=#{userId} AND group_type_=#{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- </select>
- <select id="getStudentHistoryLastCourse" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule">
- SELECT cs.* FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_
- WHERE cssp.user_id_=#{studentId}
- <if test="groupId!=null">
- AND cs.music_group_id_=#{groupId}
- </if>
- AND cs.class_date_<#{monday}
- AND cs.type_=#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- AND (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL) AND cs.pre_course_flag_ = 0
- ORDER BY CONCAT(cs.class_date_, ' ', cs.start_class_time_) DESC LIMIT 1
- </select>
- <select id="findByMainMergedCourse" resultMap="CourseScheduleStudentPayment">
- SELECT cssp.*
- FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
- WHERE cs.new_course_id_=#{mainMergeCourseId}
- </select>
- <select id="querySubCoursePriceMap" resultType="java.math.BigDecimal">
- SELECT SUM(cssp.expect_price_) FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
- WHERE cssp.class_group_id_ = #{classGroupId} AND cssp.user_id_ = #{studentId} AND CONCAT(cs.class_date_,' ',cs.start_class_time_) > NOW()
- AND cs.pre_course_flag_ = 0
- <if test="courseType != null">
- AND cs.type_ = #{courseType}
- </if>
- </select>
- <select id="getCourseScheduleStudentNum" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule">
- SELECT course_schedule_id_ id_,COUNT(*) student_num_ FROM course_schedule_student_payment WHERE course_schedule_id_ IN
- <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
- #{courseId}
- </foreach>
- GROUP BY course_schedule_id_
- </select>
- <select id="getWithClassGroupIds" resultMap="CourseScheduleStudentPayment">
- SELECT * FROM course_schedule_student_payment WHERE class_group_id_ IN
- <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
- #{classGroupId}
- </foreach>
- <if test="studentId!=null">
- AND user_id_ = #{studentId}
- </if>
- </select>
- <select id="getWithGroup" resultMap="CourseScheduleStudentPayment">
- SELECT * FROM course_schedule_student_payment
- WHERE music_group_id_ = #{groupId} AND group_type_ = #{groupType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
- <if test="studentIds!=null and studentIds.size()>0">
- AND user_id_ IN
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
- #{studentId}
- </foreach>
- </if>
- </select>
- <select id="getStudentEduTeacher" resultType="string">
- SELECT edut.real_name_ FROM course_schedule_student_payment cssp
- LEFT JOIN vip_group vg ON vg.id_ = cssp.music_group_id_ AND cssp.group_type_='VIP'
- LEFT JOIN sys_user edut ON edut.id_ = vg.educational_teacher_id_
- WHERE cssp.user_id_ = #{studentId}
- AND vg.group_status_ IN (0,1,2)
- ORDER BY vg.create_time_ DESC LIMIT 1
- </select>
- <select id="getHasVipCourseStudentIds" resultType="int">
- SELECT cssp.user_id_ FROM course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
- WHERE cssp.group_type_='VIP' AND cs.del_flag_=0
- <if test="studentIds!=null and studentIds.size()>0">
- AND cssp.user_id_ IN
- <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
- #{studentId}
- </foreach>
- </if>
- </select>
- <select id="getHasVPCourseStudentNum" resultType="int">
- SELECT
- COUNT( DISTINCT cssp.user_id_ )
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
- LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
- WHERE
- cssp.group_type_ IN ('VIP', 'PRACTICE')
- AND cs.status_='NOT_START'
- AND su.del_flag_ = 0
- AND su.organ_id_ = #{organId}
- </select>
- <select id="getOrganHasVPCourseStudentNum" resultType="map">
- SELECT
- su.organ_id_ 'key',
- COUNT( DISTINCT cssp.user_id_ ) 'value'
- FROM
- course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
- LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
- WHERE
- cssp.group_type_ IN ('VIP', 'PRACTICE')
- AND cs.status_='NOT_START'
- AND su.del_flag_ = 0
- <if test="studentIds!=null and studentIds.size()>0">
- AND su.organ_id_ IN
- <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
- #{organId}
- </foreach>
- </if>
- GROUP BY
- su.organ_id_
- </select>
- <select id="getCourseStudents" resultType="com.ym.mec.biz.dal.dto.BasicUserDto">
- SELECT cssp.user_id_ userId,st.member_rank_setting_id_ memberRankSettingId,s.name_ subjectName,su.avatar_ headUrl,su.username_ name,st.subject_id_list_ subjectIdList
- FROM course_schedule_student_payment cssp
- LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
- LEFT JOIN student st ON st.user_id_ = cssp.user_id_
- LEFT JOIN `subject` s ON s.id_ = st.subject_id_list_
- WHERE cssp.course_schedule_id_ = #{courseScheduleId}
- </select>
- <select id="hasCourse" resultType="java.lang.Boolean">
- SELECT CASE WHEN s.user_id_ = NULL THEN 0 ELSE 1 END hasCourse FROM student s
- LEFT JOIN sys_user su ON s.user_id_ = su.id_
- LEFT JOIN course_schedule_student_payment cssp FORCE INDEX(group_type_) ON cssp.user_id_ = s.user_id_
- WHERE cssp.group_type_ IN ('VIP','PRACTICE')
- <if test="organId != null">
- AND su.organ_id_ = #{organId}
- </if>
- LIMIT 1
- </select>
- <resultMap id="StudentVipPracticeExportDto" type="com.ym.mec.biz.dal.dto.StudentVipPracticeExportDto">
- <result property="userId" column="user_id_"/>
- <result property="username" column="username_"/>
- <result property="vipOverNum" column="vip_over_num_"/>
- <result property="vipNotStartNum" column="vip_not_start_num_"/>
- <result property="vipOverTeacherIds" column="vip_over_teacher_ids_"/>
- <result property="vipOverTeacherNames" column="vip_over_teacher_names_"/>
- <result property="vipNotStartTeacherIds" column="vip_not_start_teacher_ids_"/>
- <result property="vipNotStartTeacherNames" column="vip_not_start_teacher_names_"/>
- <result property="practiceOverNum" column="practice_over_num_"/>
- <result property="practiceNotStartNum" column="practice_not_start_num_"/>
- <result property="practiceOverTeacherIds" column="practice_over_teacher_ids_"/>
- <result property="practiceOverTeacherNames" column="practice_over_teacher_names_"/>
- <result property="practiceNotStartTeacherIds" column="practice_not_start_teacher_ids_"/>
- <result property="practiceNotStartTeacherNames" column="practice_not_start_teacher_names_"/>
- <result property="teacherId" column="teacher_id_"/>
- <result property="teacherName" column="real_name_"/>
- </resultMap>
- <select id="exportStudentVipPractice" resultMap="StudentVipPracticeExportDto">
- SELECT s.user_id_,su.username_,
- COUNT(CASE WHEN cssp.group_type_ = 'VIP' AND cs.status_ != 'NOT_START' THEN 1 ELSE NULL END) vip_over_num_,
- COUNT(CASE WHEN cssp.group_type_ = 'VIP' AND cs.status_ = 'NOT_START' THEN 1 ELSE NULL END) vip_not_start_num_,
- GROUP_CONCAT(DISTINCT (CASE WHEN cssp.group_type_ = 'VIP' AND cs.status_ != 'NOT_START' THEN sut.id_ ELSE NULL END) ORDER BY cs.class_date_ DESC,start_class_time_ DESC) vip_over_teacher_ids_,
- GROUP_CONCAT(DISTINCT (CASE WHEN cssp.group_type_ = 'VIP' AND cs.status_ != 'NOT_START' THEN sut.real_name_ ELSE NULL END) ORDER BY cs.class_date_ DESC,start_class_time_ DESC) vip_over_teacher_names_,
- COUNT(CASE WHEN cssp.group_type_ = 'PRACTICE' AND cs.status_ != 'NOT_START' THEN 1 ELSE NULL END) practice_over_num_,
- COUNT(CASE WHEN cssp.group_type_ = 'PRACTICE' AND cs.status_ = 'NOT_START' THEN 1 ELSE NULL END) practice_not_start_num_,
- GROUP_CONCAT(DISTINCT (CASE WHEN cssp.group_type_ = 'PRACTICE' AND cs.status_ != 'NOT_START' THEN sut.id_ ELSE NULL END) ORDER BY cs.class_date_ DESC,start_class_time_ DESC) practice_over_teacher_ids_,
- GROUP_CONCAT(DISTINCT (CASE WHEN cssp.group_type_ = 'PRACTICE' AND cs.status_ != 'NOT_START' THEN sut.real_name_ ELSE NULL END) ORDER BY cs.class_date_ DESC,start_class_time_ DESC) practice_over_teacher_names_,
- s.teacher_id_,ste.real_name_
- FROM student s
- LEFT JOIN course_schedule_student_payment cssp FORCE INDEX(group_type_) ON cssp.user_id_ = s.user_id_
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
- LEFT JOIN sys_user su ON s.user_id_ = su.id_
- LEFT JOIN sys_user ste ON s.teacher_id_ = ste.id_
- LEFT JOIN sys_user sut ON cs.actual_teacher_id_ = sut.id_
- WHERE cssp.group_type_ IN ('VIP','PRACTICE')
- <if test="organId != null">
- AND su.organ_id_ = #{organId}
- </if>
- GROUP BY s.user_id_
- </select>
- </mapper>
|