CorrectSysMapper.xml 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.ssj.mapper.correctsys.CorrectSysMapper">
  4. <select id="findUncorrectHomeworkListByPage" resultType="java.util.Map" parameterType="java.util.Map">
  5. </select>
  6. <sql id="tbLibManager" >
  7. t.id,
  8. t.name,
  9. t.course_name courseName,
  10. t.user_id userId,
  11. t.t_photo tPhoto,
  12. t.is_online isOnline,
  13. t.is_banned isBanned,
  14. t.banned_time bannedTime,
  15. t.type,
  16. t.login_time loginTime,
  17. t.is_cancelled isCancelled,
  18. t.cancelled_time cancelledTime,
  19. t.telephone,
  20. t.create_time createTime,
  21. t.state
  22. </sql>
  23. <select id="findManagerListByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
  24. select <include refid="tbLibManager" />
  25. ,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)
  26. 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
  27. from tb_lib_manager t
  28. where t.type in (11,12)
  29. and t.state = 1
  30. <if test="map.subject != null and map.subject != '' ">
  31. and t.course_name regexp #{map.subject}
  32. </if>
  33. order by t.type desc,t.name
  34. </select>
  35. <select id="findTeacherListByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="hashMap">
  36. select t.* from
  37. (select <include refid="tbLibManager" />
  38. <!--1重点:本月新上线、无底薪;3一般:上个月上线无底薪;2放⼼:上个⽉有底薪-->
  39. <if test="map.addTag != null and map.addTag != '' ">
  40. ,CASE
  41. WHEN date_format(create_time, '%Y-%m') = date_format(now(), '%Y-%m') THEN 1
  42. WHEN (SELECT convert(IFNULL(s.basic_salary,0),DECIMAL(9,2)) FROM tb_lib_salary_info s
  43. WHERE s.user_id = t.user_id AND s.`month` REGEXP date_format(date_sub(now(), INTERVAL 1 MONTH),'%Y-%m') LIMIT 1)>0
  44. THEN 2
  45. ELSE 3 END tag
  46. </if>
  47. from tb_lib_manager t
  48. where 1 = 1
  49. and t.state = 1
  50. <if test="map.grade != null and map.grade != '' ">
  51. and t.grade regexp #{map.grade}
  52. </if>
  53. <if test="map.subject != null and map.subject != '' ">
  54. and t.course_name regexp #{map.subject}
  55. </if>
  56. <if test="map.teacherName != null and map.teacherName != '' ">
  57. and t.name regexp #{map.teacherName}
  58. </if>
  59. <!--注销老师只显示近七天注销的-->
  60. <if test="map.GTE_cancelledTime != null and map.GTE_cancelledTime != '' ">
  61. and (t.cancelled_time >= #{map.GTE_cancelledTime} or cancelled_time is null)
  62. </if>
  63. <!--只筛选出该天有作业的老师-->
  64. <if test="map.selectTime != null and map.selectTime != '' ">
  65. <if test="map.teacherIds.size() > 0">
  66. and t.user_id in
  67. <foreach collection="map.teacherIds" index="i" item="teacherId" open="(" close=")" separator=",">
  68. #{teacherId}
  69. </foreach>
  70. </if>
  71. </if>
  72. <!--批改老师-->
  73. <if test='map.type == "8" '>
  74. <!--校区管理员-->
  75. <if test='map.role == "11"'>
  76. and t.type in (8, 11)
  77. </if>
  78. <!--超级管理员-->
  79. <if test='map.role == "12"'>
  80. and t.type =8
  81. </if>
  82. </if>
  83. <!--匹配知识点老师-->
  84. <if test='map.type == "13" '>
  85. and t.type = 13
  86. </if>
  87. <if test="map.parentId != null and map.parentId != '' ">
  88. and (t.parent_id = #{map.parentId} or t.user_id=#{map.parentId})
  89. </if>
  90. ) t
  91. <if test="map.tag != null and map.tag != '' ">
  92. where t.tag = #{map.tag}
  93. </if>
  94. <!--排序方式:未质检在线(里面按照未质检数量降序);未质检离线(里面按照未质检数量降序);已质检在线;已质检离线-->
  95. order by
  96. <if test="map.orderField != null and map.orderField != '' ">
  97. ${map.orderField},
  98. </if>
  99. t.isCancelled, t.isBanned,
  100. t.isOnline desc,t.name
  101. </select>
  102. <select id="countByManagerId" resultType="java.util.Map" parameterType="java.util.Map">
  103. select sum(t.operate_nums) operate_nums,
  104. sum(t.is_feedback) feedback_count,
  105. sum(case when t.check_date is not null then 1 else 0 end) check_count,
  106. sum(t.is_check_error)+sum(t.correct_nums) wrong_count
  107. from (
  108. 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
  109. from scon_homework_picture t1
  110. join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id and t2.type=8
  111. where t1.service_type=1
  112. and t1.teacher_id in
  113. (select user_id from tb_lib_manager
  114. where state = 1
  115. and type in(8,11,13)
  116. and parent_id = #{map.managerId}
  117. union
  118. select user_id
  119. from tb_lib_manager
  120. where state = 1
  121. and type in (8, 11, 13)
  122. and user_id = #{map.managerId}
  123. )
  124. <!--and ((t1.is_mark in (0,2) and t1.is_feedback = 1) or t1.is_mark not in (0,2))-->
  125. <if test="map.before_createTime != null and map.before_createTime != '' ">
  126. and t1.create_time >= #{map.before_createTime}
  127. </if>
  128. <if test="map.before_allotTime != null and map.before_allotTime != '' ">
  129. and t2.allot_time >= #{map.before_allotTime}
  130. </if>
  131. union all
  132. 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
  133. from scon_homework_picture t1
  134. join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id and t2.type=13
  135. where t1.service_type=1
  136. and t1.know_teacher_id in
  137. (select user_id from tb_lib_manager
  138. where state = 1
  139. and type in(8,11,13)
  140. and parent_id = #{map.managerId}
  141. union
  142. select user_id from tb_lib_manager
  143. where state = 1
  144. and type in(8,11,13)
  145. and user_id = #{map.managerId}
  146. )
  147. <!--and ((t1.is_mark in (0,2) and t1.is_know_feedback = 1) or t1.is_mark not in (0,2))-->
  148. <if test="map.before_createTime != null and map.before_createTime != '' ">
  149. and t1.create_time >= #{map.before_createTime}
  150. </if>
  151. <if test="map.before_allotTime != null and map.before_allotTime != '' ">
  152. and t2.allot_time >= #{map.before_allotTime}
  153. </if>
  154. ) t
  155. </select>
  156. <select id="countByTeacherId" resultType="com.ssj.bean.mybatis.CountMBDto" parameterType="java.util.Map">
  157. <if test="map.teacherId != null and map.teacherId != '' ">
  158. select t1.homework_id homeworkId,
  159. 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,
  160. sum(case when t2.check_date is not null then 1 else 0 end) checkCount,
  161. case when sum(case when t2.start_time is not null and t2.end_time is null then 1 else 0 end)>0 then '批改中'
  162. when sum(case when t1.is_mark in (0,2) and t1.is_feedback = 0 then 1 else 0 end)>0 then '未批改'
  163. else '批改完' end status
  164. from scon_homework_picture t1
  165. join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id
  166. where 1=1
  167. and t1.service_type=1
  168. and t2.type = 8
  169. <!--and ((t1.is_mark in (0,2) and t1.is_feedback = 1) or t1.is_mark not in (0,2))-->
  170. and t1.teacher_id regexp #{map.teacherId}
  171. </if>
  172. <if test="map.knowTeacherId != null and map.knowTeacherId != '' ">
  173. select t1.homework_id,
  174. 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,
  175. sum(case when t2.check_date is not null then 1 else 0 end) check_count,
  176. case when sum(case when t2.start_time is not null and t2.end_time is null then 1 else 0 end)>0 then '批改中'
  177. 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 '未批改'
  178. else '批改完' end status
  179. from scon_homework_picture t1
  180. join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id
  181. where 1=1
  182. and t1.service_type=1
  183. and t2.type = 13
  184. <!--and ((t1.is_mark in (0,2) and t1.is_know_feedback = 1) or t1.is_mark not in (0,2))-->
  185. and t1.know_teacher_id regexp #{map.knowTeacherId}
  186. </if>
  187. <if test="map.allotTime != null and map.allotTime != '' ">
  188. and t1.allot_time >= #{map.allotTime}
  189. </if>
  190. <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
  191. and t1.create_time >= #{map.GTE_createTime}
  192. </if>
  193. <if test="map.EQ_createTime != null and map.EQ_createTime != '' ">
  194. and t1.create_time regexp #{map.EQ_createTime}
  195. </if>
  196. group by t1.homework_id
  197. </select>
  198. <select id="studentHomeworkNoFeedbackList" resultType="com.ssj.bean.mybatis.StudentHomeworkMBDto" parameterType="hashMap">
  199. select t.* from
  200. (select t.id homeworkId,
  201. <if test='map.type == "8" '>
  202. t1.teacher_id teacherId,
  203. (select name
  204. from tb_lib_manager
  205. where t1.teacher_id = user_id
  206. and type in (8, 11, 12, 13, 14)
  207. limit 1) teacherName,
  208. case
  209. <!--1.未分配2.已分配未批改3.批改中4.批改完-->
  210. when t1.teacher_id is null or t1.teacher_id = '' then 1
  211. 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
  212. when sum(case when t2.start_time is not null then 1 else 0 end) > 0 then 3
  213. else 2 end status,
  214. </if>
  215. <if test='map.type == "13" '>
  216. t1.know_teacher_id teacherId,
  217. (select name
  218. from tb_lib_manager
  219. where t1.know_teacher_id = user_id
  220. and type in (8, 11, 12, 13, 14)
  221. limit 1) teacherName,
  222. case
  223. when t1.know_teacher_id is null or t1.know_teacher_id = '' then 1
  224. when sum(case when t2.start_time is not null and t2.end_time is null then 1 else 0 end) > 0 then 3
  225. 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
  226. else 2 end status,
  227. </if>
  228. t.vip_id vipId,
  229. t3.child_name name,
  230. t.subject,
  231. count(t1.id) picNums,
  232. date_format(min(t2.start_time), '%Y-%m-%d %H:%i:%S') correctStartTime,
  233. date_format(min(t2.allot_time), '%Y-%m-%d %H:%i:%S') allotTime,
  234. date_format(min(t1.create_time), '%Y-%m-%d %H:%i:%S') uploadTime,
  235. UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(ifnull(min(t1.create_time), now())) waitLong1,
  236. UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(ifnull(max(t2.allot_time), now())) waitLong2,
  237. 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
  238. from scon_homework t
  239. join scon_homework_picture t1 on t.id = t1.homework_id
  240. left join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id and t2.type = #{map.type}
  241. join tb_lib_vip t3 on t.vip_id = t3.id
  242. where 1 = 1
  243. and t1.service_type=1
  244. <if test='map.type == "8" '>
  245. <!--超级管理员显示未分配的作业、分配老师未批改的作业、批改中的作业-->
  246. <if test='map.role == "superManager"'>
  247. and exists(
  248. select 1
  249. from scon_homework_picture s
  250. where s.is_mark in (0, 2)
  251. and s.service_type=1
  252. and s.is_feedback = 0
  253. and s.teacher_id = t1.teacher_id
  254. and s.homework_id = t.id
  255. UNION
  256. select 1
  257. from scon_homework_picture s
  258. where s.is_mark in (0, 2)
  259. and s.service_type=1
  260. and s.is_feedback = 0
  261. and s.teacher_id is null
  262. and s.homework_id = t.id
  263. )
  264. </if>
  265. <!--校区管理员只显示其组下的,包含自己-->
  266. <if test='map.role == "manager"'>
  267. and t1.teacher_id in
  268. (
  269. select user_id from tb_lib_manager
  270. where state = 1
  271. and type in(8,11,13)
  272. and parent_id = #{map.managerId}
  273. UNION
  274. select user_id from tb_lib_manager
  275. where state = 1
  276. and type in(8,11,13)
  277. and user_id = #{map.managerId}
  278. )
  279. <!--校区管理员显示分配老师未批改的作业、批改中的作业-->
  280. and exists(
  281. select 1
  282. from scon_homework_picture s
  283. where 1 = 1
  284. and s.service_type=1
  285. and s.is_mark in (0, 2)
  286. and s.is_feedback = 0
  287. and s.teacher_id = t1.teacher_id
  288. and s.homework_id = t.id
  289. )
  290. </if>
  291. </if>
  292. <if test='map.type == "13" '>
  293. <if test='map.role == "superManager"'>
  294. and exists(
  295. select 1
  296. from scon_homework_picture s
  297. where 1 = 1
  298. and s.service_type=1
  299. and s.is_mark in (0, 2)
  300. and s.is_needing_know = 1
  301. and s.is_know_feedback = 0
  302. and s.know_teacher_id is null
  303. and s.homework_id = t.id
  304. AND s.teacher_id IS NOT NULL
  305. AND s.is_feedback = 1
  306. union
  307. select 1
  308. from scon_homework_picture s
  309. where 1 = 1
  310. and s.service_type=1
  311. and s.is_mark in (0, 2)
  312. and s.is_needing_know = 1
  313. and s.is_know_feedback = 0
  314. and s.know_teacher_id = t1.know_teacher_id
  315. and s.homework_id = t.id
  316. AND s.teacher_id IS NOT NULL
  317. AND s.is_feedback = 1
  318. )
  319. </if>
  320. <!--校区管理员只显示其组下的,包含自己-->
  321. <if test='map.role == "manager"'>
  322. and t1.know_teacher_id in
  323. (
  324. select user_id from tb_lib_manager
  325. where state = 1
  326. and type in(8,11,13)
  327. and parent_id = #{map.managerId}
  328. union
  329. select user_id from tb_lib_manager
  330. where state = 1
  331. and type in(8,11,13)
  332. and user_id = #{map.managerId}
  333. )
  334. <!--校区管理员显示分配老师未批改的作业、批改中的作业-->
  335. and exists(
  336. select 1
  337. from scon_homework_picture s
  338. where 1 = 1
  339. and s.service_type=1
  340. and s.is_mark in (0, 2)
  341. and s.is_needing_know = 1
  342. and s.is_know_feedback = 0
  343. and s.know_teacher_id = t1.know_teacher_id
  344. and s.homework_id = t.id
  345. AND s.teacher_id IS NOT NULL
  346. AND s.is_feedback = 1
  347. )
  348. </if>
  349. <!--匹配知识点的作业:需要此作业已批改完-->
  350. and t1.teacher_id is not null
  351. and t1.is_feedback = 1
  352. </if>
  353. <if test="map.value != null and map.value != '' ">
  354. and t3.child_name regexp #{map.value}
  355. </if>
  356. <if test="map.createTime != null and map.createTime != '' ">
  357. and t.create_time >= #{map.createTime}
  358. and t1.create_time >= #{map.createTime}
  359. </if>
  360. group by homeworkId, teacherId) t
  361. <!--排除掉批改完的作业,此作业出现的情况为一份作业部分分给了老师且批改完,部分未分老师-->
  362. where t.status in(1,2,3)
  363. order by t.status, t.uploadTime
  364. </select>
  365. <select id="studentHomeworkDetail" resultType="com.ssj.bean.mybatis.HomeworkPictureMBDto" parameterType="hashMap">
  366. select t1.id,
  367. t1.vip_id vipId,
  368. date_format(t3.create_time, '%Y-%m-%d') createDate,
  369. t1.create_time createTime,
  370. t2.allot_time allotTime,
  371. t3.subject,
  372. t2.start_time startTime,
  373. t2.start_time beginTime,
  374. t2.end_time endTime,
  375. t1.is_feedback isFeedback,
  376. t1.is_know_feedback isKnowFeedback,
  377. (select child_name from tb_lib_vip where t3.vip_id = id) childName,
  378. t1.is_mark isMark,
  379. t1.teacher_id teacherId,
  380. (select name from tb_lib_manager where user_id = t1.teacher_id and type in (8,11,12,13,14) limit 1) teacherName,
  381. (select t_photo from tb_lib_manager where user_id = t1.teacher_id and type in (8,11,12,13,14) limit 1) teacherImg,
  382. t1.know_teacher_id knowTeacherId,
  383. (select name from tb_lib_manager where user_id = t1.know_teacher_id and type in (8,11,12,13,14) limit 1) knowTeacherName,
  384. (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,
  385. t1.file_key fileKey,
  386. t1.corrected_picture_url correctedPictureUrl,
  387. t1.composition_comment compositionComment,
  388. t2.checker checker,
  389. t2.check_date checkDate,
  390. t1.is_checker_correct isCheckerCorrect,
  391. t2.is_check_error isCheckError,
  392. '' checkerImgUrl,
  393. ifnull(t2.type, 0) type
  394. from scon_homework_picture t1
  395. left join scon_homework_picture_correct t2 on t1.id = t2.homework_picture_id
  396. <if test="map.type != null and map.type != '' ">
  397. and t2.type = #{map.type}
  398. </if>
  399. left join scon_homework t3 on t1.homework_id = t3.id
  400. where 1=1
  401. and t1.service_type=1
  402. <if test="map.isDelete != null and map.isDelete != '' ">
  403. and t1.is_delete = #{map.isDelete}
  404. </if>
  405. <if test="map.homeworkId != null and map.homeworkId != '' ">
  406. and t1.homework_id = #{map.homeworkId}
  407. </if>
  408. <if test='map.type == "8" '>
  409. order by t1.teacher_id desc
  410. </if>
  411. <if test='map.type == "13" '>
  412. order by t1.know_teacher_id desc
  413. </if>
  414. </select>
  415. <select id="findStudentHomeworkListByPage" resultType="com.ssj.bean.mybatis.StudentHomeworkMBDto" parameterType="hashMap">
  416. SELECT
  417. distinct t.id homeworkId,
  418. t.vip_id vipId,
  419. t2.child_name NAME,
  420. t2.img_url imgUrl,
  421. t.SUBJECT,
  422. t.grade,
  423. t.create_time createTime
  424. FROM
  425. scon_homework t
  426. left join scon_homework_picture t1
  427. on t.id=t1.homework_id
  428. left JOIN tb_lib_vip t2 ON t1.vip_id = t2.id
  429. where t1.service_type=1
  430. <if test="map.value != null and map.value != '' ">
  431. and t2.child_name regexp #{map.value}
  432. </if>
  433. <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
  434. and t.create_time >= #{map.GTE_createTime}
  435. </if>
  436. order by t.create_time desc
  437. </select>
  438. <select id="findTeacherAllotByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
  439. select <include refid="tbLibManager" />
  440. from tb_lib_manager t
  441. where t.state = 1
  442. and t.is_online = 1
  443. <if test="map.name != null and map.name != '' ">
  444. and t.name regexp #{map.name}
  445. </if>
  446. <if test="map.subject != null and map.subject != '' ">
  447. and t.course_name regexp #{map.subject}
  448. </if>
  449. <if test="map.grade != null and map.grade != '' ">
  450. and t.grade regexp #{map.grade}
  451. </if>
  452. <if test="map.parentId != null and map.parentId != '' ">
  453. and (t.parent_id = #{map.parentId} or t.user_id= #{map.parentId})
  454. </if>
  455. <if test='map.type == "8" '>
  456. and t.type in (8, 11)
  457. </if>
  458. <if test='map.type == "13" '>
  459. and t.type = 13
  460. </if>
  461. </select>
  462. <select id="findTeacherByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto">
  463. select <include refid="tbLibManager" />
  464. from tb_lib_manager t
  465. where t.state = 1
  466. <if test="map.teacherName != null and map.teacherName != '' ">
  467. and t.name regexp #{map.teacherName}
  468. </if>
  469. <if test="map.subject != null and map.subject != '' ">
  470. and t.course_name regexp #{map.subject}
  471. </if>
  472. <if test="map.grade != null and map.grade != '' ">
  473. and t.grade regexp #{map.grade}
  474. </if>
  475. <if test="map.parentId != null and map.parentId != '' ">
  476. and (t.parent_id = #{map.parentId} or t.user_id= #{map.parentId})
  477. </if>
  478. <if test='map.type == "8" '>
  479. <if test='map.role == "superManager" '>
  480. and t.type =8
  481. </if>
  482. and t.type in (8, 11)
  483. </if>
  484. <if test='map.type == "13" '>
  485. and t.type = 13
  486. </if>
  487. <!--查出某天有作业的老师-->
  488. <if test="map.timeType != null and map.timeType != '' ">
  489. <if test="teacherIds.size() > 0">
  490. and t.user_id in
  491. <foreach collection="teacherIds" index="i" item="teacherId" open="(" close=")" separator=",">
  492. #{teacherId}
  493. </foreach>
  494. </if>
  495. </if>
  496. <if test="noTeacherIds.size() > 0">
  497. and t.user_id not in
  498. <foreach collection="noTeacherIds" index="i" item="teacherId" open="(" close=")" separator=",">
  499. #{teacherId}
  500. </foreach>
  501. </if>
  502. order by t.type desc,t.is_online desc,t.is_cancelled,t.login_time desc,t.is_banned
  503. </select>
  504. <select id="getWaitCount" resultType="Long" parameterType="java.util.Map">
  505. select count(1)
  506. from scon_homework_picture s1
  507. where 1=1
  508. and s1.service_type=1
  509. <if test="map.beginTime != null and map.beginTime != '' ">
  510. and s1.create_time >= #{map.beginTime}
  511. </if>
  512. <if test='map.type == "8" '>
  513. and s1.teacher_id = #{map.teacherId}
  514. and s1.is_feedback = 0 and s1.is_mark in (0, 2)
  515. </if>
  516. <if test='map.type == "13" '>
  517. and s1.know_teacher_id = #{map.teacherId}
  518. and s1.is_know_feedback = 0
  519. </if>
  520. </select>
  521. <select id="findAttendByTeacherId" resultType="java.util.Map" parameterType="java.util.Map">
  522. select count(distinct t1.teacher_id) as count,avg(ifnull( t1.judge_level,4)) as avg_judge
  523. from tb_teacher_assessment t1
  524. LEFT JOIN tb_lib_manager t2
  525. ON t1.teacher_id = t2.user_id
  526. where
  527. t2.state = 1
  528. <if test="map.userId !=null and map.userId !='' ">
  529. <if test=' map.role=="superManager" '>
  530. AND t2.parent_id = #{map.userId}
  531. </if>
  532. <if test=' map.role=="manager" '>
  533. AND (t2.parent_id = #{map.userId} or t2.user_id=#{map.userId})
  534. </if>
  535. </if>
  536. </select>
  537. <select id="findUnCheckTeacherList" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
  538. select t.teacher_id userId,
  539. (select is_online from tb_lib_manager where type in (8,11) and user_id = t.teacher_id limit 1) isOnline,
  540. sum(t.uncheck_nums) uncheckNums
  541. from (select t1.teacher_id, t1.homework_id, count(1) uncheck_nums
  542. from scon_homework_picture t1
  543. join scon_homework_picture_correct t2
  544. on t1.id = t2.homework_picture_id and t2.type = 8 and t2.check_date is null
  545. where t1.teacher_id is not null
  546. and t1.service_type=1
  547. <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
  548. and t1.create_time >= #{map.GTE_createTime}
  549. </if>
  550. <if test="map.createTime != null and map.createTime != '' ">
  551. and t1.create_time regexp #{map.createTime}
  552. </if>
  553. <if test="map.subject != null and map.subject != '' ">
  554. and t1.subject = #{map.subject}
  555. </if>
  556. group by t1.teacher_id, t1.homework_id
  557. ) t
  558. where not exists(
  559. select 1
  560. from scon_homework_picture s
  561. where 1 = 1
  562. and s.service_type=1
  563. and s.is_delete = 0
  564. and s.is_mark in (0, 2)
  565. and s.is_feedback = 0
  566. and s.homework_id = t.homework_id
  567. and s.teacher_id = t.teacher_id
  568. <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
  569. and s.create_time >= #{map.GTE_createTime}
  570. </if>
  571. <if test="map.createTime != null and map.createTime != '' ">
  572. and s.create_time regexp #{map.createTime}
  573. </if>
  574. )
  575. group by t.teacher_id
  576. order by isOnline desc, uncheckNums desc
  577. </select>
  578. <select id="findUnCheckKnowTeacherList" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
  579. select t.know_teacher_id userId,
  580. (select is_online from tb_lib_manager where type =13 and user_id = t.know_teacher_id limit 1) isOnline,
  581. sum(t.uncheck_nums) uncheckNums
  582. from (select t1.know_teacher_id, t1.homework_id, count(1) uncheck_nums
  583. from scon_homework_picture t1
  584. join scon_homework_picture_correct t2
  585. on t1.id = t2.homework_picture_id and t2.type = 13 and t2.check_date is null
  586. where t1.know_teacher_id is not null
  587. and t1.service_type=1
  588. <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
  589. and t1.create_time >= #{map.GTE_createTime}
  590. </if>
  591. <if test="map.createTime != null and map.createTime != '' ">
  592. and t1.create_time regexp #{map.createTime}
  593. </if>
  594. <if test="map.subject != null and map.subject != '' ">
  595. and t1.subject = #{map.subject}
  596. </if>
  597. group by t1.know_teacher_id, t1.homework_id
  598. ) t
  599. where not exists(
  600. select 1
  601. from scon_homework_picture s
  602. where 1 = 1
  603. and s.service_type=1
  604. and s.is_know_feedback = 0
  605. and s.homework_id = t.homework_id
  606. and s.know_teacher_id = t.know_teacher_id
  607. <if test="map.GTE_createTime != null and map.GTE_createTime != '' ">
  608. and s.create_time >= #{map.GTE_createTime}
  609. </if>
  610. <if test="map.createTime != null and map.createTime != '' ">
  611. and s.create_time regexp #{map.createTime}
  612. </if>
  613. )
  614. group by t.know_teacher_id
  615. order by isOnline desc, uncheckNums desc
  616. </select>
  617. <select id="findTeacherInfo" resultType="java.util.Map">
  618. select t1.name,t1.t_photo,t2.teacher_num from tb_lib_manager t1
  619. left join tb_lib_salary_integration t2
  620. on t1.user_id=t2.teacher_id
  621. where
  622. t1.user_id=#{teacherId}
  623. and t1.type =8
  624. limit 1000
  625. </select>
  626. <select id="findLoginDateByPage" resultType="string" parameterType="java.util.Map">
  627. select arrange_date
  628. from tb_lib_login_info
  629. where 1=1
  630. and teacher_id = #{map.teacherId}
  631. and arrange_date >= #{map.startDate}
  632. <!--and arrange_date &lt; #{map.endDate}-->
  633. group by arrange_date
  634. order by arrange_date desc
  635. </select>
  636. <select id="findUserRoleByPage" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="java.util.Map">
  637. select <include refid="tbLibManager" />
  638. from tb_lib_manager t
  639. where 1=1
  640. <if test="map.state != null and map.state != '' ">
  641. and t.state = #{map.state}
  642. </if>
  643. <if test="map.teacherName != null and map.teacherName != '' ">
  644. and t.name regexp #{map.teacherName}
  645. </if>
  646. <if test="map.subject != null and map.subject != '' ">
  647. and t.course_name regexp #{map.subject}
  648. </if>
  649. <if test="map.grade != null and map.grade != '' ">
  650. and t.grade regexp #{map.grade}
  651. </if>
  652. <if test="map.type != null and map.type != '' ">
  653. and t.type = #{map.type}
  654. </if>
  655. <if test="map.types != null and map.types.size() > 0">
  656. and t.type in
  657. <foreach collection="map.types" index="i" item="type" open="(" close=")" separator=",">
  658. #{type}
  659. </foreach>
  660. </if>
  661. <if test="map.LIKE_value != null and map.LIKE_value != '' ">
  662. and t.name regexp #{map.LIKE_value}
  663. </if>
  664. <if test="map.isOnline != null and map.isOnline != '' ">
  665. and t.is_online regexp #{map.isOnline}
  666. </if>
  667. <if test="map.isBanned != null and map.isBanned != '' ">
  668. and t.is_banned regexp #{map.isBanned}
  669. </if>
  670. <if test="map.isCancelled != null and map.isCancelled != '' ">
  671. and t.is_cancelled regexp #{map.isCancelled}
  672. </if>
  673. order by t.type,t.is_online desc,t.is_cancelled,t.login_time desc,t.is_banned
  674. </select>
  675. <select id="findOnedayTeacherOfFeedbackHomework" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="String">
  676. select t.teacher_id userId, max(t.maxEndTime) maxEndTime,sum(t.uncheckCount) uncheckCount
  677. from (
  678. select s.teacher_id,
  679. s.homework_id,
  680. sum(case
  681. when s.is_delete = 0 and s.is_mark in (0, 2) and s.is_feedback = 0 then 1
  682. else 0 end) no_feedback_count,
  683. sum(case when s1.check_date is null then 1 else 0 end) uncheckCount,
  684. max(s1.end_time) maxEndTime
  685. from scon_homework_picture s
  686. join scon_homework_picture_correct s1 on s.id = s1.homework_picture_id and s1.type = 8
  687. where 1 = 1
  688. and s.teacher_id is not null
  689. and s.create_time ${operate} #{date}
  690. group by s.teacher_id, s.homework_id
  691. ) t
  692. where t.no_feedback_count = 0
  693. group by t.teacher_id
  694. order by uncheckCount desc,maxEndTime
  695. </select>
  696. <select id="findOnedayKnowTeacherOfFeedbackHomework" resultType="com.ssj.bean.mybatis.ManagerMBDto" parameterType="String">
  697. select t.know_teacher_id userId, max(t.maxEndTime) maxEndTime,sum(t.uncheckCount) uncheckCount
  698. from (
  699. select s.know_teacher_id,
  700. s.homework_id,
  701. sum(case
  702. when s.is_delete = 0 and s.is_needing_know = 1 and s.is_know_feedback = 0 then 1
  703. else 0 end) no_feedback_count,
  704. sum(case when s1.check_date is null then 1 else 0 end) uncheckCount,
  705. max(s1.end_time) maxEndTime
  706. from scon_homework_picture s
  707. join scon_homework_picture_correct s1 on s.id = s1.homework_picture_id and s1.type = 13
  708. where 1 = 1
  709. and s.know_teacher_id is not null
  710. and s.create_time ${operate} #{date}
  711. group by s.know_teacher_id, s.homework_id) t
  712. where t.no_feedback_count = 0
  713. group by t.know_teacher_id
  714. order by uncheckCount desc,maxEndTime
  715. </select>
  716. </mapper>