123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737 |
- <?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.ssj.mapper.correctsys.CorrectSysMapper">
- <select id="findUncorrectHomeworkListByPage" resultType="java.util.Map" parameterType="java.util.Map">
- </select>
- <sql id="tbLibManager" >
- t.id,
- t.name,
- t.course_name courseName,
- t.user_id userId,
- t.t_photo tPhoto,
- t.is_online isOnline,
- t.is_banned isBanned,
- t.banned_time bannedTime,
- t.type,
- t.login_time loginTime,
- t.is_cancelled isCancelled,
- t.cancelled_time cancelledTime,
- t.telephone,
- t.create_time createTime,
- t.state
- </sql>
- <select id="findManagerListByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
- select <include refid="tbLibManager" />
- ,case when t.type = 12 then (select count(1) from tb_lib_manager where state = 1 and type in(8,13) and parent_id = t.user_id)
- else (select count(1)+1 from tb_lib_manager where state = 1 and type in(8,11,13) and parent_id = t.user_id ) end groupCount
- from tb_lib_manager t
- where t.type in (11,12)
- and t.state = 1
- <if test="map.subject != null and map.subject != '' ">
- and t.course_name regexp #{map.subject}
- </if>
- order by t.type desc,t.name
- </select>
- <select id="findTeacherListByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="hashMap">
- select t.* from
- (select <include refid="tbLibManager" />
- <!--1重点:本月新上线、无底薪;3一般:上个月上线无底薪;2放⼼:上个⽉有底薪-->
- <if test="map.addTag != null and map.addTag != '' ">
- ,CASE
- WHEN date_format(create_time, '%Y-%m') = date_format(now(), '%Y-%m') THEN 1
- WHEN (SELECT convert(IFNULL(s.basic_salary,0),DECIMAL(9,2)) FROM tb_lib_salary_info s
- WHERE s.user_id = t.user_id AND s.`month` REGEXP date_format(date_sub(now(), INTERVAL 1 MONTH),'%Y-%m') LIMIT 1)>0
- THEN 2
- ELSE 3 END tag
- </if>
- from tb_lib_manager t
- where 1 = 1
- and t.state = 1
- <if test="map.grade != null and map.grade != '' ">
- and t.grade regexp #{map.grade}
- </if>
- <if test="map.subject != null and map.subject != '' ">
- and t.course_name regexp #{map.subject}
- </if>
- <if test="map.teacherName != null and map.teacherName != '' ">
- and t.name regexp #{map.teacherName}
- </if>
- <!--注销老师只显示近七天注销的-->
- <if test="map.GTE_cancelledTime != null and map.GTE_cancelledTime != '' ">
- and (t.cancelled_time >= #{map.GTE_cancelledTime} or cancelled_time is null)
- </if>
- <!--只筛选出该天有作业的老师-->
- <if test="map.selectTime != null and map.selectTime != '' ">
- <if test="map.teacherIds.size() > 0">
- and t.user_id in
- <foreach collection="map.teacherIds" index="i" item="teacherId" open="(" close=")" separator=",">
- #{teacherId}
- </foreach>
- </if>
- </if>
- <!--批改老师-->
- <if test='map.type == "8" '>
- <!--校区管理员-->
- <if test='map.role == "11"'>
- and t.type in (8, 11)
- </if>
- <!--超级管理员-->
- <if test='map.role == "12"'>
- and t.type =8
- </if>
- </if>
- <!--匹配知识点老师-->
- <if test='map.type == "13" '>
- and t.type = 13
- </if>
- <if test="map.parentId != null and map.parentId != '' ">
- and (t.parent_id = #{map.parentId} or t.user_id=#{map.parentId})
- </if>
- ) t
- <if test="map.tag != null and map.tag != '' ">
- where t.tag = #{map.tag}
- </if>
- <!--排序方式:未质检在线(里面按照未质检数量降序);未质检离线(里面按照未质检数量降序);已质检在线;已质检离线-->
- order by
- <if test="map.orderField != null and map.orderField != '' ">
- ${map.orderField},
- </if>
- t.isCancelled, t.isBanned,
- t.isOnline desc,t.name
- </select>
- <select id="countByManagerId" resultType="java.util.Map" parameterType="java.util.Map">
- select sum(t.operate_nums) operate_nums,
- sum(t.is_feedback) feedback_count,
- sum(case when t.check_date is not null then 1 else 0 end) check_count,
- sum(t.is_check_error)+sum(t.correct_nums) wrong_count
- from (
- select t2.*,(case when ((t1.is_mark in (0,2) and t1.is_feedback = 1) or t1.is_mark not in (0,2)) then 1 else 0 end) is_feedback
- from scon_homework_picture t1
- join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id and t2.type=8
- where t1.service_type=1
- and t1.teacher_id in
- (select user_id from tb_lib_manager
- where state = 1
- and type in(8,11,13)
- and parent_id = #{map.managerId}
- union
- select user_id
- from tb_lib_manager
- where state = 1
- and type in (8, 11, 13)
- and user_id = #{map.managerId}
- )
- <!--and ((t1.is_mark in (0,2) and t1.is_feedback = 1) or t1.is_mark not in (0,2))-->
- <if test="map.before_createTime != null and map.before_createTime != '' ">
- and t1.create_time >= #{map.before_createTime}
- </if>
- <if test="map.before_allotTime != null and map.before_allotTime != '' ">
- and t2.allot_time >= #{map.before_allotTime}
- </if>
- union all
- select t2.*,(case when ((t1.is_mark in (0,2) and t1.is_know_feedback = 1) or t1.is_mark not in (0,2)) then 1 else 0 end) is_feedback
- from scon_homework_picture t1
- join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id and t2.type=13
- where t1.service_type=1
- and t1.know_teacher_id in
- (select user_id from tb_lib_manager
- where state = 1
- and type in(8,11,13)
- and parent_id = #{map.managerId}
- union
- select user_id from tb_lib_manager
- where state = 1
- and type in(8,11,13)
- and user_id = #{map.managerId}
- )
- <!--and ((t1.is_mark in (0,2) and t1.is_know_feedback = 1) or t1.is_mark not in (0,2))-->
- <if test="map.before_createTime != null and map.before_createTime != '' ">
- and t1.create_time >= #{map.before_createTime}
- </if>
- <if test="map.before_allotTime != null and map.before_allotTime != '' ">
- and t2.allot_time >= #{map.before_allotTime}
- </if>
- ) t
- </select>
- <select id="countByTeacherId" resultType="com.ssj.bean.mybatis.CountMBDto" parameterType="java.util.Map">
- <if test="map.teacherId != null and map.teacherId != '' ">
- select t1.homework_id homeworkId,
- sum(case when (t1.is_mark in (0,2) and t1.is_feedback = 1) or t1.is_mark not in (0,2) then 1 else 0 end) feedbackCount,
- sum(case when t2.check_date is not null then 1 else 0 end) checkCount,
- case when sum(case when t2.start_time is not null and t2.end_time is null then 1 else 0 end)>0 then '批改中'
- when sum(case when t1.is_mark in (0,2) and t1.is_feedback = 0 then 1 else 0 end)>0 then '未批改'
- else '批改完' end status
- from scon_homework_picture t1
- join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id
- where 1=1
- and t1.service_type=1
- and t2.type = 8
- <!--and ((t1.is_mark in (0,2) and t1.is_feedback = 1) or t1.is_mark not in (0,2))-->
- and t1.teacher_id regexp #{map.teacherId}
- </if>
- <if test="map.knowTeacherId != null and map.knowTeacherId != '' ">
- select t1.homework_id,
- sum(case when (t1.is_mark in (0,2) and t1.is_needing_know =1 and t1.is_know_feedback = 1) then 1 else 0 end) feedback_count,
- sum(case when t2.check_date is not null then 1 else 0 end) check_count,
- case when sum(case when t2.start_time is not null and t2.end_time is null then 1 else 0 end)>0 then '批改中'
- when sum(case when t1.is_mark in (0,2) and t1.is_needing_know = 1 and t1.is_know_feedback = 0 then 1 else 0 end)>0 then '未批改'
- else '批改完' end status
- from scon_homework_picture t1
- join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id
- where 1=1
- and t1.service_type=1
- and t2.type = 13
- <!--and ((t1.is_mark in (0,2) and t1.is_know_feedback = 1) or t1.is_mark not in (0,2))-->
- and t1.know_teacher_id regexp #{map.knowTeacherId}
- </if>
- <if test="map.allotTime != null and map.allotTime != '' ">
- and t1.allot_time >= #{map.allotTime}
- </if>
- <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
- and t1.create_time >= #{map.GTE_createTime}
- </if>
- <if test="map.EQ_createTime != null and map.EQ_createTime != '' ">
- and t1.create_time regexp #{map.EQ_createTime}
- </if>
- group by t1.homework_id
- </select>
- <select id="studentHomeworkNoFeedbackList" resultType="com.ssj.bean.mybatis.StudentHomeworkMBDto" parameterType="hashMap">
- select t.* from
- (select t.id homeworkId,
- <if test='map.type == "8" '>
- t1.teacher_id teacherId,
- (select name
- from tb_lib_manager
- where t1.teacher_id = user_id
- and type in (8, 11, 12, 13, 14)
- limit 1) teacherName,
- case
- <!--1.未分配2.已分配未批改3.批改中4.批改完-->
- when t1.teacher_id is null or t1.teacher_id = '' then 1
- when sum(case when t2.start_time is not null and t2.end_time is not null then 1 else 0 end) = count(t1.id) then 4
- when sum(case when t2.start_time is not null then 1 else 0 end) > 0 then 3
- else 2 end status,
- </if>
- <if test='map.type == "13" '>
- t1.know_teacher_id teacherId,
- (select name
- from tb_lib_manager
- where t1.know_teacher_id = user_id
- and type in (8, 11, 12, 13, 14)
- limit 1) teacherName,
- case
- when t1.know_teacher_id is null or t1.know_teacher_id = '' then 1
- when sum(case when t2.start_time is not null and t2.end_time is null then 1 else 0 end) > 0 then 3
- when sum(case when t2.start_time is not null and t2.end_time is not null then 1 else 0 end) = count(t1.id) then 4
- else 2 end status,
- </if>
- t.vip_id vipId,
- t3.child_name name,
- t.subject,
- count(t1.id) picNums,
- date_format(min(t2.start_time), '%Y-%m-%d %H:%i:%S') correctStartTime,
- date_format(min(t2.allot_time), '%Y-%m-%d %H:%i:%S') allotTime,
- date_format(min(t1.create_time), '%Y-%m-%d %H:%i:%S') uploadTime,
- UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(ifnull(min(t1.create_time), now())) waitLong1,
- UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(ifnull(max(t2.allot_time), now())) waitLong2,
- UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(ifnull((select max(hpc.end_time) from scon_homework_picture_correct hpc where t.id=hpc.homework_id and hpc.type=8), now())) waitLong3
- from scon_homework t
- join scon_homework_picture t1 on t.id = t1.homework_id
- left join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id and t2.type = #{map.type}
- join tb_lib_vip t3 on t.vip_id = t3.id
- where 1 = 1
- and t1.service_type=1
- <if test='map.type == "8" '>
- <!--超级管理员显示未分配的作业、分配老师未批改的作业、批改中的作业-->
- <if test='map.role == "superManager"'>
- and exists(
- select 1
- from scon_homework_picture s
- where s.is_mark in (0, 2)
- and s.service_type=1
- and s.is_feedback = 0
- and s.teacher_id = t1.teacher_id
- and s.homework_id = t.id
- UNION
- select 1
- from scon_homework_picture s
- where s.is_mark in (0, 2)
- and s.service_type=1
- and s.is_feedback = 0
- and s.teacher_id is null
- and s.homework_id = t.id
- )
- </if>
- <!--校区管理员只显示其组下的,包含自己-->
- <if test='map.role == "manager"'>
- and t1.teacher_id in
- (
- select user_id from tb_lib_manager
- where state = 1
- and type in(8,11,13)
- and parent_id = #{map.managerId}
- UNION
- select user_id from tb_lib_manager
- where state = 1
- and type in(8,11,13)
- and user_id = #{map.managerId}
- )
- <!--校区管理员显示分配老师未批改的作业、批改中的作业-->
- and exists(
- select 1
- from scon_homework_picture s
- where 1 = 1
- and s.service_type=1
- and s.is_mark in (0, 2)
- and s.is_feedback = 0
- and s.teacher_id = t1.teacher_id
- and s.homework_id = t.id
- )
- </if>
- </if>
- <if test='map.type == "13" '>
- <if test='map.role == "superManager"'>
- and exists(
- select 1
- from scon_homework_picture s
- where 1 = 1
- and s.service_type=1
- and s.is_mark in (0, 2)
- and s.is_needing_know = 1
- and s.is_know_feedback = 0
- and s.know_teacher_id is null
- and s.homework_id = t.id
- AND s.teacher_id IS NOT NULL
- AND s.is_feedback = 1
- union
- select 1
- from scon_homework_picture s
- where 1 = 1
- and s.service_type=1
- and s.is_mark in (0, 2)
- and s.is_needing_know = 1
- and s.is_know_feedback = 0
- and s.know_teacher_id = t1.know_teacher_id
- and s.homework_id = t.id
- AND s.teacher_id IS NOT NULL
- AND s.is_feedback = 1
- )
- </if>
- <!--校区管理员只显示其组下的,包含自己-->
- <if test='map.role == "manager"'>
- and t1.know_teacher_id in
- (
- select user_id from tb_lib_manager
- where state = 1
- and type in(8,11,13)
- and parent_id = #{map.managerId}
- union
- select user_id from tb_lib_manager
- where state = 1
- and type in(8,11,13)
- and user_id = #{map.managerId}
- )
- <!--校区管理员显示分配老师未批改的作业、批改中的作业-->
- and exists(
- select 1
- from scon_homework_picture s
- where 1 = 1
- and s.service_type=1
- and s.is_mark in (0, 2)
- and s.is_needing_know = 1
- and s.is_know_feedback = 0
- and s.know_teacher_id = t1.know_teacher_id
- and s.homework_id = t.id
- AND s.teacher_id IS NOT NULL
- AND s.is_feedback = 1
- )
- </if>
- <!--匹配知识点的作业:需要此作业已批改完-->
- and t1.teacher_id is not null
- and t1.is_feedback = 1
- </if>
- <if test="map.value != null and map.value != '' ">
- and t3.child_name regexp #{map.value}
- </if>
- <if test="map.createTime != null and map.createTime != '' ">
- and t.create_time >= #{map.createTime}
- and t1.create_time >= #{map.createTime}
- </if>
- group by homeworkId, teacherId) t
- <!--排除掉批改完的作业,此作业出现的情况为一份作业部分分给了老师且批改完,部分未分老师-->
- where t.status in(1,2,3)
- order by t.status, t.uploadTime
- </select>
- <select id="studentHomeworkDetail" resultType="com.ssj.bean.mybatis.HomeworkPictureMBDto" parameterType="hashMap">
- select t1.id,
- t1.vip_id vipId,
- date_format(t3.create_time, '%Y-%m-%d') createDate,
- t1.create_time createTime,
- t2.allot_time allotTime,
- t3.subject,
- t2.start_time startTime,
- t2.start_time beginTime,
- t2.end_time endTime,
- t1.is_feedback isFeedback,
- t1.is_know_feedback isKnowFeedback,
- (select child_name from tb_lib_vip where t3.vip_id = id) childName,
- t1.is_mark isMark,
- t1.teacher_id teacherId,
- (select name from tb_lib_manager where user_id = t1.teacher_id and type in (8,11,12,13,14) limit 1) teacherName,
- (select t_photo from tb_lib_manager where user_id = t1.teacher_id and type in (8,11,12,13,14) limit 1) teacherImg,
- t1.know_teacher_id knowTeacherId,
- (select name from tb_lib_manager where user_id = t1.know_teacher_id and type in (8,11,12,13,14) limit 1) knowTeacherName,
- (select t_photo from tb_lib_manager where user_id = t1.know_teacher_id and type in (8,11,12,13,14) limit 1) knowTeacherImg,
- t1.file_key fileKey,
- t1.corrected_picture_url correctedPictureUrl,
- t1.composition_comment compositionComment,
- t2.checker checker,
- t2.check_date checkDate,
- t1.is_checker_correct isCheckerCorrect,
- t2.is_check_error isCheckError,
- '' checkerImgUrl,
- ifnull(t2.type, 0) type
- from scon_homework_picture t1
- left join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id
- <if test="map.type != null and map.type != '' ">
- and t2.type = #{map.type}
- </if>
- left join scon_homework t3 on t1.homework_id = t3.id
- where 1=1
- and t1.service_type=1
- <if test="map.isDelete != null and map.isDelete != '' ">
- and t1.is_delete = #{map.isDelete}
- </if>
- <if test="map.homeworkId != null and map.homeworkId != '' ">
- and t1.homework_id = #{map.homeworkId}
- </if>
- <if test='map.type == "8" '>
- order by t1.teacher_id desc
- </if>
- <if test='map.type == "13" '>
- order by t1.know_teacher_id desc
- </if>
- </select>
- <select id="findStudentHomeworkListByPage" resultType="com.ssj.bean.mybatis.StudentHomeworkMBDto" parameterType="hashMap">
- SELECT
- distinct t.id homeworkId,
- t.vip_id vipId,
- t2.child_name NAME,
- t2.img_url imgUrl,
- t.SUBJECT,
- t.grade,
- t.create_time createTime
- FROM
- scon_homework t
- left join scon_homework_picture t1
- on t.id=t1.homework_id
- left JOIN tb_lib_vip t2 ON t1.vip_id = t2.id
- where t1.service_type=1
- <if test="map.value != null and map.value != '' ">
- and t2.child_name regexp #{map.value}
- </if>
- <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
- and t.create_time >= #{map.GTE_createTime}
- </if>
- order by t.create_time desc
- </select>
- <select id="findTeacherAllotByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
- select <include refid="tbLibManager" />
- from tb_lib_manager t
- where t.state = 1
- and t.is_online = 1
- <if test="map.name != null and map.name != '' ">
- and t.name regexp #{map.name}
- </if>
- <if test="map.subject != null and map.subject != '' ">
- and t.course_name regexp #{map.subject}
- </if>
- <if test="map.grade != null and map.grade != '' ">
- and t.grade regexp #{map.grade}
- </if>
- <if test="map.parentId != null and map.parentId != '' ">
- and (t.parent_id = #{map.parentId} or t.user_id= #{map.parentId})
- </if>
- <if test='map.type == "8" '>
- and t.type in (8, 11)
- </if>
- <if test='map.type == "13" '>
- and t.type = 13
- </if>
- </select>
- <select id="findTeacherByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto">
- select <include refid="tbLibManager" />
- from tb_lib_manager t
- where t.state = 1
- <if test="map.teacherName != null and map.teacherName != '' ">
- and t.name regexp #{map.teacherName}
- </if>
- <if test="map.subject != null and map.subject != '' ">
- and t.course_name regexp #{map.subject}
- </if>
- <if test="map.grade != null and map.grade != '' ">
- and t.grade regexp #{map.grade}
- </if>
- <if test="map.parentId != null and map.parentId != '' ">
- and (t.parent_id = #{map.parentId} or t.user_id= #{map.parentId})
- </if>
- <if test='map.type == "8" '>
- <if test='map.role == "superManager" '>
- and t.type =8
- </if>
- and t.type in (8, 11)
- </if>
- <if test='map.type == "13" '>
- and t.type = 13
- </if>
- <!--查出某天有作业的老师-->
- <if test="map.timeType != null and map.timeType != '' ">
- <if test="teacherIds.size() > 0">
- and t.user_id in
- <foreach collection="teacherIds" index="i" item="teacherId" open="(" close=")" separator=",">
- #{teacherId}
- </foreach>
- </if>
- </if>
- <if test="noTeacherIds.size() > 0">
- and t.user_id not in
- <foreach collection="noTeacherIds" index="i" item="teacherId" open="(" close=")" separator=",">
- #{teacherId}
- </foreach>
- </if>
- order by t.type desc,t.is_online desc,t.is_cancelled,t.login_time desc,t.is_banned
- </select>
- <select id="getWaitCount" resultType="Long" parameterType="java.util.Map">
- select count(1)
- from scon_homework_picture s1
- where 1=1
- and s1.service_type=1
- <if test="map.beginTime != null and map.beginTime != '' ">
- and s1.create_time >= #{map.beginTime}
- </if>
- <if test='map.type == "8" '>
- and s1.teacher_id = #{map.teacherId}
- and s1.is_feedback = 0 and s1.is_mark in (0, 2)
- </if>
- <if test='map.type == "13" '>
- and s1.know_teacher_id = #{map.teacherId}
- and s1.is_know_feedback = 0
- </if>
- </select>
- <select id="findAttendByTeacherId" resultType="java.util.Map" parameterType="java.util.Map">
- select count(distinct t1.teacher_id) as count,avg(ifnull( t1.judge_level,4)) as avg_judge
- from tb_teacher_assessment t1
- LEFT JOIN tb_lib_manager t2
- ON t1.teacher_id = t2.user_id
- where
- t2.state = 1
- <if test="map.userId !=null and map.userId !='' ">
- <if test=' map.role=="superManager" '>
- AND t2.parent_id = #{map.userId}
- </if>
- <if test=' map.role=="manager" '>
- AND (t2.parent_id = #{map.userId} or t2.user_id=#{map.userId})
- </if>
- </if>
- </select>
- <select id="findUnCheckTeacherList" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
- select t.teacher_id userId,
- (select is_online from tb_lib_manager where type in (8,11) and user_id = t.teacher_id limit 1) isOnline,
- sum(t.uncheck_nums) uncheckNums
- from (select t1.teacher_id, t1.homework_id, count(1) uncheck_nums
- from scon_homework_picture t1
- join scon_homework_picture_correct t2
- on t1.id = t2.homework_picture_id and t2.type = 8 and t2.check_date is null
- where t1.teacher_id is not null
- and t1.service_type=1
- <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
- and t1.create_time >= #{map.GTE_createTime}
- </if>
- <if test="map.createTime != null and map.createTime != '' ">
- and t1.create_time regexp #{map.createTime}
- </if>
- <if test="map.subject != null and map.subject != '' ">
- and t1.subject = #{map.subject}
- </if>
- group by t1.teacher_id, t1.homework_id
- ) t
- where not exists(
- select 1
- from scon_homework_picture s
- where 1 = 1
- and s.service_type=1
- and s.is_delete = 0
- and s.is_mark in (0, 2)
- and s.is_feedback = 0
- and s.homework_id = t.homework_id
- and s.teacher_id = t.teacher_id
- <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
- and s.create_time >= #{map.GTE_createTime}
- </if>
- <if test="map.createTime != null and map.createTime != '' ">
- and s.create_time regexp #{map.createTime}
- </if>
- )
- group by t.teacher_id
- order by isOnline desc, uncheckNums desc
- </select>
- <select id="findUnCheckKnowTeacherList" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
- select t.know_teacher_id userId,
- (select is_online from tb_lib_manager where type =13 and user_id = t.know_teacher_id limit 1) isOnline,
- sum(t.uncheck_nums) uncheckNums
- from (select t1.know_teacher_id, t1.homework_id, count(1) uncheck_nums
- from scon_homework_picture t1
- join scon_homework_picture_correct t2
- on t1.id = t2.homework_picture_id and t2.type = 13 and t2.check_date is null
- where t1.know_teacher_id is not null
- and t1.service_type=1
- <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
- and t1.create_time >= #{map.GTE_createTime}
- </if>
- <if test="map.createTime != null and map.createTime != '' ">
- and t1.create_time regexp #{map.createTime}
- </if>
- <if test="map.subject != null and map.subject != '' ">
- and t1.subject = #{map.subject}
- </if>
- group by t1.know_teacher_id, t1.homework_id
- ) t
- where not exists(
- select 1
- from scon_homework_picture s
- where 1 = 1
- and s.service_type=1
- and s.is_know_feedback = 0
- and s.homework_id = t.homework_id
- and s.know_teacher_id = t.know_teacher_id
- <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
- and s.create_time >= #{map.GTE_createTime}
- </if>
- <if test="map.createTime != null and map.createTime != '' ">
- and s.create_time regexp #{map.createTime}
- </if>
- )
- group by t.know_teacher_id
- order by isOnline desc, uncheckNums desc
- </select>
- <select id="findTeacherInfo" resultType="java.util.Map">
- select t1.name,t1.t_photo,t2.teacher_num from tb_lib_manager t1
- left join tb_lib_salary_integration t2
- on t1.user_id=t2.teacher_id
- where
- t1.user_id=#{teacherId}
- and t1.type =8
- limit 1000
- </select>
- <select id="findLoginDateByPage" resultType="string" parameterType="java.util.Map">
- select arrange_date
- from tb_lib_login_info
- where 1=1
- and teacher_id = #{map.teacherId}
- and arrange_date >= #{map.startDate}
- <!--and arrange_date < #{map.endDate}-->
- group by arrange_date
- order by arrange_date desc
- </select>
- <select id="findUserRoleByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
- select <include refid="tbLibManager" />
- from tb_lib_manager t
- where 1=1
- <if test="map.state != null and map.state != '' ">
- and t.state = #{map.state}
- </if>
- <if test="map.teacherName != null and map.teacherName != '' ">
- and t.name regexp #{map.teacherName}
- </if>
- <if test="map.subject != null and map.subject != '' ">
- and t.course_name regexp #{map.subject}
- </if>
- <if test="map.grade != null and map.grade != '' ">
- and t.grade regexp #{map.grade}
- </if>
- <if test="map.type != null and map.type != '' ">
- and t.type = #{map.type}
- </if>
- <if test="map.types != null and map.types.size() > 0">
- and t.type in
- <foreach collection="map.types" index="i" item="type" open="(" close=")" separator=",">
- #{type}
- </foreach>
- </if>
- <if test="map.LIKE_value != null and map.LIKE_value != '' ">
- and t.name regexp #{map.LIKE_value}
- </if>
- <if test="map.isOnline != null and map.isOnline != '' ">
- and t.is_online regexp #{map.isOnline}
- </if>
- <if test="map.isBanned != null and map.isBanned != '' ">
- and t.is_banned regexp #{map.isBanned}
- </if>
- <if test="map.isCancelled != null and map.isCancelled != '' ">
- and t.is_cancelled regexp #{map.isCancelled}
- </if>
- order by t.type,t.is_online desc,t.is_cancelled,t.login_time desc,t.is_banned
- </select>
- <select id="findOnedayTeacherOfFeedbackHomework" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="String">
- select t.teacher_id userId, max(t.maxEndTime) maxEndTime,sum(t.uncheckCount) uncheckCount
- from (
- select s.teacher_id,
- s.homework_id,
- sum(case
- when s.is_delete = 0 and s.is_mark in (0, 2) and s.is_feedback = 0 then 1
- else 0 end) no_feedback_count,
- sum(case when s1.check_date is null then 1 else 0 end) uncheckCount,
- max(s1.end_time) maxEndTime
- from scon_homework_picture s
- join scon_homework_picture_correct s1 on s.id = s1.homework_picture_id and s1.type = 8
- where 1 = 1
- and s.teacher_id is not null
- and s.create_time ${operate} #{date}
- group by s.teacher_id, s.homework_id
- ) t
- where t.no_feedback_count = 0
- group by t.teacher_id
- order by uncheckCount desc,maxEndTime
- </select>
- <select id="findOnedayKnowTeacherOfFeedbackHomework" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="String">
- select t.know_teacher_id userId, max(t.maxEndTime) maxEndTime,sum(t.uncheckCount) uncheckCount
- from (
- select s.know_teacher_id,
- s.homework_id,
- sum(case
- when s.is_delete = 0 and s.is_needing_know = 1 and s.is_know_feedback = 0 then 1
- else 0 end) no_feedback_count,
- sum(case when s1.check_date is null then 1 else 0 end) uncheckCount,
- max(s1.end_time) maxEndTime
- from scon_homework_picture s
- join scon_homework_picture_correct s1 on s.id = s1.homework_picture_id and s1.type = 13
- where 1 = 1
- and s.know_teacher_id is not null
- and s.create_time ${operate} #{date}
- group by s.know_teacher_id, s.homework_id) t
- where t.no_feedback_count = 0
- group by t.know_teacher_id
- order by uncheckCount desc,maxEndTime
- </select>
- </mapper>
|