| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056 | 
							- <?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.TeacherDao">
 
-     <resultMap type="com.ym.mec.biz.dal.entity.Teacher" id="Teacher">
 
-         <result column="id_" property="id"/>
 
-         <result column="organ_id_" property="organId"/>
 
-         <result column="teacher_organ_id_" property="teacherOrganId"/>
 
-         <result column="organ_name_" property="organName"/>
 
-         <result column="job_type_" property="jobType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="job_nature_" property="jobNature" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="is_probation_period_" property="isProbationPeriod"
 
-                 typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="education_background_" property="educationBackground"/>
 
-         <result column="graduate_school_" property="graduateSchool"/>
 
-         <result column="technical_titles_" property="technicalTitles"/>
 
-         <result column="work_unit_" property="workUnit"/>
 
-         <result column="subject_id_" property="subjectId"/>
 
-         <result column="entry_date_" property="entryDate"/>
 
-         <result column="demission_date_" property="demissionDate"/>
 
-         <result column="certificate_type_" property="certificateType"/>
 
-         <result column="certificate_num_" property="certificateNum"/>
 
-         <result column="flow_organ_range_" property="flowOrganRange"/>
 
-         <result column="introduction_" property="introduction"/>
 
-         <result column="is_support_extra_practice_lesson_" property="isSupportExtraPracticeLesson"/>
 
-         <result column="is_support_course_schedule_rewards_rules_" property="isSupportCourseScheduleRewardsRules"/>
 
-         <result column="idcard_front_img_" property="idcardFrontImg"/>
 
-         <result column="idcard_back_img_" property="idcardBackImg"/>
 
-         <result column="idcard_hand_img_" property="idcardHandImg"/>
 
-         <result column="update_time_" property="updateTime"/>
 
-         <result column="create_time_" property="createTime"/>
 
-         <result column="lecture_num_" property="lectureNum"/>
 
-         <result column="username_" property="username"/>
 
-         <result column="password_" property="password"/>
 
-         <result column="real_name_" property="realName"/>
 
-         <result column="salt_" property="salt"/>
 
-         <result column="phone_" property="phone"/>
 
-         <result column="avatar_" property="avatar"/>
 
-         <result column="lock_flag_" property="lockFlag"/>
 
-         <result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="wx_openid_" property="wxOpenid"/>
 
-         <result column="qq_openid_" property="qqOpenid"/>
 
-         <result column="user_type_" property="userType"/>
 
-         <result column="gender_" property="gender"/>
 
-         <result column="nation_" property="nation"/>
 
-         <result column="birthdate_" property="birthdate"/>
 
-         <result column="email_" property="email"/>
 
-         <result column="im_token_" property="imToken"/>
 
-         <result column="subject_name_" property="splitSubjectName"/>
 
-         <result column="id_card_no_" property="idCardNo"/>
 
-     </resultMap>
 
-     <!-- 根据主键查询一条记录 -->
 
-     <select id="get" resultMap="Teacher">
 
-         SELECT t.id_,t.organ_id_ teacher_organ_id_,t.job_type_,t.job_nature_,t.is_probation_period_,t.education_background_,t.graduate_school_,t.graduate_school_,
 
-         t.technical_titles_,t.work_unit_,t.subject_id_,t.entry_date_,t.certificate_type_,t.certificate_num_,t.flow_organ_range_,t.update_time_,
 
-         t.create_time_,t.introduction_,t.demission_date_,t.is_support_course_schedule_rewards_rules_,t.is_support_extra_practice_lesson_,t.lecture_num_,t.idcard_front_img_,t.idcard_back_img_,t.idcard_hand_img_,
 
-         su.real_name_,su.id_card_no_,su.password_,su.salt_,su.phone_,su.avatar_,
 
-         su.lock_flag_,su.del_flag_,su.wx_openid_,su.qq_openid_,su.user_type_,
 
-         su.gender_,su.nation_,su.birthdate_,su.email_,su.im_token_,su.username_,su.organ_id_
 
-         FROM teacher t
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE t.id_ = #{id} AND su.del_flag_ = 0
 
-     </select>
 
-     <!-- 全查询 -->
 
-     <select id="findAll" resultMap="Teacher">
 
-         SELECT *
 
-         FROM teacher
 
-         ORDER BY id_
 
-     </select>
 
-     <!-- 向数据库增加一条记录 -->
 
-     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Teacher" useGeneratedKeys="true" keyColumn="id"
 
-             keyProperty="id">
 
-         INSERT INTO teacher
 
-         (id_,organ_id_,job_type_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,work_unit_,subject_id_,entry_date_,demission_date_,certificate_type_,certificate_num_,flow_organ_range_,introduction_,update_time_,create_time_,is_support_extra_practice_lesson_,is_support_course_schedule_rewards_rules_,idcard_front_img_,idcard_back_img_,idcard_hand_img_)
 
-         VALUES(#{id},#{organId},#{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{jobNature},#{isProbationPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{educationBackground},#{graduateSchool},#{technicalTitles},#{workUnit},#{subjectId},#{entryDate},#{demissionDate},#{certificateType},#{certificateNum},#{flowOrganRange},#{introduction},now(),now(),#{isSupportExtraPracticeLesson},#{isSupportCourseScheduleRewardsRules},#{idcardFrontImg},#{idcardBackImg},#{idcardHandImg})
 
-     </insert>
 
-     <insert id="addSysUser" parameterType="com.ym.mec.auth.api.entity.SysUser" useGeneratedKeys="true" keyColumn="id"
 
-             keyProperty="id">
 
-         INSERT INTO sys_user
 
-         (im_token_,id_,username_,salt_,phone_,avatar_,organ_id_,create_time_,update_time_,wx_openid_,qq_openid_,user_type_,gender_,nation_,birthdate_,email_,id_card_no_,wechat_id_,real_name_,password_)
 
-         VALUES(#{imToken},#{id},#{username},#{salt},#{phone},#{avatar},#{organId},now(),now(),#{wxOpenid},#{qqOpenid},#{userType},
 
-         #{gender},#{nation},#{birthdate},#{email},#{idCardNo},#{wechatId},#{realName},#{password})
 
-     </insert>
 
-     <!-- 根据主键查询一条记录 -->
 
-     <update id="update" parameterType="com.ym.mec.biz.dal.entity.Teacher">
 
-         UPDATE teacher
 
-         <set>
 
-             <if test="lectureNum != null">
 
-                 lecture_num_ = #{lectureNum},
 
-             </if>
 
-             <if test="graduateSchool != null">
 
-                 graduate_school_ = #{graduateSchool},
 
-             </if>
 
-             <if test="subjectId != null">
 
-                 subject_id_ = #{subjectId},
 
-             </if>
 
-             <if test="organId != null">
 
-                 organ_id_ = #{organId},
 
-             </if>
 
-             <if test="technicalTitles != null">
 
-                 technical_titles_ = #{technicalTitles},
 
-             </if>
 
-             <if test="entryDate != null">
 
-                 entry_date_ = #{entryDate},
 
-             </if>
 
-             <if test="demissionDate != null">
 
-                 demission_date_ = #{demissionDate},
 
-             </if>
 
-             <if test="jobType != null">
 
-                 job_type_ = #{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-             </if>
 
-             <if test="flowOrganRange != null">
 
-                 flow_organ_range_ = #{flowOrganRange},
 
-             </if>
 
-             <if test="certificateType != null">
 
-                 certificate_type_ = #{certificateType},
 
-             </if>
 
-             <if test="jobNature != null">
 
-                 job_nature_ = #{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-             </if>
 
-             <if test="isProbationPeriod != null">
 
-                 is_probation_period_ = #{isProbationPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-             </if>
 
-             <if test="updateTime != null">
 
-                 update_time_ = NOW(),
 
-             </if>
 
-             <if test="educationBackground != null">
 
-                 education_background_ = #{educationBackground},
 
-             </if>
 
-             <if test="certificateNum != null">
 
-                 certificate_num_ = #{certificateNum},
 
-             </if>
 
-             <if test="workUnit != null">
 
-                 work_unit_ = #{workUnit},
 
-             </if>
 
-             <if test="introduction != null">
 
-                 introduction_ = #{introduction},
 
-             </if>
 
-             <if test="isSupportCourseScheduleRewardsRules != null">
 
-                 is_support_course_schedule_rewards_rules_ = #{isSupportCourseScheduleRewardsRules},
 
-             </if>
 
-             <if test="isSupportExtraPracticeLesson != null">
 
-                 is_support_extra_practice_lesson_ = #{isSupportExtraPracticeLesson},
 
-             </if>
 
-             <if test="idcardFrontImg != null">
 
-                 idcard_front_img_ = #{idcardFrontImg},
 
-             </if>
 
-             <if test="idcardBackImg != null">
 
-                 idcard_back_img_ = #{idcardBackImg},
 
-             </if>
 
-             <if test="idcardHandImg != null">
 
-                 idcard_hand_img_ = #{idcardHandImg},
 
-             </if>
 
-         </set>
 
-         WHERE id_ = #{id}
 
-     </update>
 
-     <!-- 根据主键删除一条记录 -->
 
-     <update id="delete">
 
-         DELETE FROM teacher WHERE id_ = #{id}
 
-     </update>
 
-     <update id="updateUser" parameterType="com.ym.mec.auth.api.entity.SysUser">
 
-         UPDATE sys_user
 
-         <set>
 
-             <if test="delFlag != null">
 
-                 del_flag_ = #{delFlag, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
 
-             </if>
 
-             <if test="wxOpenid != null">
 
-                 wx_openid_ = #{wxOpenid},
 
-             </if>
 
-             <if test="password != null">
 
-                 password_ = #{password},
 
-             </if>
 
-             <if test="avatar != null">
 
-                 avatar_ = #{avatar},
 
-             </if>
 
-             <if test="email != null">
 
-                 email_ = #{email},
 
-             </if>
 
-             <if test="gender != null">
 
-                 gender_ = #{gender},
 
-             </if>
 
-             <if test="salt != null">
 
-                 salt_ = #{salt},
 
-             </if>
 
-             <if test="username != null">
 
-                 username_ = #{username},
 
-             </if>
 
-             <if test="realName != null">
 
-                 real_name_ = #{realName},
 
-             </if>
 
-             <if test="userType != null">
 
-                 user_type_ = #{userType},
 
-             </if>
 
-             <if test="updateTime != null">
 
-                 update_time_ = NOW(),
 
-             </if>
 
-             <if test="lockFlag != null">
 
-                 lock_flag_ = #{lockFlag},
 
-             </if>
 
-             <if test="birthdate != null">
 
-                 birthdate_ = #{birthdate},
 
-             </if>
 
-             <if test="phone != null">
 
-                 phone_ = #{phone},
 
-             </if>
 
-             <if test="qqOpenid != null">
 
-                 qq_openid_ = #{qqOpenid},
 
-             </if>
 
-             <if test="nation != null">
 
-                 nation_ = #{nation},
 
-             </if>
 
-             <if test="organId != null">
 
-                 organ_id_ = #{organId},
 
-             </if>
 
-             <if test="imToken != null">
 
-                 im_token_ = #{imToken},
 
-             </if>
 
-         </set>
 
-         WHERE id_ = #{id}
 
-     </update>
 
-     <!-- 分页查询 -->
 
-     <select id="queryPage" resultMap="Teacher" parameterType="map">
 
-         SELECT t.id_,su.real_name_,su.lock_flag_,t.subject_id_,su.phone_,t.organ_id_ teacher_organ_id_,t.organ_id_,t.is_support_extra_practice_lesson_,
 
-         t.job_nature_,t.is_probation_period_,GROUP_CONCAT(s.name_) subject_name_,su.del_flag_
 
-         FROM teacher t LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
 
-         WHERE su.del_flag_ = 0
 
-         <include refid="queryPageMap"/>
 
-         GROUP BY t.id_
 
-         ORDER BY t.update_time_ DESC
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <!-- 查询当前表的总记录数 -->
 
-     <select id="queryCount" resultType="int">
 
-         SELECT COUNT(DISTINCT t.id_)
 
-         FROM teacher t LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE su.del_flag_ = 0
 
-         <include refid="queryPageMap"/>
 
-     </select>
 
-     <sql id="queryPageMap">
 
-         <if test="lockFlag != null">
 
-             AND su.lock_flag_ = #{lockFlag}
 
-         </if>
 
-         <if test="teacherId != null">
 
-             AND t.id_ IN
 
-             <foreach collection="teacherId" separator="," open="(" close=")" item="item">
 
-                 #{item}
 
-             </foreach>
 
-         </if>
 
-         <if test="search != null">
 
-             AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%') OR t.id_ = #{search})
 
-         </if>
 
-         <if test="isSupportExtraPracticeLesson != null">
 
-             AND is_support_extra_practice_lesson_ = #{isSupportExtraPracticeLesson}
 
-         </if>
 
-     </sql>
 
-     <!-- 根据证件号查询老师 -->
 
-     <select id="findByCertificateNum" resultMap="Teacher">
 
-         SELECT * FROM teacher WHERE certificate_num_ = #{certificateNum} LIMIT 1
 
-     </select>
 
-     <select id="queryGroupStudents" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT su.username_,su.id_ user_id_,su.avatar_ head_url_,su.gender_,s.name_ subject_name_,sr.music_group_id_,su.user_type_
 
-         FROM class_group_teacher_mapper cgtm
 
-         LEFT JOIN class_group_student_mapper cgsm ON cgtm.class_group_id_ = cgsm.class_group_id_
 
-         LEFT JOIN sys_user su ON cgsm.user_id_ = su.id_
 
-         LEFT JOIN student_registration sr ON sr.user_id_ = cgsm.user_id_ AND cgsm.music_group_id_ = sr.music_group_id_
 
-         LEFT JOIN `subject` s ON s.id_ = sr.actual_subject_id_
 
-         LEFT JOIN music_group mg ON mg.id_ = cgsm.music_group_id_ AND cgsm.group_type_ = 'MUSIC'
 
-         LEFT JOIN vip_group vg ON vg.id_ = cgsm.music_group_id_ AND cgsm.group_type_ = 'VIP'
 
-         WHERE (cgtm.user_id_ = #{teacherId} OR mg.team_teacher_id_ = #{teacherId} OR mg.educational_teacher_id_ = #{teacherId}
 
-         OR director_user_id_ = #{teacherId}) AND su.id_ IS NOT NULL AND (sr.music_group_status_ != 'QUIT' OR sr.id_ IS NULL)
 
-         AND (mg.status_ = 'PROGRESS' OR vg.group_status_ IN (2,4) OR cgsm.group_type_ = 'PRACTICE')
 
-         <if test="search != null">
 
-             AND su.username_ LIKE CONCAT('%',#{search},'%')
 
-         </if>
 
-         GROUP BY su.id_,s.id_,sr.id_
 
-     </select>
 
-     <select id="queryNameByIds" resultType="java.util.Map" parameterType="list">
 
-         select id_ `key`,IF(real_name_ IS NUll,'',real_name_) `value` FROM sys_user s WHERE FIND_IN_SET(id_,#{userIds})
 
-     </select>
 
-     <select id="queryPhoneByIds" resultType="java.util.Map" parameterType="list">
 
-         select id_ `key`,phone_ `value` FROM sys_user s WHERE FIND_IN_SET(id_,#{userIds}) AND s.phone_ IS NOT NULL
 
-     </select>
 
-     <resultMap id="TeacherBasicDto" type="com.ym.mec.biz.dal.dto.TeacherBasicDto">
 
-         <result property="id" column="id_"/>
 
-         <result property="username" column="username_"/>
 
-         <result property="realName" column="real_name_"/>
 
-         <result property="organId" column="organ_id_"/>
 
-     </resultMap>
 
-     <resultMap id="ExtendTeacherBasicDto" type="com.ym.mec.biz.dal.dto.ExtendTeacherBasicDto" extends="TeacherBasicDto">
 
-         <result property="isSupportExtraPracticeLesson" column="is_support_extra_practice_lesson_"/>
 
-         <result property="avatar" column="avatar_"/>
 
-         <result property="subjectNames" column="subject_names_"/>
 
-         <result property="introduction" column="introduction_"/>
 
-     </resultMap>
 
-     <select id="findTeachers" resultMap="TeacherBasicDto">
 
-         SELECT su.id_,su.username_,su.real_name_,t.organ_id_ FROM sys_user su
 
-         LEFT JOIN teacher t ON su.id_=t.id_
 
-         <where>
 
-             <if test="userIds != null">
 
-                 su.id_ IN
 
-                 <foreach collection="userIds" separator="," open="(" close=")" item="item">
 
-                     #{item}
 
-                 </foreach>
 
-             </if>
 
-         </where>
 
-     </select>
 
-     <select id="findSimpleTeachers" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
 
-         SELECT su.id_ userId,su.real_name_ userName FROM sys_user su
 
-         LEFT JOIN teacher t ON su.id_=t.id_
 
-         <where>
 
-             <if test="userIds != null">
 
-                 su.id_ IN
 
-                 <foreach collection="userIds" separator="," open="(" close=")" item="item">
 
-                     #{item}
 
-                 </foreach>
 
-             </if>
 
-         </where>
 
-     </select>
 
-     <select id="findTeaTeachersByOrganAndSubject" resultMap="TeacherBasicDto">
 
-         SELECT
 
-             su.id_,
 
-             su.username_,
 
-             su.real_name_,
 
-             t.organ_id_
 
-         FROM
 
-             teacher t
 
-             LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE
 
-             FIND_IN_SET(#{subjectId},t.subject_id_)
 
-             AND (t.organ_id_=#{organId} OR FIND_IN_SET(#{organId},t.flow_organ_range_))
 
-             AND t.job_nature_='FULL_TIME'
 
-             AND su.del_flag_=0 AND su.lock_flag_=0
 
-             AND t.organ_id_!=36
 
-     </select>
 
-     <select id="findTeaTeachersByOrganAndSubject1" resultMap="ExtendTeacherBasicDto">
 
-         SELECT
 
-             su.id_,
 
-             su.username_,
 
-             su.real_name_,
 
-             t.organ_id_,
 
-             t.is_support_extra_practice_lesson_
 
-         FROM
 
-             teacher t
 
-             LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE
 
-             FIND_IN_SET(#{subjectId},t.subject_id_)
 
-             AND (t.organ_id_=#{organId} OR FIND_IN_SET(#{organId},t.flow_organ_range_))
 
-             AND t.job_nature_='FULL_TIME'
 
-             AND su.del_flag_=0 AND su.lock_flag_=0
 
-             AND t.organ_id_!=36
 
-     </select>
 
-     <select id="findTeaTeachersByOrganAndSubject2" resultMap="ExtendTeacherBasicDto">
 
-         SELECT
 
-             su.id_,
 
-             su.username_,
 
-             su.real_name_,
 
-             su.avatar_,
 
-             t.introduction_,
 
-             t.organ_id_,
 
-             t.is_support_extra_practice_lesson_,
 
-             GROUP_CONCAT(s.name_) subject_names_
 
-         FROM
 
-             teacher t
 
-             LEFT JOIN sys_user su ON t.id_ = su.id_
 
-             LEFT JOIN subject s ON FIND_IN_SET(s.id_,t.subject_id_)
 
-         WHERE
 
-             FIND_IN_SET(#{subjectId},t.subject_id_)
 
-             AND (t.organ_id_=#{organId} OR FIND_IN_SET(#{organId},t.flow_organ_range_))
 
-             AND t.job_nature_='FULL_TIME'
 
-             AND su.del_flag_=0 AND su.lock_flag_=0
 
-             AND t.organ_id_!=36
 
-         GROUP BY su.id_
 
-     </select>
 
-     <select id="findTeacherByOrganAndSubject" resultMap="TeacherBasicDto">
 
-         SELECT
 
-             su.id_,
 
-             su.username_,
 
-             su.real_name_,
 
-             t.organ_id_
 
-         FROM
 
-             teacher t
 
-             LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE
 
-             FIND_IN_SET(#{subjectIds},t.subject_id_)
 
-             AND INTE_ARRAY ( CONCAT( t.organ_id_, IF(t.flow_organ_range_ IS NULL,'',CONCAT(',', t.flow_organ_range_)) ), #{organIds} )
 
-     </select>
 
-     <select id="findByTeacherId" resultMap="TeacherBasicDto">
 
-         SELECT
 
-             su.id_,
 
-             su.username_,
 
-             su.real_name_,
 
-             t.organ_id_
 
-         FROM
 
-             teacher t
 
-             LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE
 
-             t.id_=#{teacherId}
 
-     </select>
 
-     <select id="countCloses" resultType="java.lang.Integer">
 
-         SELECT COUNT(cs.id_)
 
-         FROM course_schedule cs
 
-         LEFT JOIN course_schedule_teacher_salary csts ON cs.id_ = csts.course_schedule_id_
 
-         LEFT JOIN teacher_attendance ta ON cs.id_ = ta.course_schedule_id_ AND ta.teacher_id_ = csts.user_id_
 
-         LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
 
-         <include refid="queryCloses"/>
 
-     </select>
 
-     <resultMap id="TeacherCloseDto" type="com.ym.mec.biz.dal.dto.TeacherCloseDto">
 
-         <result property="classDate" column="class_date_"/>
 
-         <result property="classTime" column="start_class_time_"/>
 
-         <result property="className" column="class_name_"/>
 
-         <result property="courseScheduleType" column="class_type_"/>
 
-         <result property="teacherRole" column="teacher_role_"/>
 
-         <result property="currentClassTimes" column="current_class_times_"/>
 
-         <result property="totalClassTimes" column="total_class_times_"/>
 
-         <result property="signInStatus" column="sign_in_status_"/>
 
-         <result property="signOutStatus" column="sign_out_status_"/>
 
-         <result property="actualSalary" column="actual_salary_"/>
 
-         <result property="expectSalary" column="expect_salary_"/>
 
-         <result property="subsidy" column="subsidy_"/>
 
-         <result property="settlementTime" column="settlement_time_"/>
 
-         <result property="courseScheduleId" column="course_schedule_id_"/>
 
-     </resultMap>
 
-     <select id="queryCloses" resultMap="TeacherCloseDto">
 
-         SELECT cs.id_ course_schedule_id_,cs.class_date_,cs.start_class_time_,cg.name_ class_name_,cs.type_ class_type_,
 
-         csts.teacher_role_,ta.current_class_times_,cg.total_class_times_,
 
-         IF(ta.sign_in_status_ IS NULL,3,ta.sign_in_status_) sign_in_status_,
 
-         IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_,
 
-         csts.actual_salary_,csts.settlement_time_,csts.subsidy_,csts.expect_salary_
 
-         FROM course_schedule cs
 
-         LEFT JOIN course_schedule_teacher_salary csts ON cs.id_ = csts.course_schedule_id_
 
-         LEFT JOIN teacher_attendance ta ON cs.id_ = ta.course_schedule_id_ AND ta.teacher_id_ = csts.user_id_
 
-         LEFT JOIN class_group cg ON cs.class_group_id_ = cg.id_
 
-         <include refid="queryCloses"/>
 
-         ORDER BY cs.class_date_,cs.start_class_time_ DESC
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <select id="findTeacherNoPay" resultType="decimal">
 
-         SELECT SUM(expect_salary_) FROM course_schedule_teacher_salary csts WHERE settlement_time_ IS NULL AND user_id_
 
-         = #{teacherId}
 
-     </select>
 
-     <select id="findTeacherByMusicGroup" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT
 
-             su.id_ user_id_,
 
-             su.real_name_ username_
 
-         FROM
 
-           class_group_teacher_mapper cgtm
 
-             LEFT JOIN class_group cg ON cg.id_=cgtm.class_group_id_
 
-             LEFT JOIN sys_user su ON cgtm.user_id_=su.id_
 
-         WHERE cg.music_group_id_=#{musicGroupId} AND cg.group_type_='MUSIC'
 
-         GROUP BY su.id_
 
-     </select>
 
-     <resultMap id="MusicGroupTeachersDto" type="com.ym.mec.biz.dal.dto.MusicGroupTeachersDto">
 
-         <result property="teacherName" column="real_name_"/>
 
-         <result property="teacherPhone" column="phone_"/>
 
-         <result property="jobNature" column="job_nature_"/>
 
-         <result property="classGroupName" column="class_group_name_"/>
 
-         <result property="classGroupId" column="class_group_id_"/>
 
-         <result property="teacherId" column="teacher_id_"/>
 
-     </resultMap>
 
-     <select id="queryMusicGroupTeachers" resultMap="MusicGroupTeachersDto">
 
-         SELECT su.real_name_,su.phone_,t.job_nature_,GROUP_CONCAT(cg.name_) class_group_name_,t.id_ teacher_id_
 
-         FROM teacher t
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON t.id_ = cgtm.user_id_
 
-         LEFT JOIN class_group cg ON cg.id_ = cgtm.class_group_id_
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE cg.del_flag_ != '1' AND cgtm.group_type_ = 'MUSIC'
 
-         <include refid="queryMusicGroupTeachersSql"/>
 
-         GROUP BY t.id_
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <select id="countMusicGroupTeachers" resultType="java.lang.Integer">
 
-         SELECT COUNT(DISTINCT t.id_)
 
-         FROM teacher t
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON t.id_ = cgtm.user_id_
 
-         LEFT JOIN class_group cg ON cg.id_ = cgtm.class_group_id_
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE cg.del_flag_ != '1' AND cgtm.group_type_ = 'MUSIC'
 
-         <include refid="queryMusicGroupTeachersSql"/>
 
-     </select>
 
-     <sql id="queryMusicGroupTeachersSql">
 
-         <if test="search != null and search != ''">
 
-             AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%') OR
 
-             su.id_=#{search})
 
-         </if>
 
-         <if test="musicGroupId != null and musicGroupId != ''">
 
-             AND cgtm.music_group_id_ = #{musicGroupId}
 
-         </if>
 
-         <if test="classGroupId != null">
 
-             AND cg.id_ = #{classGroupId}
 
-         </if>
 
-     </sql>
 
-     <select id="findSignNum" resultType="java.util.Map">
 
-         SELECT ta.teacher_id_ 'key',COUNT(ta.id_) 'value' FROM teacher_attendance ta
 
-         WHERE FIND_IN_SET(ta.teacher_id_,#{teacherIdStr}) AND ta.music_group_id_ = #{musicGroupId}
 
-         GROUP BY ta.teacher_id_
 
-     </select>
 
-     <sql id="queryTeacherAttendanceSql">
 
-         <where>
 
-             CONCAT(cs.class_date_,' ',cs.start_class_time_) < NOW() AND cgtm.teacher_role_ = 'BISHOP'
 
-             <if test="startTime != null and startTime != ''">
 
-                 AND cs.class_date_ >= #{startTime}
 
-             </if>
 
-             <if test="endTime != null and endTime != ''">
 
-                 AND cs.class_date_ <= #{endTime}
 
-             </if>
 
-             <if test="musicGroupId != null and musicGroupId != ''">
 
-                 AND ta.music_group_id_ = #{musicGroupId}
 
-             </if>
 
-             <if test="teacherName != null and teacherName != ''">
 
-                 AND su.real_name_ LIKE CONCAT('%',#{teacherName},'%')
 
-             </if>
 
-         </where>
 
-     </sql>
 
-     <resultMap id="MusicGroupTeacherAttendanceDto" type="com.ym.mec.biz.dal.dto.MusicGroupTeacherAttendanceDto">
 
-         <result property="classDate" column="class_date_"/>
 
-         <result property="startClassTime" column="start_class_time_"/>
 
-         <result property="courseScheduleName" column="name_"/>
 
-         <result property="realName" column="real_name_"/>
 
-         <result property="signInStatus" column="sign_in_status_"/>
 
-         <result property="signOutStatus" column="sign_out_status_"/>
 
-     </resultMap>
 
-     <select id="queryTeacherAttendance" resultMap="MusicGroupTeacherAttendanceDto">
 
-         SELECT cs.class_date_,cs.start_class_time_,cs.name_,su.real_name_,
 
-         IF(ta.sign_in_status_ IS NULL,3,ta.sign_in_status_) sign_in_status_,
 
-         IF(ta.sign_out_status_ IS NULL,3,ta.sign_out_status_) sign_out_status_
 
-         FROM course_schedule cs
 
-         LEFT JOIN teacher_attendance ta ON cs.id_ = ta.course_schedule_id_
 
-         LEFT JOIN sys_user su ON su.id_ = ta.teacher_id_
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cgtm.class_group_id_ = cs.class_group_id_ AND ta.teacher_id_ = cgtm.user_id_
 
-         <include refid="queryTeacherAttendanceSql"/>
 
-         ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <select id="countTeacherAttendance" resultType="java.lang.Integer">
 
-         SELECT COUNT(cs.id_)
 
-         FROM course_schedule cs
 
-         LEFT JOIN teacher_attendance ta ON cs.id_ = ta.course_schedule_id_
 
-         LEFT JOIN sys_user su ON su.id_ = ta.teacher_id_
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cgtm.class_group_id_ = cs.class_group_id_ AND ta.teacher_id_ = cgtm.user_id_
 
-         <include refid="queryTeacherAttendanceSql"/>
 
-     </select>
 
-     <select id="queryNameById" resultType="java.lang.String">
 
-         select real_name_ FROM sys_user s WHERE id_ = #{userId} LIMIT 1
 
-     </select>
 
-     <resultMap id="musicGroupStudentApplyDto" type="com.ym.mec.biz.dal.dto.musicGroupStudentApplyDto">
 
-         <result property="userId" column="user_id_"/>
 
-         <result property="userName" column="username_"/>
 
-         <result property="currentClass" column="current_class_"/>
 
-         <result property="currentGrade" column="current_grade_"/>
 
-         <result property="subjectName" column="subject_name_"/>
 
-         <result property="subjectId" column="actual_subject_id_"/>
 
-         <result property="paymentAmount" column="actual_amount_"/>
 
-         <result property="payTime" column="pay_time_"/>
 
-         <result property="paymentStatus" column="payment_status_"/>
 
-         <result property="remark" column="remark_"/>
 
-     </resultMap>
 
-     <select id="queryMusicGroupStudentApply" resultMap="musicGroupStudentApplyDto">
 
-         SELECT sr.user_id_,su.username_,sr.current_class_,sr.current_grade_,s.name_ subject_name_,sr.remark_,
 
-         sr.payment_status_,sr.actual_subject_id_
 
-         FROM student_registration sr
 
-         LEFT JOIN sys_user su ON sr.user_id_ = su.id_
 
-         LEFT JOIN `subject` s ON sr.actual_subject_id_ = s.id_
 
-         <include refid="queryMusicGroupStudentApplySql"/>
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <sql id="queryMusicGroupStudentApplySql">
 
-         <where>
 
-             sr.music_group_id_ = #{musicGroupId} AND sr.music_group_status_ != 'QUIT'
 
-             <if test="subjectId != null">
 
-                 AND sr.actual_subject_id_ = #{subjectId}
 
-             </if>
 
-             <if test="paymentStatus != null">
 
-                 AND sr.payment_status_ = #{paymentStatus}
 
-             </if>
 
-         </where>
 
-     </sql>
 
-     <select id="countMusicGroupStudentApply" resultType="java.lang.Integer">
 
-         SELECT COUNT(sr.user_id_)
 
-         FROM student_registration sr
 
-         LEFT JOIN sys_user su ON sr.user_id_ = su.id_
 
-         LEFT JOIN `subject` s ON sr.actual_subject_id_ = s.id_
 
-         <include refid="queryMusicGroupStudentApplySql"/>
 
-     </select>
 
-     <select id="queryMusicGroupStudents" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT su.real_name_ username_,su.id_ user_id_,su.avatar_ head_url_,
 
-         su.gender_,GROUP_CONCAT(s.name_) subject_name_,su.user_type_
 
-         FROM teacher t
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
 
-         WHERE FIND_IN_SET(t.id_,#{teacherIds})
 
-         <if test="search != null">
 
-             AND su.real_name_ LIKE CONCAT('%',#{search},'%')
 
-         </if>
 
-         GROUP BY t.id_
 
-     </select>
 
-     <select id="findOrganTeacherBySubject" resultMap="Teacher">
 
-         SELECT su.* FROM teacher t
 
-         LEFT JOIN sys_user su on t.id_ = su.id_ WHERE 1=1
 
-         <if test="subjectId != null">
 
-             AND FIND_IN_SET(#{subjectId},t.subject_id_)
 
-         </if>
 
-     </select>
 
-     <sql id="queryCloses">
 
-         <where>
 
-             CONCAT(cs.class_date_,' ',cs.start_class_time_) < NOW()
 
-             <if test="teacherId != null">
 
-                 AND csts.user_id_ = #{teacherId}
 
-             </if>
 
-             <if test="courseStartDate != null and courseStartDate != ''">
 
-                 AND cs.class_date_ >= #{courseStartDate}
 
-             </if>
 
-             <if test="courseEndDate != null and courseEndDate != ''">
 
-                 AND cs.class_date_ <= #{courseEndDate}
 
-             </if>
 
-             <if test="courseScheduleType != null and courseScheduleType != ''">
 
-                 AND cs.type_ = #{courseScheduleType}
 
-             </if>
 
-             <if test="teacherRole != null and teacherRole != ''">
 
-                 AND csts.teacher_role_ = #{teacherRole}
 
-             </if>
 
-             <if test="signInStatus != null and signInStatus != 3">
 
-                 AND ta.sign_in_status_ = #{signInStatus}
 
-             </if>
 
-             <if test="signOutStatus != null and signOutStatus != 3">
 
-                 AND ta.sign_out_status_ = #{signOutStatus}
 
-             </if>
 
-             <if test="signOutStatus != null and signOutStatus == 3">
 
-                 AND ta.sign_out_status_ IS NULL
 
-             </if>
 
-             <if test="signInStatus != null and signInStatus == 3">
 
-                 AND ta.sign_in_status_ IS NULL
 
-             </if>
 
-         </where>
 
-     </sql>
 
-     <select id="queryOrganTeacherNum" resultType="map">
 
-         select count(*) total,sum(case when job_nature_ = 'PART_TIME' then 1 else 0 end) part_time_num_,sum(case when
 
-         job_nature_ = 'FULL_TIME' then 1 else 0 end) full_time_num_ from teacher
 
-         where demission_date_ is null and organ_id_ not in (36,38)
 
-             <if test="organId != null">
 
-                 and FIND_IN_SET(organ_id_,#{organId})
 
-             </if>
 
-     </select>
 
-     <select id="findByFlowOrganRange" resultMap="Teacher">
 
-         SELECT id_,CONCAT(IF(flow_organ_range_ IS NULL OR flow_organ_range_ = '',0,flow_organ_range_),",",
 
-         IF(organ_id_ IS NULL OR organ_id_ = '',0,organ_id_)) flow_organ_range_ FROM teacher t
 
-         <where>
 
-             <if test="subjectId != null">
 
-                 AND FIND_IN_SET(#{subjectId},t.subject_id_)
 
-             </if>
 
-             <if test="jobNature != null">
 
-                 AND t.job_nature_ = #{jobNature}
 
-             </if>
 
-             <if test="isProbationPeriod != null">
 
-                 AND t.is_probation_period_ = #{isProbationPeriod}
 
-             </if>
 
-             <if test="isSupportExtraPracticeLesson != null">
 
-                 AND t.is_support_extra_practice_lesson_ = #{isSupportExtraPracticeLesson}
 
-             </if>
 
-         </where>
 
-     </select>
 
-     <select id="findByTeacherIds" resultMap="Teacher">
 
-         SELECT * FROM teacher WHERE id_ IN
 
-         <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
 
-             #{teacherId}
 
-         </foreach>
 
-     </select>
 
-     <select id="findTeacherByOrganId" resultMap="TeacherBasicDto">
 
-         SELECT su.id_,su.username_,su.real_name_ FROM teacher t
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE su.del_flag_ != 1
 
-         <if test="organId != null">
 
-             AND FIND_IN_SET(t.organ_id_,#{organId})
 
-         </if>
 
-         <if test="subjectIds != null">
 
-             AND INTE_ARRAY(t.subject_id_,#{subjectIds})
 
-         </if>
 
-         <if test="jobNature != null">
 
-             AND t.job_nature_ = #{jobNature}
 
-         </if>
 
-     </select>
 
-     <select id="queryUsernameByIds" resultType="java.util.Map" parameterType="list">
 
-         select id_ `key`,username_ `value` FROM sys_user s
 
-         WHERE s.id_ IN
 
-         <foreach collection="userIds" item="item" open="(" close=")" separator=",">
 
-             #{item}
 
-         </foreach>
 
-     </select>
 
-     <select id="searchTeachers" resultMap="TeacherBasicDto">
 
-         SELECT su.id_,su.username_,su.real_name_ FROM teacher t
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE su.del_flag_ != 1
 
-         <if test="organId != null">
 
-             AND FIND_IN_SET(t.organ_id_,#{organId})
 
-         </if>
 
-         <if test="teacherName != null">
 
-             AND su.real_name_ LIKE CONCAT('%',#{teacherName},'%')
 
-         </if>
 
-     </select>
 
-     <select id="countTeacherName" resultType="java.lang.Integer">
 
-         SELECT COUNT(su.id_) FROM teacher t
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         WHERE su.del_flag_ != 1
 
-         <include refid="queryPageNameSql"/>
 
-     </select>
 
-     <sql id="queryPageNameSql">
 
-         <if test="organId != null">
 
-             AND FIND_IN_SET(t.organ_id_,#{organId})
 
-         </if>
 
-         <if test="subjectIds != null">
 
-             AND INTE_ARRAY(t.subject_id_,#{subjectIds})
 
-         </if>
 
-         <if test="jobNature != null">
 
-             AND t.job_nature_ = #{jobNature}
 
-         </if>
 
-         <if test="teacherId != null">
 
-             AND t.id_ = #{teacherId}
 
-         </if>
 
-         <if test="search != null">
 
-             AND (su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 
-         </if>
 
-     </sql>
 
-     <select id="queryPageName" resultMap="Teacher">
 
-         SELECT su.id_,su.real_name_,su.avatar_,GROUP_CONCAT(s.name_) subject_name_ FROM teacher t
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         LEFT JOIN subject s ON FIND_IN_SET(s.id_, t.subject_id_)
 
-         WHERE su.del_flag_ != 1
 
-         <include refid="queryPageNameSql"/>
 
-         GROUP BY su.id_
 
-         <include refid="global.limit"/>
 
-     </select>
 
-     <select id="getCourseScheduleHomework" resultMap="com.ym.mec.biz.dal.dao.CourseHomeworkDao.CourseHomework">
 
-         SELECT * FROM course_homework WHERE course_schedule_id_ = #{courseScheduleId} LIMIT 1
 
-     </select>
 
-     <select id="lockTeachers" resultType="int">
 
-         SELECT id_ FROM teacher WHERE id_ IN
 
-         <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
 
-             #{userId}
 
-         </foreach>
 
-         FOR UPDATE
 
-     </select>
 
-     <resultMap type="com.ym.mec.auth.api.entity.SysUser" id="SysUser">
 
-         <result column="id_" property="id"/>
 
-         <result column="username_" property="username"/>
 
-         <result column="real_name_" property="realName"/>
 
-         <result column="password_" property="password"/>
 
-         <result column="salt_" property="salt"/>
 
-         <result column="phone_" property="phone"/>
 
-         <result column="avatar_" property="avatar"/>
 
-         <result column="organ_id_" property="organId"/>
 
-         <result column="create_time_" property="createTime"/>
 
-         <result column="update_time_" property="updateTime"/>
 
-         <result column="lock_flag_" property="lockFlag"/>
 
-         <result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 
-         <result column="wx_openid_" property="wxOpenid"/>
 
-         <result column="qq_openid_" property="qqOpenid"/>
 
-         <result column="user_type_" property="userType"/>
 
-         <result column="gender_" property="gender"/>
 
-         <result column="nation_" property="nation"/>
 
-         <result column="birthdate_" property="birthdate"/>
 
-         <result column="email_" property="email"/>
 
-         <result column="im_token_" property="imToken"/>
 
-         <result column="id_card_no_" property="idCardNo"/>
 
-         <result column="wechat_id_" property="wechatId"/>
 
-         <result column="is_super_admin_" property="isSuperAdmin"/>
 
-         <result column="current_grade_" property="currentGrade"/>
 
-         <result column="current_class_" property="currentClass"/>
 
-     </resultMap>
 
-     <select id="getUser" resultMap="SysUser">
 
-         SELECT su.*
 
-         FROM sys_user su
 
-         WHERE su.id_ = #{id} LIMIT 1
 
-     </select>
 
-     <select id="queryTeacherBaseInfo"  resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT
 
-         CASE WHEN su.user_type_ LIKE '%TEACHER%' OR su.user_type_ LIKE '%SYSTEM%' THEN su.real_name_ ELSE su.username_ END username_,
 
-         su.id_ user_id_,
 
-         su.avatar_ head_url_,
 
-         gender_,
 
-         GROUP_CONCAT(s.name_) subject_name_
 
-         FROM sys_user su
 
-         LEFT JOIN teacher t ON su.id_ = t.id_
 
-         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
 
-         WHERE su.id_ IN
 
-         <foreach collection="teacherId" item="userId" open="(" close=")" separator=",">
 
-             #{userId}
 
-         </foreach>
 
-         <if test="search != null and search != ''">
 
-             AND su.real_name_ LIKE CONCAT('%',#{search},'%')
 
-         </if>
 
-         GROUP BY su.id_
 
-     </select>
 
-     <select id="queryTeacherImModel" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.ImUserModel">
 
-         SELECT su.id_,su.avatar_,su.real_name_ username_
 
-         FROM sys_user su
 
-         WHERE su.id_ IN
 
-         <foreach collection="teacherIds" item="userId" open="(" close=")" separator=",">
 
-             #{userId}
 
-         </foreach>
 
-     </select>
 
-     <select id="findMusicTeacherIds" resultType="java.lang.Integer">
 
-         SELECT DISTINCT cgtm.user_id_ FROM class_group_student_mapper cgsm
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cgsm.class_group_id_ = cgtm.class_group_id_
 
-         LEFT JOIN music_group mg ON cgsm.music_group_id_ = mg.id_
 
-         WHERE mg.status_ = 'PROGRESS' AND cgsm.user_id_ = #{studentId}
 
-     </select>
 
-     <select id="findVipTeacherIds" resultType="java.lang.Integer">
 
-         SELECT DISTINCT cgtm.user_id_ FROM class_group_student_mapper cgsm
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cgsm.class_group_id_ = cgtm.class_group_id_
 
-         LEFT JOIN vip_group vg ON vg.id_ = cgsm.music_group_id_
 
-         WHERE vg.group_status_ IN (2,3,4) AND cgsm.user_id_ = #{studentId}
 
-     </select>
 
-     <select id="findPracticeTeacherIds" resultType="java.lang.Integer">
 
-         SELECT DISTINCT cgtm.user_id_ FROM class_group_student_mapper cgsm
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cgsm.class_group_id_ = cgtm.class_group_id_
 
-         LEFT JOIN practice_group pg ON pg.id_ = cgsm.music_group_id_
 
-         WHERE cgsm.group_type_ = 'PRACTICE' AND cgsm.user_id_ = #{studentId}
 
-     </select>
 
-     <select id="findTeacherInfo"  resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT
 
-         su.real_name_ username_,
 
-         su.id_ user_id_,
 
-         su.avatar_ head_url_,
 
-         gender_,
 
-         GROUP_CONCAT(s.name_) subject_name_
 
-         FROM sys_user su
 
-         LEFT JOIN teacher t ON su.id_ = t.id_
 
-         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
 
-         WHERE su.id_ = #{id}
 
-     </select>
 
-     <select id="queryEducationIpa" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT su.real_name_ username_,su.id_ user_id_,su.avatar_ head_url_,su.gender_,GROUP_CONCAT(s.name_) subject_name_,su.user_type_
 
-         FROM employee e
 
-         LEFT JOIN teacher t ON INTE_ARRAY(e.organ_id_list_,t.flow_organ_range_) OR FIND_IN_SET(t.organ_id_,e.organ_id_list_)
 
-         LEFT JOIN sys_user su ON t.id_ = su.id_
 
-         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)
 
-         WHERE e.user_id_ = #{userId}
 
-         <if test="search != null and search != ''">
 
-             AND su.real_name_ LIKE CONCAT('%',#{search},'%')
 
-         </if>
 
-         GROUP BY t.id_
 
-         UNION ALL
 
-         SELECT su.username_,su.id_ user_id_,su.avatar_ head_url_,su.gender_,NULL subject_name_,su.user_type_
 
-         FROM employee e
 
-         LEFT JOIN sys_user su ON FIND_IN_SET(su.organ_id_,e.organ_id_list_)
 
-         LEFT JOIN student_registration sr ON su.id_ = sr.user_id_
 
-         LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_
 
-         WHERE e.user_id_ = #{userId} AND (sr.id_ IS NULL OR sr.music_group_status_ = 'QUIT' OR mg.status_ != 'PROGRESS')
 
-         <if test="search != null and search != ''">
 
-             AND su.username_ LIKE CONCAT('%',#{search},'%')
 
-         </if>
 
-         GROUP BY su.id_
 
-     </select>
 
-     <select id="findCloseCourseTeacherIds" resultType="java.lang.Integer">
 
-         SELECT DISTINCT csts.user_id_ FROM course_schedule_student_payment cssp
 
-         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
 
-         LEFT JOIN course_schedule_teacher_salary csts ON csts.course_schedule_id_ = cs.id_
 
-         WHERE cssp.group_type_ IN ('VIP','PRACTICE') AND cs.status_ = 'OVER' AND cssp.user_id_ = #{studentId}
 
-     </select>
 
-     <select id="findCloseCourseStudentIds" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT su.username_,su.id_ user_id_,su.avatar_ head_url_,su.gender_,NULL subject_name_,su.user_type_
 
-         FROM course_schedule_teacher_salary csts
 
-         LEFT JOIN course_schedule cs ON csts.course_schedule_id_ = cs.id_
 
-         LEFT JOIN course_schedule_student_payment cssp ON cs.id_ = cssp.course_schedule_id_
 
-         LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
 
-         WHERE csts.group_type_ IN ('VIP','PRACTICE') AND cs.status_ = 'OVER' AND csts.user_id_ = #{teacherId} AND su.id_ IS NOT NULL
 
-         <if test="search != null and search != ''">
 
-             AND su.username_ LIKE CONCAT('%',#{search},'%')
 
-         </if>
 
-         GROUP BY su.id_
 
-     </select>
 
-     <select id="findVipEducationalStudentId" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT su.username_,su.id_ user_id_,su.avatar_ head_url_,su.gender_,NULL subject_name_,su.user_type_
 
-         FROM vip_group vg
 
-         LEFT JOIN course_schedule_student_payment cssp ON cssp.music_group_id_ = vg.id_
 
-         LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
 
-         WHERE cssp.group_type_ = 'VIP' AND vg.educational_teacher_id_ = #{teacherId}
 
-         GROUP BY su.id_
 
-     </select>
 
-     <select id="findCommEducationalStudentId" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT su.username_,su.id_ user_id_,su.avatar_ head_url_,su.gender_,NULL subject_name_,su.user_type_
 
-         FROM courses_group vg
 
-         LEFT JOIN course_schedule_student_payment cssp ON cssp.music_group_id_ = vg.id_
 
-         LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
 
-         WHERE cssp.group_type_ = 'COMM' AND vg.educational_teacher_id_ = #{teacherId}
 
-         GROUP BY su.id_
 
-     </select>
 
-     <select id="findPracticeEducationalStudentId" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
 
-         SELECT su.username_,su.id_ user_id_,su.avatar_ head_url_,su.gender_,NULL subject_name_,su.user_type_
 
-         FROM practice_group pg
 
-         LEFT JOIN course_schedule_student_payment cssp ON cssp.music_group_id_ = pg.id_
 
-         LEFT JOIN sys_user su ON su.id_ = cssp.user_id_
 
-         WHERE cssp.group_type_ = 'PRACTICE' AND pg.educational_teacher_id_ = #{teacherId}
 
-         GROUP BY su.id_
 
-     </select>
 
-     <select id="findPracticeEducationalTeacherId" resultType="java.lang.Integer">
 
-         SELECT DISTINCT pg.educational_teacher_id_ FROM class_group_student_mapper cgsm
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cgsm.class_group_id_ = cgtm.class_group_id_
 
-         LEFT JOIN practice_group pg ON pg.id_ = cgsm.music_group_id_
 
-         WHERE cgsm.group_type_ = 'PRACTICE' AND cgsm.user_id_ = #{userId}
 
-     </select>
 
-     <select id="findVipEducationalTeacherId" resultType="java.lang.Integer">
 
-         SELECT DISTINCT vg.educational_teacher_id_ FROM class_group_student_mapper cgsm
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cgsm.class_group_id_ = cgtm.class_group_id_
 
-         LEFT JOIN vip_group vg ON vg.id_ = cgsm.music_group_id_
 
-         WHERE cgsm.group_type_ = 'VIP' AND cgsm.user_id_ = #{userId}
 
-     </select>
 
-     <select id="findCommEducationalTeacherId" resultType="java.lang.Integer">
 
-         SELECT DISTINCT vg.educational_teacher_id_ FROM class_group_student_mapper cgsm
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cgsm.class_group_id_ = cgtm.class_group_id_
 
-         LEFT JOIN courses_group vg ON vg.id_ = cgsm.music_group_id_
 
-         WHERE cgsm.group_type_ = 'COMM' AND cgsm.user_id_ = #{userId}
 
-     </select>
 
-     <select id="queryCourseClassStudentIds" resultType="java.lang.Integer">
 
-         SELECT cgsm.user_id_ FROM course_schedule_teacher_salary csts
 
-         LEFT JOIN class_group_student_mapper cgsm ON csts.class_group_id_ = cgsm.class_group_id_
 
-         WHERE csts.user_id_ = #{teacherId}
 
-         GROUP BY cgsm.user_id_
 
-         UNION ALL
 
-         SELECT cgsm.user_id_ FROM class_group_teacher_mapper cgtm
 
-         LEFT JOIN class_group_student_mapper cgsm ON cgtm.class_group_id_ = cgsm.class_group_id_
 
-         WHERE cgtm.user_id_ = #{teacherId}
 
-         GROUP BY cgsm.user_id_
 
-         UNION ALL
 
-         SELECT cssp.user_id_ FROM music_group mg
 
-         LEFT JOIN course_schedule_student_payment cssp ON mg.id_ = cssp.music_group_id_
 
-         WHERE (mg.educational_teacher_id_ = #{teacherId} OR mg.director_user_id_ = #{teacherId} OR mg.team_teacher_id_ = #{teacherId})
 
-         AND cssp.group_type_ = 'MUSIC' AND mg.status_ = 'PROGRESS'
 
-         UNION ALL
 
-         SELECT cgsm.user_id_ FROM vip_group vg
 
-         LEFT JOIN class_group_student_mapper cgsm ON vg.id_ = cgsm.music_group_id_
 
-         WHERE vg.educational_teacher_id_ = #{teacherId} AND cgsm.group_type_ = 'VIP' AND vg.group_status_ IN (2,3,4)
 
-         UNION ALL
 
-         SELECT cssp.user_id_ FROM courses_group cg
 
-         LEFT JOIN course_schedule_student_payment cssp ON cg.id_ = cssp.music_group_id_
 
-         WHERE cg.educational_teacher_id_ = #{teacherId} AND cssp.group_type_ = 'COMM'
 
-         UNION ALL
 
-         SELECT cssp.user_id_ FROM practice_group pg
 
-         LEFT JOIN course_schedule_student_payment cssp ON pg.id_ = cssp.music_group_id_
 
-         WHERE pg.educational_teacher_id_ = #{teacherId} AND cssp.group_type_ = 'PRACTICE'
 
-     </select>
 
-     <select id="queryCourseClassTeacherIds" resultType="java.lang.Integer">
 
-         SELECT csts.user_id_ FROM music_group mg
 
-         LEFT JOIN course_schedule_teacher_salary csts ON mg.id_ = csts.music_group_id_
 
-         WHERE csts.group_type_ = 'MUSIC' AND (mg.educational_teacher_id_ = #{teacherId} OR mg.director_user_id_ = #{teacherId} OR mg.team_teacher_id_ = #{teacherId})
 
-         GROUP BY csts.user_id_
 
-         UNION ALL
 
-         SELECT csts.user_id_ FROM vip_group vg 
 
-         LEFT JOIN course_schedule_teacher_salary csts ON vg.id_ = csts.music_group_id_
 
-         WHERE vg.educational_teacher_id_ = #{teacherId} AND csts.group_type_ = 'VIP' AND vg.group_status_ IN (2,3,4)
 
-         GROUP BY csts.user_id_
 
-         UNION ALL
 
-         SELECT csts.user_id_ FROM courses_group cg 
 
-         LEFT JOIN course_schedule_teacher_salary csts ON cg.id_ = csts.music_group_id_
 
-         WHERE cg.educational_teacher_id_ = #{teacherId} AND csts.group_type_ = 'COMM'
 
-         GROUP BY csts.user_id_
 
-         UNION ALL
 
-         SELECT csts.user_id_ FROM practice_group pg 
 
-         LEFT JOIN course_schedule_teacher_salary csts ON pg.id_ = csts.music_group_id_
 
-         WHERE pg.educational_teacher_id_ = #{teacherId} AND csts.group_type_ = 'PRACTICE'
 
-         GROUP BY csts.user_id_
 
-         UNION ALL
 
-         SELECT cgtm.user_id_ FROM music_group mg
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON mg.id_ = cgtm.music_group_id_
 
-         WHERE cgtm.group_type_ = 'MUSIC' AND mg.status_ = 'PROGRESS'
 
-         AND (mg.educational_teacher_id_ = #{teacherId} OR mg.director_user_id_ = #{teacherId} OR mg.team_teacher_id_ = #{teacherId})
 
-         GROUP BY cgtm.user_id_
 
-         UNION ALL
 
-         SELECT cgtm.user_id_ FROM vip_group vg 
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON vg.id_ = cgtm.music_group_id_
 
-         WHERE vg.educational_teacher_id_ = #{teacherId} AND cgtm.group_type_ = 'VIP' AND vg.group_status_ IN (2,3,4)
 
-         GROUP BY cgtm.user_id_
 
-         UNION ALL
 
-         SELECT cgtm.user_id_ FROM courses_group cg 
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON cg.id_ = cgtm.music_group_id_
 
-         WHERE cg.educational_teacher_id_ = #{teacherId} AND cgtm.group_type_ = 'COMM'
 
-         GROUP BY cgtm.user_id_
 
-         UNION ALL
 
-         SELECT cgtm.user_id_ FROM practice_group pg 
 
-         LEFT JOIN class_group_teacher_mapper cgtm ON pg.id_ = cgtm.music_group_id_
 
-         WHERE pg.educational_teacher_id_ = #{teacherId} AND cgtm.group_type_ = 'PRACTICE'
 
-         GROUP BY cgtm.user_id_
 
-         UNION ALL
 
-         SELECT vg.educational_teacher_id_ FROM class_group_teacher_mapper cgtm
 
-         LEFT JOIN vip_group vg ON vg.id_ = cgtm.music_group_id_
 
-         WHERE cgtm.user_id_ = #{teacherId} AND cgtm.group_type_ = 'VIP' AND vg.group_status_ IN (2,3,4)
 
-         GROUP BY vg.educational_teacher_id_
 
-         UNION ALL
 
-         SELECT cg.educational_teacher_id_ FROM class_group_teacher_mapper cgtm
 
-         LEFT JOIN courses_group cg ON cg.id_ = cgtm.music_group_id_
 
-         WHERE cgtm.user_id_ = #{teacherId} AND cgtm.group_type_ = 'COMM'
 
-         GROUP BY cg.educational_teacher_id_
 
-         UNION ALL
 
-         SELECT pg.educational_teacher_id_ FROM class_group_teacher_mapper cgtm
 
-         LEFT JOIN practice_group pg ON pg.id_ = cgtm.music_group_id_
 
-         WHERE cgtm.user_id_ = #{teacherId} AND cgtm.group_type_ = 'PRACTICE'
 
-         GROUP BY pg.educational_teacher_id_
 
-         UNION ALL
 
-         SELECT vg.educational_teacher_id_ FROM course_schedule_teacher_salary csts
 
-         LEFT JOIN vip_group vg ON vg.id_ = csts.music_group_id_
 
-         WHERE csts.user_id_ = #{teacherId} AND csts.group_type_ = 'VIP' AND vg.group_status_ IN (2,3,4)
 
-         GROUP BY vg.educational_teacher_id_
 
-         UNION ALL
 
-         SELECT cg.educational_teacher_id_ FROM course_schedule_teacher_salary csts
 
-         LEFT JOIN courses_group cg ON cg.id_ = csts.music_group_id_
 
-         WHERE csts.user_id_ = #{teacherId} AND csts.group_type_ = 'COMM'
 
-         GROUP BY cg.educational_teacher_id_
 
-         UNION ALL
 
-         SELECT pg.educational_teacher_id_ FROM course_schedule_teacher_salary csts
 
-         LEFT JOIN practice_group pg ON pg.id_ = csts.music_group_id_
 
-         WHERE csts.user_id_ = #{teacherId} AND csts.group_type_ = 'PRACTICE'
 
-         GROUP BY pg.educational_teacher_id_
 
-     </select>
 
-     <select id="queryMusicLeaderIds" resultType="java.lang.String">
 
-         SELECT DISTINCT CONCAT(mg.educational_teacher_id_,',',mg.director_user_id_,',',mg.team_teacher_id_) FROM course_schedule_teacher_salary csts
 
-         LEFT JOIN music_group mg ON mg.id_ = csts.music_group_id_
 
-         WHERE csts.user_id_ = #{teacherId} AND csts.group_type_ = 'MUSIC' AND mg.status_ = 'PROGRESS'
 
-         GROUP BY mg.id_
 
-         UNION ALL
 
-         SELECT DISTINCT CONCAT(mg.educational_teacher_id_,',',mg.director_user_id_,',',mg.team_teacher_id_) FROM class_group_teacher_mapper cgtm
 
-         LEFT JOIN music_group mg ON mg.id_ = cgtm.music_group_id_
 
-         WHERE cgtm.user_id_ = #{teacherId} AND cgtm.group_type_ = 'MUSIC' AND mg.status_ = 'PROGRESS'
 
-         GROUP BY mg.id_
 
-     </select>
 
- </mapper>
 
 
  |