12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040 |
- <?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.yonge.cooleshow.biz.dal.dao.CourseScheduleDao">
- <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.CourseSchedule">
- <id column="id_" jdbcType="INTEGER" property="id"/>
- <result column="course_group_id_" jdbcType="INTEGER" property="courseGroupId"/>
- <result column="type_" jdbcType="VARCHAR" property="type"/>
- <result column="status_" jdbcType="VARCHAR" property="status"/>
- <result column="class_num_" jdbcType="INTEGER" property="classNum"/>
- <result column="teacher_id_" jdbcType="INTEGER" property="teacherId"/>
- <result column="class_date_" jdbcType="TIMESTAMP" property="classDate"/>
- <result column="start_time_" jdbcType="TIMESTAMP" property="startTime"/>
- <result column="end_time_" jdbcType="TIMESTAMP" property="endTime"/>
- <result column="free_end_time_" jdbcType="TIMESTAMP" property="freeEndTime"/>
- <result column="lock_" jdbcType="INTEGER" property="lock"/>
- <result column="lock_time_" jdbcType="TIMESTAMP" property="lockTime"/>
- <result column="ex_student_num_" jdbcType="INTEGER" property="exStudentNum"/>
- <result column="created_by_" jdbcType="INTEGER" property="createdBy"/>
- <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>
- <result column="updated_by_" jdbcType="INTEGER" property="updatedBy"/>
- <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>
- <result column="service_provider_" property="serviceProvider"/>
- <result column="room_id_" property="roomId"/>
- <result column="mute_all_" property="muteAll"/>
- <result column="cancel_mute_flag_" property="cancelMuteFlag"/>
- </resultMap>
- <sql id="Base_Column_List">
- id_
- , course_group_id_, type_, status_,class_num_, teacher_id_, class_date_,
- start_time_, end_time_, lock_, lock_time_, ex_student_num_,
- created_by_, created_time_, updated_by_, updated_time_,service_provider_,room_id_,mute_all_,cancel_mute_flag_
- </sql>
- <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
- parameterType="com.yonge.cooleshow.biz.dal.entity.CourseSchedule">
- insert into course_schedule(course_group_id_, type_, status_,class_num_, teacher_id_, class_date_, start_time_,
- end_time_, lock_, lock_time_, ex_student_num_, created_by_, created_time_, updated_by_,
- updated_time_)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.courseGroupId}, #{entity.type}, #{entity.status},#{entity.classNum}, #{entity.teacherId}, #{entity.classDate},
- #{entity.startTime}, #{entity.endTime}, #{entity.lock}, #{entity.lockTime},
- #{entity.exStudentNum}, #{entity.createdBy}, #{entity.createdTime}, #{entity.updatedBy},
- #{entity.updatedTime})
- </foreach>
- </insert>
- <select id="queryTeacherTotal" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo">
- select
- t.user_id_ as userId,
- a.expTime,
- a.unExpTime,
- b.starGrade
- from teacher t
- left join (
- <!-- 统计查询已上课时数,未上课时数 -->
- select
- a.teacher_id_ as userId,
- sum(if(a.end_time_ <= now(),1,0)) as expTime,
- sum(if(a.end_time_ > now(),1,0)) as unExpTime
- from course_schedule a
- where a.lock_ = 0 and a.type_ in ('PRACTICE','PIANO_ROOM_CLASS')
- <if test="userId != null and userId != ''">
- and a.teacher_id_ = #{userId}
- </if>
- group by a.teacher_id_
- ) a on t.user_id_ = a.userId
- left join (
- <!-- 统计老师星级评分 -->
- select
- a.teacher_id_ as userId,
- avg (b.score_) as starGrade
- from course_schedule a
- join course_schedule_replied b on a.id_ = b.course_schedule_id_
- where a.lock_ = 0 and a.type_ in ('PRACTICE','PIANO_ROOM_CLASS') and b.score_ is not null
- <if test="userId != null and userId != ''">
- and a.teacher_id_ = #{userId}
- </if>
- group by a.teacher_id_
- ) b on t.user_id_ = b.userId
- <where>
- <if test="userId != null and userId != ''">
- and t.user_id_ = #{userId}
- </if>
- </where>
- </select>
- <select id="queryStudentTotal" resultType="com.yonge.cooleshow.biz.dal.vo.StudentTotalVo">
- select
- t.user_id_ as userId,
- sum(if(b.end_time_ <= now(),1,0)) as finshHours,
- sum(if(b.end_time_ > now(),1,0)) as unfinshHours
- from student t
- left join course_schedule_student_payment a on t.user_id_ = a.user_id_
- left join course_schedule b on a.course_id_ = b.id_
- where b.lock_ = 0 and b.type_ in ('PRACTICE','PIANO_ROOM_CLASS')
- <if test="userId != null and userId != ''">
- and t.user_id_ = #{userId}
- </if>
- group by t.user_id_
- </select>
- <select id="queryStudentCourse" resultMap="BaseResultMap">
- select b.id_,
- b.course_group_id_,
- b.type_,
- b.class_num_,
- b.teacher_id_,
- b.class_date_,
- b.start_time_,
- b.end_time_,
- b.free_end_time_,
- b.lock_,
- b.lock_time_,
- b.ex_student_num_,
- b.status_,
- b.created_by_,
- b.created_time_,
- b.updated_by_,
- b.updated_time_
- from course_schedule_student_payment as a
- left join course_schedule as b on a.course_id_ = b.id_
- <where>
- a.user_id_ = #{param.studentId}
- <if test="param.greaterDate != null">
- AND <![CDATA[ b.start_time_ > #{param.greaterDate} ]]>
- </if>
- <if test="param.startClassDate != null">
- AND <![CDATA[ b.class_date_ >= #{param.startClassDate} ]]>
- </if>
- <if test="param.endClassDate != null">
- AND <![CDATA[ b.class_date_ <= #{param.endClassDate} ]]>
- </if>
- <if test="param.classDate != null">
- AND b.class_date_ = #{param.classDate}
- </if>
- <if test="param.status != null">
- AND b.status_ = #{param.status}
- </if>
- <if test="param.statusList != null">
- AND b.status_ IN
- <foreach collection="param.statusList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- order by b.start_time_ desc
- </select>
- <select id="queryLiveTeacherCourse" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherLiveCourseInfoVo">
- select
- cs.course_group_id_ as courseGroupId,
- cs.name_ as courseGroupName,
- cs.id_ as courseId,
- cs.class_num_ as classNum,
- s.name_ as subjectName,
- cs.start_time_ as startTime,
- cs.end_time_ as endTime,
- g.status_ as `status`,
- cs.pre_student_num_ as studentCount,
- cs.background_pic_ as backgroundPic,
- cs.im_group_id_ as imGroupId,
- su.username_ as username,
- su.id_ as userId,
- su.avatar_ as avatar,
- cs.course_num_ as courseNum,
- cs.complete_course_num_ as completeCourseNum,
- cs.course_introduce_ as courseIntroduce
- from (select * from (
- select cg.course_num_,cg.complete_course_num_,cg.course_introduce_,cg.pre_student_num_,
- cg.background_pic_,cg.im_group_id_,cg.name_,cg.subject_id_,cg.teacher_id_,cg.status_,
- cs.type_,cs.course_group_id_,cs.class_date_,cs.start_time_,cs.end_time_,cs.id_,cs.class_num_
- from course_schedule cs
- left join course_group cg on cs.course_group_id_ = cg.id_
- where cs.type_ = #{param.type} AND cs.lock_ = 0 AND cg.teacher_id_ = #{param.teacherId}
- <if test="param.groupState !=null and param.groupState !=''">
- AND find_in_set(cg.status_, #{param.groupState})
- </if>
- <if test="param.status !=null and param.status !=''">
- AND cg.status_ = #{param.status}
- </if>
- <if test="param.subjectId != null and param.subjectId !=''">
- AND cg.subject_id_ = #{param.subjectId}
- </if>
- order by cs.start_time_) cs
- group by cs.course_group_id_) cs
- left join subject as s on cs.subject_id_ = s.id_
- left join sys_user su on su.id_ = cs.teacher_id_
- <where>
- <if test="param.search != null and param.search !=''">
- AND (cs.name_ LIKE CONCAT('%', #{param.search}, '%') OR su.username_ LIKE CONCAT('%', #{param.search}, '%'))
- </if>
- </where>
- </select>
- <select id="queryTeacherPracticeCourse" resultType="com.yonge.cooleshow.biz.dal.vo.MyCourseVo">
- SELECT distinct
- u.id_ AS userId,
- u.username_ AS userName,
- u.real_name_ AS realName,
- u.avatar_ AS avatar,
- cs.class_date_ AS classDate,
- cs.start_time_ AS startTime,
- cs.end_time_ AS endTime,
- cs.status_ AS `status`,
- g.subject_id_ AS subjectId,
- sb.name_ AS subjectName,
- g.name_ AS courseGroupName,
- u.del_flag_ as delFlag,
- p.course_id_ AS courseId,
- p.course_group_id_ AS courseGoupId,
- (r.student_replied_ IS NOT NULL) AS studentReplied,
- (r.teacher_replied_ IS NOT NULL) AS teacherReplied,
- CASE WHEN sa.course_schedule_id_ IS NULL THEN 0 ELSE 1 END AS attendanceStatus
- FROM course_schedule_student_payment p
- LEFT JOIN sys_user u ON p.user_id_ =u.id_
- LEFT JOIN course_schedule cs ON p.course_id_=cs.id_
- LEFT JOIN course_group g ON p.course_group_id_ = g.id_
- LEFT JOIN `subject` sb ON g.subject_id_=sb.id_
- LEFT JOIN course_schedule_replied r ON cs.id_=r.course_schedule_id_
- LEFT JOIN student_attendance sa ON cs.id_ = sa.course_schedule_id_
- WHERE p.course_id_ IN
- (SELECT s.id_ FROM course_schedule s WHERE s.type_ = #{param.courseType} AND lock_=0 AND s.teacher_id_=#{param.teacherId})
- <if test="param.status !=null and param.status !=''">
- AND cs.status_ = #{param.status}
- </if>
- <if test="param.subjectId !=null">
- AND g.subject_id_ = #{param.subjectId}
- </if>
- <if test="param.attendanceStatus != null">
- <if test="param.attendanceStatus == true">
- AND sa.course_schedule_id_ IS NOT NULL
- </if>
- <if test="param.attendanceStatus == false">
- AND sa.course_schedule_id_ IS NULL
- </if>
- </if>
- <if test="param.classDate !=null and param.classDate !=''">
- AND cs.class_date_ = #{param.classDate}
- </if>
- <if test="param.startDate !=null and param.startDate !=''">
- <![CDATA[ AND cs.class_date_ >= #{param.startDate} ]]>
- </if>
- <if test="param.endDate !=null and param.endDate !=''">
- <![CDATA[ AND cs.class_date_ <= #{param.endDate} ]]>
- </if>
- <if test="param.repliedIds !=null and param.repliedIds.size > 0">
- AND p.user_id_ IN
- <foreach collection="param.repliedIds" item="repliedIds" open="(" close=")" separator=",">
- #{repliedIds}
- </foreach>
- </if>
- <if test="param.studentName !=null and param.studentName !=''">
- AND u.username_ LIKE CONCAT('%', #{param.studentName}, '%')
- </if>
- ORDER BY cs.start_time_
- </select>
- <select id="countTeacherNoDecorateHomework" resultType="java.lang.Integer">
- select count(1)
- from course_schedule cs
- left join course_homework ch on ch.course_schedule_id_ = cs.id_
- <where>
- <!-- 没有布置作业记录 -->
- <if test="param.decorate != null">
- <if test="param.decorate.code == 0">
- and ch.id_ is null
- </if>
- <if test="param.decorate.code == 1">
- and ch.id_ is not null
- </if>
- </if>
- <if test="param.courseStatus != null">
- and cs.type_ = #{param.courseType}
- </if>
- <if test="param.courseType != null">
- and cs.status_ = #{param.courseStatus}
- </if>
- <if test="param.teacherId != null">
- and cs.teacher_id_ = #{param.teacherId}
- </if>
- <if test="param.courseScheduleId != null ">
- and cs.id_ = #{param.courseScheduleId}
- </if>
- </where>
- </select>
- <select id="queryCourseSchedule" resultType="java.lang.String"
- parameterType="com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch">
- SELECT s.class_date_
- FROM course_schedule_student_payment p
- LEFT JOIN course_schedule s ON p.course_id_ = s.id_
- WHERE s.teacher_id_=#{teacherId}
- AND s.lock_=0
- AND s.status_ IN ('ING','COMPLETE','NOT_START')
- AND p.course_type_ IN ('PIANO_ROOM_CLASS','PRACTICE','VIP')
- <![CDATA[ AND s.class_date_ >= #{startDate} ]]>
- <![CDATA[ AND s.class_date_ <= #{endDate} ]]>
- UNION
- SELECT s.class_date_
- FROM course_group g
- LEFT JOIN course_schedule s ON g.id_=s.course_group_id_
- WHERE g.teacher_id_=#{teacherId}
- AND g.type_='LIVE'
- AND g.status_ IN ('COMPLETE','ING')
- <![CDATA[ AND s.class_date_ >= #{startDate} ]]>
- <![CDATA[ AND s.class_date_ <= #{endDate} ]]>
- </select>
- <select id="queryStudentPracticeCourse" resultType="com.yonge.cooleshow.biz.dal.vo.MyCourseVo">
- SELECT
- s.id_ AS courseId,
- s.course_group_id_ AS courseGoupId,
- s.class_date_ AS classDate,
- s.start_time_ AS startTime,
- s.end_time_ AS endTime,
- s.status_ AS `status`,
- s.teacher_id_ AS teacherId,
- u.id_ AS userId,
- u.username_ AS userName,
- u.real_name_ AS realName,
- u.avatar_ AS avatar,
- g.subject_id_ AS subjectId,
- b.name_ AS subjectName
- FROM course_schedule s
- LEFT JOIN sys_user u ON s.teacher_id_ = u.id_
- LEFT JOIN course_group g ON s.course_group_id_ = g.id_
- LEFT JOIN `subject` b ON g.subject_id_ = b.id_
- WHERE s.lock_=0
- AND s.status_ IN ('ING','NOT_START','COMPLETE')
- AND s.id_ IN
- (SELECT course_id_ FROM course_schedule_student_payment WHERE user_id_ = #{param.studentId} AND course_type_ = 'PRACTICE')
- <if test="param.status !=null and param.status !=''">
- AND s.status_ = #{param.status}
- </if>
- <if test="param.subjectId !=null">
- AND g.subject_id_ = #{param.subjectId}
- </if>
- <if test="param.classDate !=null and param.classDate !=''">
- AND s.class_date_ = #{param.classDate}
- </if>
- <if test="param.startDate !=null and param.startDate !=''">
- <![CDATA[ AND s.class_date_ >= #{param.startDate} ]]>
- </if>
- <if test="param.endDate !=null and param.endDate !=''">
- <![CDATA[ AND s.class_date_ <= #{param.endDate} ]]>
- </if>
- ORDER BY s.start_time_
- </select>
- <select id="queryCourseUser" resultType="com.yonge.cooleshow.biz.dal.vo.CourseStudent">
- SELECT
- cs.id_ AS courseId,
- cs.course_group_id_ AS courseGoupId,
- cs.class_date_ AS classDate,
- cs.start_time_ AS startTime,
- cs.end_time_ AS endTime,
- cs.status_ AS `status`,
- cs.type_ AS courseType,
- CONCAT(g.name_,'-第',cs.class_num_,'课') AS courseName,
- NULL AS userId,
- NULL AS name,
- NULL AS realName,
- p.payCount AS payCount,
- g.background_pic_ AS cover,
- g.subject_id_ AS subjectId,
- sb.name_ AS subjectName,
- (r.student_replied_ IS NOT NULL) AS studentReplied,
- (r.teacher_replied_ IS NOT NULL) AS teacherReplied,
- i.id_ AS imGroupId
- FROM course_schedule cs
- LEFT JOIN course_group g ON cs.course_group_id_ = g.id_
- LEFT JOIN (SELECT course_id_ AS pid,count(*) AS payCount FROM course_schedule_student_payment GROUP BY course_id_ ) p ON cs.id_=p.pid
- LEFT JOIN `subject` sb ON g.subject_id_=sb.id_
- LEFT JOIN course_schedule_replied r ON cs.id_ = r.course_schedule_id_
- LEFT JOIN im_group i ON g.id_ = i.course_group_id_
- WHERE cs.lock_=0
- AND cs.status_ IN ('ING','COMPLETE','NOT_START')
- AND g.status_ IN ('ING', 'COMPLETE')
- AND cs.type_ IN ('LIVE','PIANO_ROOM_CLASS')
- AND cs.teacher_id_=#{param.teacherId}
- AND cs.class_date_=#{param.classDate}
- AND cs.id_ IN(
- SELECT c.id_
- FROM course_schedule_student_payment p,course_schedule c
- WHERE p.course_id_=c.id_
- AND p.course_group_id_ = c.course_group_id_
- AND c.teacher_id_=#{param.teacherId}
- AND c.class_date_=#{param.classDate}
- AND c.type_ IN ('LIVE','PIANO_ROOM_CLASS')
- )
- UNION
- SELECT
- p.course_id_ AS courseId,
- p.course_group_id_ AS courseGoupId,
- cs.class_date_ AS classDate,
- cs.start_time_ AS startTime,
- cs.end_time_ AS endTime,
- cs.status_ AS `status`,
- cs.type_ AS courseType,
- NULL AS courseName,
- u.id_ AS userId,
- u.username_ AS name,
- u.real_name_ AS realName,
- NULL AS payCount,
- u.avatar_ AS cover,
- g.subject_id_ AS subjectId,
- sb.name_ AS subjectName,
- (r.student_replied_ IS NOT NULL) AS studentReplied,
- (r.teacher_replied_ IS NOT NULL) AS teacherReplied,
- NULL AS imGroupId
- FROM course_schedule_student_payment p
- LEFT JOIN sys_user u ON p.user_id_ =u.id_
- LEFT JOIN course_schedule cs ON p.course_id_=cs.id_
- LEFT JOIN course_group g ON p.course_group_id_ = g.id_
- LEFT JOIN `subject` sb ON g.subject_id_=sb.id_
- LEFT JOIN course_schedule_replied r ON cs.id_ = r.course_schedule_id_
- WHERE cs.lock_=0
- AND cs.status_ IN ('ING','COMPLETE','NOT_START')
- AND p.course_id_ IN (SELECT s.id_ FROM course_schedule s WHERE s.type_ IN ('PRACTICE','VIP') AND s.teacher_id_=#{param.teacherId})
- AND cs.class_date_=#{param.classDate}
- ORDER BY startTime
- </select>
- <select id="queryCourseScheduleStudent" resultType="java.lang.String"
- parameterType="com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch">
- SELECT class_date_ FROM course_schedule
- WHERE lock_=0
- AND status_ IN ('ING','NOT_START','COMPLETE')
- AND id_ IN (SELECT course_id_ FROM course_schedule_student_payment WHERE user_id_ = #{studentId})
- <![CDATA[ AND class_date_ >= #{startDate} ]]>
- <![CDATA[ AND class_date_ <= #{endDate} ]]>
- </select>
- <select id="teacherList" resultType="com.yonge.cooleshow.biz.dal.vo.PracticeTeacherVo">
- SELECT
- t.user_id_ AS teacherId,
- u.username_ AS userName,
- u.real_name_ AS realName,
- u.avatar_ AS avatar,
- tt.star_grade_ AS starGrade,
- tt.exp_time_ AS expTime,
- t.graduate_school_ AS school,
- t.subject_ AS schoolSubject,
- (SELECT group_concat(p.subject_name_) FROM teacher_subject_price p WHERE find_in_set(t.user_id_,p.teacher_id_)) AS configSubject,
- sp.subjectId AS subjectId,
- sp.subjectName AS subjectName,
- sp.subjectPrice AS subjectPrice,
- sp.courseMinutes AS courseMinutes
- FROM teacher t
- LEFT JOIN sys_user u ON t.user_id_ = u.id_
- LEFT JOIN teacher_total tt ON t.user_id_=tt.user_id_
- LEFT JOIN (SELECT
- f.teacher_id_ AS teacherId,
- p.subject_id_ AS subjectId,
- p.subject_name_ AS subjectName,
- p.subject_price_ AS subjectPrice,
- p.course_minutes_ AS courseMinutes
- FROM teacher_free_time f
- LEFT JOIN teacher_subject_price p ON f.id_=p.teacher_free_time_id
- WHERE f.default_flag_=1 AND f.enable_flag_=1
- AND p.subject_id_=#{param.subjectId}) sp ON t.user_id_=sp.teacherId
- <where>
- <if test="param.teacherIdList != null and param.teacherIdList.size>0">
- AND t.user_id_ IN
- <foreach collection="param.teacherIdList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="param.subjectId !=null">
- AND sp.subjectId=#{param.subjectId}
- </if>
- <if test="param.search !=null and param.search !=''">
- AND u.username_ LIKE CONCAT('%', #{param.search}, '%')
- </if>
- <choose>
- <when test="param.sort !=null and param.sort !=''">
- ORDER BY ${param.sort}
- </when>
- </choose>
- </where>
- </select>
- <select id="queryCourseTeacher" resultType="com.yonge.cooleshow.biz.dal.vo.CourseStudent"
- parameterType="com.yonge.cooleshow.biz.dal.dto.search.MyCourseSearch">
- SELECT
- s.id_ AS courseId,
- s.course_group_id_ AS courseGoupId,
- s.class_date_ AS classDate,
- s.start_time_ AS startTime,
- s.end_time_ AS endTime,
- s.type_ AS courseType,
- s.status_ AS `status`,
- NULL AS courseName,
- u.id_ AS userId,
- u.username_ AS name,
- u.real_name_ AS realName,
- u.avatar_ AS cover,
- g.subject_id_ AS subjectId,
- b.name_ AS subjectName,
- ig.id_ AS imGroupId,
- (r.student_replied_ IS NOT NULL) AS studentReplied,
- (r.teacher_replied_ IS NOT NULL) AS teacherReplied,
- 1 AS payCount
- FROM course_schedule s
- LEFT JOIN sys_user u ON s.teacher_id_ = u.id_
- LEFT JOIN course_group g ON s.course_group_id_ = g.id_
- LEFT JOIN `subject` b ON g.subject_id_ = b.id_
- LEFT JOIN course_schedule_replied r ON s.id_ = r.course_schedule_id_
- LEFT JOIN im_group ig ON ig.course_group_id_ = g.id_
- WHERE s.lock_=0
- AND s.status_ IN ('ING','NOT_START','COMPLETE')
- AND s.id_ IN
- (SELECT course_id_ FROM course_schedule_student_payment WHERE user_id_ = #{param.studentId} AND course_type_ IN ('VIP','PRACTICE'))
- AND s.class_date_ = #{param.classDate}
- UNION
- SELECT
- s.id_ AS courseId,
- s.course_group_id_ AS courseGoupId,
- s.class_date_ AS classDate,
- s.start_time_ AS startTime,
- s.end_time_ AS endTime,
- s.type_ AS courseType,
- s.status_ AS `status`,
- CONCAT(g.name_,'-第',s.class_num_,'课') AS courseName,
- NULL AS userId,
- NULL AS name,
- NULL AS realName,
- g.background_pic_ AS cover,
- g.subject_id_ AS subjectId,
- sb.name_ AS subjectName,
- ig.id_ AS imGroupId,
- (r.student_replied_ IS NOT NULL) AS studentReplied,
- (r.teacher_replied_ IS NOT NULL) AS teacherReplied,
- IFNULL(a.payCount,0) AS payCount
- FROM course_schedule s
- LEFT JOIN course_group g ON s.course_group_id_ = g.id_
- LEFT JOIN `subject` sb ON g.subject_id_=sb.id_
- LEFT JOIN course_schedule_replied r ON s.id_ = r.course_schedule_id_
- LEFT JOIN im_group ig ON ig.course_group_id_ = g.id_
- LEFT JOIN (SELECT course_id_,COUNT(1) AS payCount FROM course_schedule_student_payment GROUP BY course_id_) a ON s.id_=a.course_id_
- WHERE s.lock_=0
- AND s.status_ IN ('ING','NOT_START','COMPLETE')
- AND g.status_ IN ('ING', 'COMPLETE','APPLY','OUT_SALE')
- AND s.id_ IN
- (SELECT course_id_ FROM course_schedule_student_payment WHERE user_id_ = #{param.studentId} AND course_type_ IN ('LIVE','PIANO_ROOM_CLASS'))
- AND s.class_date_ = #{param.classDate}
- ORDER BY startTime
- </select>
- <select id="queryStudentLiveCourse" parameterType="map" resultType="com.yonge.cooleshow.biz.dal.vo.CourseStudent">
- SELECT distinct
- cs.course_id_ AS courseId,
- cs.course_group_id_ AS courseGoupId,
- cs.class_date_ AS classDate,
- cs.start_time_ AS startTime,
- cs.end_time_ AS endTime,
- g.status_ AS `status`,
- cs.type_ AS courseType,
- su.username_ AS realName,
- su.id_ AS userId,
- CONCAT(g.name_,'-第',cs.class_num_,'课') AS name,
- IFNULL(g.pre_student_num_, 0) AS payCount,
- g.background_pic_ AS cover,
- g.subject_id_ AS subjectId,
- sb.name_ AS subjectName,
- su.avatar_ AS avatar,
- g.im_group_id_ as imGroupId,
- g.course_introduce_ as courseIntroduce,
- g.course_num_ as courseNum,
- g.complete_course_num_ as completeCourseNum
- FROM
- (select * from (
- select cssp.user_id_,cssp.course_id_,cssp.order_no_,cs.type_,
- cs.course_group_id_,cs.class_date_,cs.start_time_,cs.end_time_,cs.class_num_
- from course_schedule_student_payment cssp
- LEFT JOIN course_schedule cs on cssp.course_id_ = cs.id_
- WHERE cs.type_ = #{param.type} AND cssp.user_id_ = #{param.studentId}
- order by cs.start_time_) cs
- group by cs.course_group_id_) cs
- LEFT JOIN course_group g ON cs.course_group_id_ = g.id_
- LEFT JOIN `subject` sb ON g.subject_id_=sb.id_
- LEFT JOIN sys_user su on g.teacher_id_ = su.id_
- LEFT JOIN user_order o on cs.order_no_ = o.order_no_
- <where>
- <if test="param.orderState != null">
- AND o.status_ = #{param.orderState}
- </if>
- <if test="param.subjectId != null">
- AND g.subject_id_ = #{param.subjectId}
- </if>
- <if test="param.courseState != null">
- and g.status_ = #{param.courseState}
- </if>
- <if test="param.search != null and param.search != ''">
- and g.name_ like CONCAT('%',#{param.search},'%')
- </if>
- </where>
- </select>
- <insert id="addCourseGroup" parameterType="com.yonge.cooleshow.biz.dal.dto.PracticeScheduleDto" useGeneratedKeys="true" keyProperty="groupId">
- Insert INTO course_group(teacher_id_,type_,name_,subject_id_,single_course_minutes_,course_num_,course_introduce_,
- course_price_,status_,created_by_,mix_student_num_,course_start_time_,pre_student_num_)
- VALUES (#{teacherId},#{type},#{courseGroupName},#{subjectId},#{singleCourseMinutes},#{courseNum},#{courseIntroduce},
- #{coursePrice},#{status},#{studentId},#{mixStudentNum},#{courseStartTime},1)
- </insert>
- <update id="updateLock" parameterType="java.util.List">
- UPDATE course_schedule SET lock_ = 0 WHERE id_ IN
- <foreach collection="list" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </update>
- <update id="courseAdjust" parameterType="com.yonge.cooleshow.biz.dal.vo.CourseAdjustVo">
- UPDATE course_schedule
- SET class_date_=#{classDate},start_time_=#{startTime},end_time_=#{endTime}
- WHERE id_ = #{courseId}
- </update>
- <select id="selectLive" resultType="com.yonge.cooleshow.biz.dal.vo.StudentHomePage$Live">
- SELECT
- u.id_ AS teacherId,
- u.username_ AS teacherName,
- u.real_name_ AS realName,
- u.avatar_ AS avatar,
- g.id_ AS courseGroupId,
- g.name_ AS courseGroupName,
- g.course_price_ AS courseGroupPrice,
- g.course_start_time_ AS courseStartTime,
- g.background_pic_ AS backgroundPic,
- g.course_num_ AS courseNum,
- g.pre_student_num_ AS buyCount,
- g.subject_id_ AS subjectId,
- s.name_ AS subjectName
- FROM course_group g
- LEFT JOIN sys_user u ON g.teacher_id_=u.id_
- LEFT JOIN subject s ON g.subject_id_=s.id_
- WHERE u.del_flag_ = 0 and type_='LIVE' and g.status_ = 'APPLY' and #{appAuditVersion} = g.audit_version_
- <if test="subjectId != null">
- and g.subject_id_ = #{subjectId}
- </if>
- ORDER BY courseStartTime DESC LIMIT 4
- </select>
- <select id="selectVideo" resultType="com.yonge.cooleshow.biz.dal.vo.StudentHomePage$Video">
- SELECT
- u.id_ AS teacherId,
- u.username_ AS teacherName,
- u.real_name_ AS realName,
- u.avatar_ AS avatar,
- g.id_ AS videoGroupId,
- g.lesson_name_ AS videoGroupName,
- g.lesson_price_ AS lessonPrice,
- g.create_time_ AS createTime,
- g.lesson_cover_url_ AS lessonCoverUrl,
- g.lesson_count_ AS lessonCount,
- g.lesson_subject_ AS subjectId,
- s.name_ AS subjectName,
- IFNULL(r.count_,0) AS buyCount
- FROM video_lesson_group g
- LEFT JOIN sys_user u ON g.teacher_id_=u.id_
- LEFT JOIN `subject` s ON g.lesson_subject_=s.id_
- LEFT JOIN (SELECT video_lesson_group_id_ ,COUNT(1) AS count_ FROM video_lesson_purchase_record WHERE order_status_='PAID' GROUP BY video_lesson_group_id_) r ON g.id_= r.video_lesson_group_id_
- WHERE u.del_flag_ = 0 and g.audit_status_='PASS' and g.shelves_flag_ = 1 and #{appAuditVersion} = g.audit_version_
- <if test="subjectId != null">
- and g.lesson_subject_ = #{subjectId}
- </if>
- ORDER BY g.top_flag_ desc, g.sort_number_ desc, buyCount DESC LIMIT 10
- </select>
- <select id="selectRecentCourses" resultType="com.yonge.cooleshow.biz.dal.vo.StudentHomePage$RecentCourses">
- SELECT
- u.id_ AS teacherId,
- p.user_id_ AS studentId,
- u.username_ AS teacherName,
- u.real_name_ AS realName,
- u.avatar_ AS avatar,
- p.course_group_id_ AS courseGroupId,
- p.course_id_ AS courseId,
- g.name_ AS courseGroupName,
- p.course_type_ AS courseType,
- s.status_ AS `status`,
- s.start_time_ AS courseStartTime,
- s.end_time_ AS courseEndTime
- FROM course_schedule_student_payment p
- LEFT JOIN course_schedule s ON p.course_id_=s.id_
- LEFT JOIN sys_user u ON s.teacher_id_=u.id_
- LEFT JOIN course_group g ON p.course_group_id_=g.id_
- WHERE p.user_id_=#{studentId}
- AND s.status_ IN ('ING','NOT_START') and g.status_='ING'
- and date_format(s.class_date_,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
- ORDER BY ABS(NOW() - s.start_time_) ASC
- limit 1
- </select>
- <select id="selectRecentCoursesPractice" resultType="com.yonge.cooleshow.biz.dal.vo.StudentHomePage$RecentCourses">
- SELECT
- p.user_id_ AS studentId,
- u.id_ AS teacherId,
- u.username_ AS teacherName,
- u.real_name_ AS realName,
- u.avatar_ AS avatar,
- s.course_group_id_ AS courseGroupId,
- s.id_ AS courseId,
- g.name_ AS courseGroupName,
- s.type_ AS courseType,
- s.status_ AS `status`,
- s.start_time_ AS courseStartTime,
- s.end_time_ AS courseEndTime
- FROM course_schedule s
- LEFT JOIN sys_user u ON s.teacher_id_=u.id_
- LEFT JOIN course_group g ON s.course_group_id_=g.id_
- LEFT JOIN course_schedule_student_payment p ON s.id_=p.course_id_
- WHERE s.teacher_id_=#{teacherId}
- AND s.type_ IN ('PRACTICE','VIP')
- AND s.status_ IN ('ING','NOT_START') and g.status_='ING'
- and date_format(s.class_date_,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
- ORDER BY ABS(NOW() - s.start_time_) ASC
- limit 1
- </select>
- <select id="selectRecentCoursesLive" resultType="com.yonge.cooleshow.biz.dal.vo.StudentHomePage$RecentCourses"
- parameterType="java.lang.Long">
- SELECT
- u.id_ AS teacherId,
- u.username_ AS teacherName,
- u.real_name_ AS realName,
- u.avatar_ AS avatar,
- s.course_group_id_ AS courseGroupId,
- s.id_ AS courseId,
- g.name_ AS courseGroupName,
- s.type_ AS courseType,
- s.status_ AS `status`,
- s.start_time_ AS courseStartTime,
- s.end_time_ AS courseEndTime
- FROM course_schedule s
- LEFT JOIN sys_user u ON s.teacher_id_=u.id_
- LEFT JOIN course_group g ON s.course_group_id_=g.id_
- WHERE s.teacher_id_=#{teacherId}
- AND s.type_ IN ('LIVE','PIANO_ROOM_CLASS')
- AND s.status_ IN ('ING','NOT_START') and g.status_='ING'
- and date_format(s.class_date_,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
- ORDER BY ABS(NOW() - s.start_time_) ASC
- limit 1
- </select>
- <select id="selectWeekNotStartCourseSchedule" resultType="java.lang.Integer">
- select count(1)
- from course_schedule cs
- left join course_group cg on cs.course_group_id_ = cg.id_
- where cs.teacher_id_ = #{userId} and cs.status_ in ('NOT_START','ING') and cg.status_ = 'ING'
- and YEARWEEK(date_format(cs.class_date_,'%Y-%m-%d'),7) = YEARWEEK(now(),7)
- </select>
- <select id="selectHomeworkNotDecorate" resultType="java.lang.Integer">
- select count(1)
- from course_schedule cs
- left join course_homework ch on cs.id_ = ch.course_schedule_id_
- where cs.teacher_id_ = #{userId} and cs.status_ = 'COMPLETE' and cs.type_ in( 'PRACTICE','PIANO_ROOM_CLASS')
- and YEARWEEK(date_format(cs.class_date_,'%Y-%m-%d'),7) = YEARWEEK(now(),7)
- and ch.id_ is null
- </select>
- <select id="selectNotRepliedCourseSchedule" resultType="java.lang.Integer">
- select count(1)
- from course_schedule cs
- left join course_schedule_replied csr on cs.id_ = csr.course_schedule_id_
- where cs.teacher_id_ = #{userId} and cs.status_ = 'COMPLETE' and cs.type_ = 'PRACTICE'
- and csr.teacher_replied_ is null
- </select>
- <select id="selectWeekStudentRepliedCourseSchedule" resultType="java.lang.Integer">
- select count(1)
- from course_schedule cs
- left join course_schedule_replied csr on cs.id_ = csr.course_schedule_id_
- where cs.teacher_id_ = #{userId} and cs.status_ = 'COMPLETE' and cs.type_ = 'PRACTICE'
- and csr.student_replied_ is not null
- and YEARWEEK(date_format(csr.student_replied_time_,'%Y-%m-%d'),7) = YEARWEEK(now(),7)
- </select>
- <select id="selectStartTime" resultType="java.lang.String" parameterType="java.lang.String">
- SELECT s.start_time_
- FROM course_schedule_student_payment p
- LEFT JOIN course_schedule s ON p.course_id_=s.id_
- WHERE p.order_no_=#{orderNo}
- </select>
- <select id="selectTeacher" resultType="com.yonge.cooleshow.auth.api.entity.SysUser"
- parameterType="java.lang.String">
- SELECT DISTINCT
- s.teacher_id_ AS id,
- u.phone_ AS phone
- FROM course_schedule s
- LEFT JOIN sys_user u ON s.teacher_id_ = u.id_
- LEFT JOIN course_group g ON s.course_group_id_=g.id_
- WHERE lock_=0
- AND class_date_ = DATE_SUB(curdate(),INTERVAL -1 DAY)
- AND g.status_='ING'
- </select>
- <select id="selectTypeCount" resultType="com.yonge.cooleshow.biz.dal.vo.CountVo">
- SELECT
- s.type_ AS type,
- COUNT(1) AS `count`
- FROM course_schedule s
- LEFT JOIN course_group g ON s.course_group_id_=g.id_
- WHERE s.lock_=0
- AND s.teacher_id_=#{teacherId}
- AND s.class_date_=DATE_SUB(curdate(),INTERVAL -1 DAY)
- AND g.status_='ING'
- GROUP BY s.type_
- </select>
- <select id="selectTodayNotRepliedAndNotDecorateHomework"
- resultType="com.yonge.cooleshow.biz.dal.vo.TodayNotRepliedAndNotDecorateHomeworkVo">
- select sum(if(ch.id_ is null,1,0)) as decorateNum,
- sum(if(csr.teacher_replied_ is null,1,0)) as repliedNum,
- su.id_ as teacherId,
- su.phone_ as phone
- from course_schedule cs
- left join course_schedule_replied csr on cs.id_ = csr.course_schedule_id_
- left join course_homework ch on cs.id_ = ch.course_schedule_id_
- left join sys_user su on cs.teacher_id_ = su.id_
- where cs.status_ = 'COMPLETE' and date_format(cs.class_date_,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
- and cs.type_ = 'PRACTICE'
- group by su.id_,su.phone_
- </select>
- <select id="countAllReplie" resultType="com.yonge.cooleshow.biz.dal.vo.RepliedCountVo"
- parameterType="java.lang.String">
- SELECT
- p.user_id_ AS userId,
- u.phone_ AS phone,
- COUNT(1) AS count
- FROM course_schedule_student_payment p
- LEFT JOIN sys_user u ON p.user_id_=u.id_
- WHERE p.course_id_ IN (SELECT id_ FROM course_schedule WHERE class_date_=#{today} AND lock_=0 AND type_='PRACTICE')
- GROUP BY p.user_id_;
- </select>
- <select id="countReplies" resultType="java.lang.Integer">
- SELECT COUNT(1)
- FROM course_schedule_replied
- WHERE student_id_=#{studentId}
- </select>
- <select id="queryCourseHomeOfYear" parameterType="map"
- resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeVo$CourseHomeInfoVo">
- select `date`,
- sum(a.not_start_count) as undoneCount,
- sum(a.complete_count) as doneCount
- from (select date_format(class_date_, '%Y-%m-01') as `date`,
- ifnull(case when status_ in ('NOT_START', 'ING') then count(1) end, 0) as not_start_count,
- ifnull(case when status_ = 'COMPLETE' then count(1) end, 0) as complete_count
- from course_schedule
- where type_ = #{param.type}
- and status_ in ('NOT_START', 'ING', 'COMPLETE')
- <![CDATA[ AND class_date_ >= #{param.startDate} ]]>
- <![CDATA[ AND class_date_ <= #{param.endDate} ]]>
- group by class_date_) as a
- group by date
- </select>
- <select id="queryCourseHomeOfMonth" parameterType="map"
- resultType="com.yonge.cooleshow.biz.dal.vo.CourseHomeVo$CourseHomeInfoVo">
- select class_date_ as `date`,
- sum( CASE WHEN status_ IN ( 'NOT_START', 'ING' ) THEN 1 else 0 END ) AS undoneCount,
- sum( CASE WHEN status_ = 'COMPLETE' THEN 1 else 0 END ) AS doneCount
- from course_schedule
- where type_ = #{param.type}
- and status_ in ('NOT_START', 'ING', 'COMPLETE')
- <![CDATA[ AND class_date_ >= #{param.startDate} ]]>
- <![CDATA[ AND class_date_ <= #{param.endDate} ]]>
- group by class_date_
- </select>
- <select id="selectPrice" resultType="java.math.BigDecimal">
- SELECT t.subject_price_
- FROM teacher_subject_price t
- WHERE t.teacher_id_=#{teacherId}
- AND t.subject_id_=#{subjectId} and t.course_type_ = #{courseTypeEnum}
- </select>
- <select id="selectSchedule" resultType="com.yonge.cooleshow.biz.dal.entity.CourseSchedule"
- parameterType="java.lang.Integer">
- SELECT * FROM course_schedule
- WHERE id_ IN (
- SELECT course_id_ FROM course_schedule_student_payment
- WHERE user_id_=(SELECT user_id_ FROM course_schedule_student_payment WHERE course_id_=#{courseId} AND course_type_='PRACTICE')
- )
- </select>
- <select id="teacherIdList" resultType="java.lang.Long">
- SELECT teacher_id_ FROM teacher_free_time WHERE enable_flag_=1 GROUP BY teacher_id_
- </select>
- <select id="selectIdList" resultType="java.lang.Long">
- SELECT id_ FROM course_schedule WHERE lock_=0 AND class_date_ <= #{day}
- </select>
- <select id="selectComplete" resultType="com.yonge.cooleshow.biz.dal.vo.CourseCompleteVo">
- SELECT *
- FROM (
- SELECT course_group_id_ AS courseGroupId ,COUNT(1) AS courseCount
- FROM course_schedule
- WHERE lock_=0 AND status_='COMPLETE' GROUP BY course_group_id_) a
- LEFT JOIN course_group g ON g.id_=a.courseGroupId
- </select>
- <update id="updateStartTime">
- UPDATE course_schedule SET status_='ING' WHERE id_ IN(
- <foreach collection="list" item="item" index="index" open="" close="" separator=",">
- #{item.id}
- </foreach>)
- </update>
- <update id="updateEndTime">
- UPDATE course_schedule SET status_='COMPLETE' WHERE id_ IN(
- <foreach collection="list" item="item" index="index" open="" close="" separator=",">
- #{item.courseId}
- </foreach>)
- </update>
- <update id="updateTeacherSalary" parameterType="java.util.List">
- UPDATE course_schedule_teacher_salary
- SET status_='COMPLETE',settlement_time_=NOW()
- WHERE status_='NOT_START'
- AND course_schedule_id_ IN
- <foreach collection="list" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </update>
- <select id="queryPianoClass" resultType="com.yonge.cooleshow.biz.dal.vo.PianoClassVo">
- SELECT DISTINCT
- s.id_ AS courseId,
- g.id_ AS courseGroupId,
- CONCAT(g.name_,'-第',s.class_num_,'课') AS courseGroupName,
- b.id_ AS subjectId,
- b.name_ AS subjectName,
- s.teacher_id_ AS teacherId,
- u.username_ AS teacherName,
- u.real_name_ AS teacherRealName,
- u.avatar_ AS avatar,
- s.status_ AS `status`,
- i.id_ AS imGroupId,
- s.start_time_ AS startTime,
- s.end_time_ AS endTime,
- CASE WHEN a.sign_in_time_ IS NOT NULL THEN 1 ELSE 0 END AS studentSign
- FROM course_schedule s
- LEFT JOIN sys_user u ON s.teacher_id_=u.id_
- LEFT JOIN course_group g ON s.course_group_id_=g.id_
- LEFT JOIN `subject` b ON g.subject_id_=b.id_
- LEFT JOIN course_schedule_student_payment p ON s.id_=p.course_id_
- LEFT JOIN student_attendance a ON s.id_=a.course_group_id_
- LEFT JOIN im_group i ON s.course_group_id_=i.course_group_id_
- WHERE s.type_='PIANO_ROOM_CLASS'
- AND p.user_id_=#{param.studentId}
- <if test="param.status !=null and param.status !=''">
- AND s.status_ = #{param.status}
- </if>
- <if test="param.subjectId !=null">
- AND b.id_ = #{param.subjectId}
- </if>
- <if test="param.classMonth !=null">
- <![CDATA[ AND s.class_date_ >= #{param.startDate} ]]>
- <![CDATA[ AND s.class_date_ <= #{param.endDate} ]]>
- </if>
- ORDER BY s.start_time_
- </select>
- <select id="selectWaitCourse" resultType="com.yonge.cooleshow.biz.dal.dto.UserAccountRecordDto">
- SELECT DISTINCT
- ts.teacher_id_ AS userId,
- ts.actual_salary_ AS transAmount,
- ts.course_group_type_ AS bizType,
- ts.course_schedule_id_ AS bizId,
- lr.room_title_ AS bizName,
- 'IN' AS inOrOut,
- sp.order_no_ AS orderNo,
- ts.update_time_ AS updateTime
- FROM course_schedule_teacher_salary ts
- LEFT JOIN live_room lr ON ts.course_schedule_id_ = lr.course_id_
- LEFT JOIN course_schedule_student_payment sp ON ts.course_schedule_id_ = sp.course_id_
- WHERE ts.course_group_type_ = 'LIVE'
- AND ts.status_ = 'WAIT'
- <![CDATA[ AND DATE_FORMAT(ts.update_time_,'%Y-%m-%d') <= #{day}]]>
- UNION
- SELECT DISTINCT
- ts.teacher_id_ AS userId,
- ts.actual_salary_ AS transAmount,
- ts.course_group_type_ AS bizType,
- ts.course_schedule_id_ AS bizId,
- g.name_ AS bizName,
- 'IN' AS inOrOut,
- sp.order_no_ AS orderNo,
- ts.update_time_ AS updateTime
- FROM course_schedule_teacher_salary ts
- LEFT JOIN course_group g ON ts.course_group_id_ = g.id_
- LEFT JOIN course_schedule_student_payment sp ON ts.course_schedule_id_ = sp.course_id_
- WHERE ts.course_group_type_ in ('PRACTICE','VIP_COURSE')
- AND ts.status_ = 'WAIT'
- <![CDATA[ AND DATE_FORMAT(ts.update_time_,'%Y-%m-%d') <= #{day}]]>
- </select>
- <select id="selectStudentPianoCourse"
- resultType="com.yonge.cooleshow.biz.dal.vo.userBindingTeacher.UserBindingTeacherWrapper$CourseNum">
- select cssp.user_id_ as studentId
- ,cs.status_ as status
- from course_schedule_student_payment cssp
- left join course_group cg on cg.id_ = cssp.course_group_id_
- left join course_schedule cs on cs.id_ = cssp.course_id_
- <where>
- cssp.course_type_ = 'PIANO_ROOM_CLASS'
- and #{teacherId} = cg.teacher_id_
- and cs.status_ in ('NOT_START','ING','COMPLETE')
- and cssp.user_id_ in
- <foreach collection="studentIdList" close=")" open="(" item="item" separator=",">
- #{item}
- </foreach>
- </where>
- </select>
- <select id="selectBindingUserCoursePage"
- resultType="com.yonge.cooleshow.biz.dal.vo.userBindingTeacher.UserBindingCourseWrapper">
- select cssp.user_id_ as studentId
- ,cs.status_ as courseStatus
- ,cs.id_ as courseId
- ,cg.subject_id_ as subjectId
- ,cs.class_date_ as classDate
- ,cs.start_time_ as startTime
- ,cs.end_time_ as endTime
- ,cg.subject_id_ as subjectId
- from course_schedule_student_payment cssp
- left join course_group cg on cg.id_ = cssp.course_group_id_
- left join course_schedule cs on cs.id_ = cssp.course_id_
- <where>
- cssp.course_type_ = 'PIANO_ROOM_CLASS'
- and #{query.teacherId} = cg.teacher_id_
- and cs.status_ in ('NOT_START','ING','COMPLETE')
- and cssp.user_id_ =#{query.studentId}
- </where>
- </select>
- <select id="countStudentOverCourse" resultType="java.lang.Integer">
- select COUNT(DISTINCT cssp.course_id_) from course_schedule_student_payment cssp
- left join course_schedule cs ON cs.id_ = cssp.course_id_
- where cs.start_time_ BETWEEN #{monday} AND #{sunday} AND cssp.user_id_ = #{userId}
- <if test="courseStatus != null and courseStatus != ''">
- AND FIND_IN_SET(cs.status_,#{courseStatus})
- </if>
- </select>
- </mapper>
|