<?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.xhkjedu.slive.mapper.gradeclass.ClassTeacherMapper">
    <!--删除班级下所有教师-->
    <delete id="deleteByClassId">
        delete from t_class_teacher where classid=#{classid}
    </delete>
    <!--获取教师任教行政和提高班id-->
    <select id="getClassIds" resultType="java.lang.String">
        select group_concat(distinct c.classid)
        from t_class_teacher ct left join  t_class c on ct.classid=c.classid
        left join t_school s on ct.schoolid=s.schoolid
        where ct.teacherid=#{teacherid} and c.year=s.year and c.classstate=1
        and c.classtype in(1,2)
    </select>
    <!--获取班级教师-->
    <select id="listTeacherByClassIds" resultType="com.xhkjedu.slive.vo.gradeclass.CTeacherVo">
        select ct.classid,ct.teacherid
        from t_class_teacher ct
        where ct.classid in(${classids})
    </select>
    <!--获取教师科目-->
    <select id="listSubjectByTeacherIds" resultType="com.xhkjedu.slive.vo.gradeclass.CTeacherVo">
        select tp.teacherid,sb.subjectid
        from t_teacher_powersb tp left join t_subject_book sb on tp.lsbid = sb.lsbid
        where tp.teacherid in(${teacherids})
        group by tp.teacherid
    </select>
    <!--获取科目列表-->
    <select id="listSubjectBySubjectIds" resultType="com.xhkjedu.slive.vo.gradeclass.CTeacherVo">
        select subjectid,subjectname from t_subject where subjectid in('${subjectids}')
    </select>
    <!--获取学校所有教师-->
    <select id="listTeacherBySchoolId" resultType="com.xhkjedu.slive.vo.gradeclass.CTeacherVo">
        select userid teacherid,username from t_user where schoolid=#{schoolid} and usertype=1 and userstate=1
    </select>
</mapper>
