KmtExerciseMapper.xml 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964
  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.service.mapper.KmtExerciseMapper">
  4. <resultMap id="DistributionExerciseBookDTOResultMap" type="com.ssj.service.kmt.exercisesys.dto.DistributionExerciseBookDTO">
  5. <id column="exerciseBookId" property="exerciseBookId"/>
  6. <result column="importDate" property="importDate"/>
  7. <result column="subject" property="subject"/>
  8. <result column="grade" property="grade"/>
  9. <result column="version_name" property="versionName"/>
  10. <result column="semester" property="semester"/>
  11. <result column="book_name" property="bookName"/>
  12. <result column="book_type" property="bookType"/>
  13. <result column="unitNum" property="unitNum"/>
  14. <result column="courseNum" property="courseNum"/>
  15. <result column="intHandleAccuracy" property="intHandleAccuracy"/>
  16. <result column="intHandleAuditAccuracy" property="intHandleAuditAccuracy"/>
  17. <result column="intAnalysisAccuracy" property="intAnalysisAccuracy"/>
  18. <result column="assigned_batch" property="assignedBatch"/>
  19. <collection property="handleUserList" ofType="com.ssj.service.kmt.exercisesys.dto.DistributionTeacherDTO">
  20. <result column="handlerTeacherId" property="teacherId"/>
  21. <result column="handlerSalaryGiven" property="salaryGiven"/>
  22. <result column="handlerSalaryGivenTime" property="salaryGivenTime"/>
  23. <result column="handlerName" property="teacherName"/>
  24. <result column="handlerDistributeTime" property="createTime"/>
  25. </collection>
  26. <collection property="auditingUserList" ofType="com.ssj.service.kmt.exercisesys.dto.DistributionTeacherDTO">
  27. <result column="handlerAuditUserTeacherId" property="teacherId"/>
  28. <result column="handlerAuditUserSalaryGiven" property="salaryGiven"/>
  29. <result column="handlerAuditUserSalaryGivenTime" property="salaryGivenTime"/>
  30. <result column="handlerAuditUserName" property="teacherName"/>
  31. <result column="handlerAuditUserDistributeTime" property="createTime"/>
  32. </collection>
  33. <collection property="analysisUserList" ofType="com.ssj.service.kmt.exercisesys.dto.DistributionTeacherDTO">
  34. <result column="analyserTeacherId" property="teacherId"/>
  35. <result column="analyserSalaryGiven" property="salaryGiven"/>
  36. <result column="analyserSalaryGivenTime" property="salaryGivenTime"/>
  37. <result column="analyserName" property="teacherName"/>
  38. <result column="analyserDistributeTime" property="createTime"/>
  39. </collection>
  40. <collection property="analysisAuditerList" ofType="com.ssj.service.kmt.exercisesys.dto.DistributionTeacherDTO">
  41. <result column="analysisAuditUserTeacherId" property="teacherId"/>
  42. <result column="analysisAuditUserSalaryGiven" property="salaryGiven"/>
  43. <result column="analysisAuditUserSalaryGivenTime" property="salaryGivenTime"/>
  44. <result column="analysisAuditUserName" property="teacherName"/>
  45. <result column="analysisAuditUserDistributeTime" property="createTime"/>
  46. </collection>
  47. </resultMap>
  48. <resultMap id="ExportDistributionExerciseBookDTOResultMap" type="com.ssj.service.kmt.exercisesys.dto.ExportDistributionExerciseBookDTO">
  49. <id column="exercise_book_id" property="exerciseBookId"/>
  50. <result column="import_date" property="importDate"/>
  51. <result column="subject" property="subject"/>
  52. <result column="grade" property="grade"/>
  53. <result column="version_name" property="versionName"/>
  54. <result column="semester" property="semester"/>
  55. <result column="book_name" property="bookName"/>
  56. <result column="book_type" property="bookType"/>
  57. <result column="unit_count" property="unitNum"/>
  58. <result column="course_count" property="courseNum"/>
  59. </resultMap>
  60. <select id="findWrongQuestionKnowHowDetailIdList" resultType="java.lang.String">
  61. select kmt_exercise_question_know.how_details_id
  62. from kmt_exercise_question_know
  63. where kmt_exercise_question_know.question_id = #{questionId}
  64. union all
  65. select kmt_exercise_question_know.how_details_id
  66. from kmt_exercise_question_know,
  67. kmt_exercise_questions brother,
  68. kmt_exercise_questions
  69. where kmt_exercise_question_know.question_id = brother.id
  70. and brother.parent_id = kmt_exercise_questions.parent_id
  71. and kmt_exercise_questions.id = #{questionId}
  72. and ifnull(length(kmt_exercise_questions.parent_id), 0) > 0
  73. </select>
  74. <!-- 查询题目列表 -->
  75. <select id="findKmtExerciseQuestionsByIdIn" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion" >
  76. select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
  77. eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
  78. eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
  79. eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
  80. eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
  81. eq.update_type, eq.difficulty_level, eq.training_skill, eq.course_name, eq.is_common_flag, eq.question_year, eq.exercise_book_id, eq.es_loaded,
  82. eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time,
  83. eq.proofread_status, eq.question_path, eq.handler_submit_time
  84. from kmt_exercise_questions eq
  85. left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eq.id in
  86. <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
  87. #{id}
  88. </foreach>
  89. limit 0, 5000
  90. </select>
  91. <!-- 查询打回题目列表 -->
  92. <select id="findKmtExerciseQuestionRollbacks" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionRollback">
  93. SELECT * FROM kmt_exercise_question_rollback where question_id in
  94. <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
  95. #{id}
  96. </foreach>
  97. and type=#{dealType}
  98. </select>
  99. <!-- 查询待加工审核的题目 -->
  100. <select id="findQuestionByBookCourseIdAndUserId" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  101. select eq.id question_id, eq.course_name, eb.handle_user_id, eb.auditing_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eq.book_course_id course_id,
  102. eq.big_question_index, eq.small_question_name small_question_index,
  103. eq.deal_status question_status, eq.create_time, eq.remark reason, eq.from_user_id, eq.to_user_id,
  104. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  105. eq.training_skill training_skills, eq.parent_id, eq.proofread_status, eq.question_path, eq.num, eq.create_time
  106. from kmt_exercise_questions eq left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
  107. where eq.book_course_id = #{bookCourseId} and (eq.exercise_book_id=#{exerciseBookId} or eq.is_common_flag = 0)
  108. <if test = "dealType == 2">
  109. and eq.deal_status in (3, 7)
  110. </if>
  111. <if test = "dealType == 1">
  112. and eq.deal_status &lt; 2
  113. </if>
  114. <if test = "dealType == 4">
  115. and eq.deal_status in (5, 8)
  116. </if>
  117. <if test = "dealType == 5">
  118. and eq.deal_status in (9, 10)
  119. </if>
  120. <if test = "dealType == 6">
  121. and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
  122. </if>
  123. <if test = "dealType == 7">
  124. and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
  125. </if>
  126. <if test="dealType == 3 and rollbackType > 0 ">
  127. <if test="rollbackType == 1">
  128. and eq.deal_status != 2
  129. </if>
  130. <if test="rollbackType == 2">
  131. and eq.deal_status > 2
  132. </if>
  133. <if test="rollbackType == 3">
  134. and eq.deal_status > 3 and eq.deal_status != 7
  135. </if>
  136. <if test="rollbackType == 4">
  137. and eq.deal_status > 8
  138. </if>
  139. <if test="rollbackType == 5">
  140. and eq.deal_status > 10
  141. </if>
  142. </if>
  143. order by eq.num, eq.create_time
  144. </select>
  145. <!-- 查询待加工审核的题目 -->
  146. <select id="findQuestionByBookCourseId" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  147. select eq.id question_id, eq.course_name, eb.handle_user_id, eb.auditing_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eq.book_course_id course_id,
  148. eq.big_question_index, eq.small_question_name small_question_index,
  149. eq.deal_status question_status, eq.create_time, eq.remark reason,
  150. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  151. eq.training_skill training_skills, eq.parent_id, eq.question_path
  152. from kmt_exercise_questions eq
  153. left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
  154. where eq.book_course_id = #{bookCourseId}
  155. order by eq.num, eq.create_time
  156. limit 0, 5000
  157. </select>
  158. <!-- 查询打回理由记录 -->
  159. <select id="findQuestionRollbackRecord" resultType="com.ssj.service.kmt.dto.exercise.KmtExerciseQuestionRollBackInfo">
  160. select eqr.id, eqr.create_time, eqr.reason,eqr.user_id userId,eqr.to_user_id toUserId,user1.user_id tbUserId,user2.user_id tbToUserId, user1.name from_user, eqr.from_user_type from_type,user2.name to_user,
  161. eqr.to_user_type to_type from kmt_exercise_question_rollback eqr left join tb_lib_manager user1 on eqr.user_id = user1.user_id and user1.type in (17, 18)
  162. left join tb_lib_manager user2 on eqr.to_user_id = user2.user_id and user2.type in (17, 18)
  163. where eqr.question_id = #{questionId}
  164. order by eqr.create_time desc limit 20;
  165. </select>
  166. <!-- 查询打回理由记录老 -->
  167. <select id="findQuestionRollbackRecordOld" resultType="com.ssj.service.kmt.dto.exercise.ExerciseQuestionRollbacks">
  168. select eqr.id,eqr.create_time, eqr.reason, user1.name from_user, user1.type from_type, user2.name to_user,
  169. user2.type to_type from kmt_exercise_question_rollback eqr left join kmt_sys_user user1 on eqr.user_id = user1.id
  170. left join kmt_sys_user user2 on eqr.to_user_id = user2.id
  171. where eqr.question_id = #{questionId} order by eqr.create_time desc limit 20;
  172. </select>
  173. <select id="countWrongAndTotal" resultType="java.util.Map">
  174. select sum(ifnull(scon_homework_how_details.detail_count, 0)) wrong_count,
  175. sum(ifnull(scon_homework_how_details.total_count, 1)) total_count
  176. from scon_homework_how_details,
  177. scon_homework
  178. where scon_homework_how_details.homework_id = scon_homework.id
  179. and scon_homework.vip_id = #{vipId}
  180. <if test="subject != null and subject != ''">
  181. and scon_homework.subject = #{subject}
  182. </if>
  183. and scon_homework.create_time >= #{beginDateTime}
  184. and #{endDateTime} >= scon_homework.create_time
  185. and scon_homework_how_details.wrong_question_id is null
  186. union all
  187. select sum(if(kmt_homework_wrong_question.type = 1, 1, 0)) wrong_count, count(*) total_count
  188. from kmt_homework_wrong_question,
  189. scon_homework
  190. where kmt_homework_wrong_question.homework_id = scon_homework.id
  191. and scon_homework.vip_id = #{vipId}
  192. <if test="subject != null and subject != ''">
  193. and scon_homework.subject = #{subject}
  194. </if>
  195. and scon_homework.create_time >= #{beginDateTime}
  196. and #{endDateTime} >= scon_homework.create_time
  197. and kmt_homework_wrong_question.is_delete = 0
  198. </select>
  199. <select id="countPlatformCorrectionKnowledgeTimes" resultType="java.util.Map">
  200. select zyb_know_how_details_sort.alias, count(*) count_num
  201. from scon_homework_how_details,
  202. scon_homework,
  203. zyb_know_how_details_sort
  204. where scon_homework_how_details.homework_id = scon_homework.id
  205. and scon_homework_how_details.how_detail_id = zyb_know_how_details_sort.how_details_id
  206. and scon_homework_how_details.knowledge_version = zyb_know_how_details_sort.type
  207. and zyb_know_how_details_sort.stat = 2
  208. and scon_homework.vip_id = #{vipId}
  209. <if test="subject != null and subject != ''">
  210. and scon_homework.subject = #{subject}
  211. </if>
  212. and scon_homework.create_time > #{beginDateTimeStr}
  213. and #{endDateTimeStr} > scon_homework.create_time
  214. and scon_homework_how_details.wrong_question_id is null
  215. group by zyb_know_how_details_sort.alias
  216. </select>
  217. <select id="findWrongQuestion" resultType="java.util.Map">
  218. select kmt_homework_wrong_question.homework_id, kmt_homework_wrong_question.question_id
  219. from kmt_homework_wrong_question,
  220. scon_homework
  221. where kmt_homework_wrong_question.homework_id = scon_homework.id
  222. and scon_homework.vip_id = #{vipId}
  223. and scon_homework.subject = #{subject}
  224. and scon_homework.create_time > #{beginDateTimeStr}
  225. and #{endDateTimeStr} > scon_homework.create_time
  226. and kmt_homework_wrong_question.is_delete = 0
  227. </select>
  228. <select id="countCampusCorrectionKnowledgeTimesByQuestionIds" resultType="java.util.Map">
  229. select khds.alias, count(distinct eqk.question_id) count_num
  230. from (select question_id, how_detail_sort_id
  231. from kmt_exercise_question_know
  232. where question_id in
  233. <foreach collection="questionIdList" open="(" item="questionId" separator="," close=")">
  234. #{questionId}
  235. </foreach>
  236. ) eqk, zyb_know_how_details_sort khds
  237. where eqk.how_detail_sort_id = khds.id
  238. group by khds.alias
  239. </select>
  240. <select id="countKnowledgeMastery" resultType="java.util.Map">
  241. (select details_sort.alias,
  242. <if test="subject != null and subject != ''">
  243. <if test="subject == '语文' || subject == '数学'">
  244. details_sort.two_module module,
  245. </if>
  246. <if test="subject == '英语'">
  247. details_sort.module module,
  248. </if>
  249. </if>
  250. group_concat(how_sort.alias) how_name,
  251. sum(ifnull(scon_homework_how_details.detail_count, 0)) wrong_count,
  252. sum(ifnull(scon_homework_how_details.total_count, 1)) total_count,
  253. group_concat(details_sort.how_details_id) know_how_detail_id_str,
  254. group_concat(details_sort.type) knowledge_version_str
  255. from scon_homework_how_details,
  256. scon_homework,
  257. zyb_know_how_details_sort details_sort,
  258. zyb_know_how_details_sort how_sort
  259. where scon_homework_how_details.homework_id = scon_homework.id
  260. and scon_homework_how_details.how_detail_id = details_sort.how_details_id
  261. and scon_homework_how_details.knowledge_version = details_sort.type
  262. and details_sort.stat = 2
  263. and how_sort.how_id = details_sort.how_id
  264. and how_sort.stat = 1
  265. and how_sort.grade_num = details_sort.grade_num
  266. and how_sort.semester = details_sort.semester
  267. and scon_homework.vip_id = #{vipId}
  268. <if test="subject != null and subject != ''">
  269. and scon_homework.subject = #{subject}
  270. </if>
  271. and scon_homework.create_time > #{beginDateTimeStr}
  272. and #{endDateTimeStr} > scon_homework.create_time
  273. and scon_homework_how_details.wrong_question_id is null
  274. group by details_sort.alias)
  275. union all
  276. (select details_sort.alias,
  277. <if test="subject != null and subject != ''">
  278. <if test="subject == '语文' || subject == '数学'">
  279. details_sort.two_module module,
  280. </if>
  281. <if test="subject == '英语'">
  282. details_sort.module module,
  283. </if>
  284. </if>
  285. group_concat(how_sort.alias) how_name,
  286. sum(if(kmt_homework_wrong_question.type = 1, 1, 0)) wrong_count,
  287. count(*) total_count,
  288. group_concat(details_sort.how_details_id) know_how_detail_id_str,
  289. group_concat(details_sort.type) knowledge_version_str
  290. from kmt_homework_wrong_question,
  291. scon_homework,
  292. kmt_exercise_questions,
  293. kmt_exercise_book_course,
  294. kmt_exercise_question_know,
  295. zyb_know_how_details_sort details_sort,
  296. zyb_know_how_details_sort how_sort
  297. where kmt_homework_wrong_question.homework_id = scon_homework.id
  298. and kmt_homework_wrong_question.question_id = kmt_exercise_questions.id
  299. and kmt_exercise_questions.book_course_id = kmt_exercise_book_course.id
  300. and kmt_homework_wrong_question.question_id = kmt_exercise_question_know.question_id
  301. and kmt_exercise_question_know.how_details_id = details_sort.how_details_id
  302. and details_sort.type = kmt_exercise_book_course.version
  303. and details_sort.stat = 2
  304. and how_sort.how_id = details_sort.how_id
  305. and how_sort.stat = 1
  306. and how_sort.grade_num = details_sort.grade_num
  307. and how_sort.semester = details_sort.semester
  308. and scon_homework.vip_id = #{vipId}
  309. <if test="subject != null and subject != ''">
  310. and scon_homework.subject = #{subject}
  311. </if>
  312. and scon_homework.create_time > #{beginDateTimeStr}
  313. and #{endDateTimeStr} > scon_homework.create_time
  314. and kmt_homework_wrong_question.is_delete = 0
  315. group by details_sort.alias)
  316. </select>
  317. <select id="findMonthHomeworkCount" resultType="com.ssj.bean.sys.homework.domain.HomeworkCount">
  318. select *
  319. from scon_homework_count
  320. where vip_id = #{vipId}
  321. and data_type = 2
  322. and homework_month = #{homeworkMonth}
  323. </select>
  324. <!--查询题目列表关联的知识点id列表-->
  325. <select id="findHowDetailIdsByQuestionIds" resultType="java.lang.String">
  326. select how_details_id from kmt_exercise_question_know where question_id in
  327. <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
  328. #{id}
  329. </foreach>
  330. group by how_details_id
  331. </select>
  332. <!--查询相似题-->
  333. <select id="findSimilarQuestionByIds" resultType="com.ssj.bean.conch.conch.dto.KmtExerciseQuestionProblemDto">
  334. select id question_id, big_question_index, question_path, num from kmt_exercise_questions where id in
  335. <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
  336. #{id}
  337. </foreach>
  338. order by num
  339. </select>
  340. <select id="countPlatformCorrectionKnowledgeMastery" resultType="java.util.Map">
  341. select scon_homework_how_details.how_detail_id,
  342. scon_homework_how_details.knowledge_version version,
  343. scon_homework_how_details.grade,
  344. scon_homework_how_details.semester,
  345. sum(ifnull(scon_homework_how_details.detail_count, 0)) wrong_count,
  346. sum(ifnull(scon_homework_how_details.total_count, 1)) total_count
  347. from scon_homework_how_details,
  348. scon_homework,
  349. zyb_know_how_details_sort
  350. where scon_homework_how_details.homework_id = scon_homework.id
  351. and scon_homework_how_details.how_detail_id = zyb_know_how_details_sort.how_details_id
  352. and scon_homework_how_details.grade = zyb_know_how_details_sort.grade
  353. and scon_homework_how_details.semester = zyb_know_how_details_sort.semester
  354. and scon_homework_how_details.knowledge_version = zyb_know_how_details_sort.type
  355. and scon_homework.vip_id = #{vipId}
  356. <if test="subject != null and subject != ''">
  357. and scon_homework.subject = #{subject}
  358. </if>
  359. and scon_homework.create_time > #{beginDateTimeStr}
  360. and #{endDateTimeStr} > scon_homework.create_time
  361. and scon_homework_how_details.wrong_question_id is null
  362. group by zyb_know_how_details_sort.alias
  363. </select>
  364. <select id="findWrongQuestion4Mastery" resultType="java.util.Map">
  365. select kmt_homework_wrong_question.question_id, kmt_homework_wrong_question.type
  366. from kmt_homework_wrong_question,
  367. scon_homework
  368. where kmt_homework_wrong_question.homework_id = scon_homework.id
  369. and scon_homework.vip_id = #{vipId}
  370. and scon_homework.subject = #{subject}
  371. and scon_homework.create_time > #{beginDateTimeStr}
  372. and #{endDateTimeStr} > scon_homework.create_time
  373. and kmt_homework_wrong_question.is_delete = 0
  374. </select>
  375. <select id="findKnowledgeByQuestionId" resultType="java.util.Map">
  376. select khds.how_details_id how_detail_id, khds.type version, khds.grade, khds.semester, khds.alias
  377. from (select how_detail_sort_id from kmt_exercise_question_know where question_id = #{questionId}) eqk,
  378. zyb_know_how_details_sort khds
  379. where eqk.how_detail_sort_id = khds.id
  380. </select>
  381. <!--查询未解析的题目-->
  382. <select id="findUnAnalysisBookCourse" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBookCourse">
  383. select distinct t1.id, t1.book_id, t1.course_name, t1.version, t1.grade,
  384. t1.semester, t1.book_name, t1.unit, t1.period, t1.unit_id,
  385. t1.period_sort, t1.unit_sort from kmt_exercise_book_course t1 left join kmt_exercise_questions t2
  386. on t1.id = t2.book_course_id where t1.analysis_user_id=#{analysisUserId} and t2.analysis_submit_type=0
  387. order by t1.unit_sort, t1.period_sort limit 0, #{maxCount}
  388. </select>
  389. <select id="findData2EsByQuestionList" resultType="java.util.Map">
  390. select k.id,
  391. k.question_id,
  392. k.how_details_id,
  393. k.how_details_kd_id,
  394. k.how_detail_sort_id,
  395. k.how_detail_kd_sort_id,
  396. k.version,
  397. date_format(k.create_time, '%Y-%m-%dT%H:%i:%s.000Z') create_time,
  398. book_id,
  399. unit_id,
  400. book_course_id,
  401. question_type,
  402. source,
  403. big_question_index,
  404. date_format(analysis_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') analysis_submit_time,
  405. page_index,
  406. image,
  407. precision_percent,
  408. auditing_user_id,
  409. handle_user_id,
  410. deal_status,
  411. remark,
  412. analysis_submit_type,
  413. answer_image,
  414. t.num,
  415. small_question_name,
  416. ifnull(parent_id, '') parent_id,
  417. big_name,
  418. real_exam_type,
  419. date_format(publish_time, '%Y-%m-%dT%H:%i:%s.000Z') publish_time,
  420. update_type,
  421. analysis_user_id,
  422. ifnull(difficulty_level, 0) difficulty_level,
  423. t.course_name,
  424. training_skill,
  425. concise_id,
  426. analysis_auditer_id,
  427. date_format(handler_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') handler_submit_time,
  428. date_format(analysis_handler_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') analysis_handler_submit_time,
  429. question_class_type,
  430. ifnull(khds.alias, '') knowledge_name,
  431. khds.course_name,
  432. khds.semester,
  433. khds.grade,
  434. date_format(t.repulse_time, '%Y-%m-%dT%H:%i:%s.000Z') repulse_time,
  435. t.question_path
  436. from (select *
  437. from kmt_exercise_question_know
  438. where question_id in
  439. <foreach collection="questionIdList" open="(" item="questionId" separator="," close=")">
  440. #{questionId}
  441. </foreach>
  442. limit 1000) k join kmt_exercise_questions t on k.question_id = t.id
  443. left join zyb_know_how_details_sort khds on k.how_detail_sort_id = khds.id
  444. </select>
  445. <select id="findAll2Es" resultType="java.util.Map">
  446. select k.id,
  447. k.question_id,
  448. k.how_details_id,
  449. k.how_details_kd_id,
  450. k.how_detail_sort_id,
  451. k.how_detail_kd_sort_id,
  452. k.version,
  453. date_format(k.create_time, '%Y-%m-%dT%H:%i:%s.000Z') create_time,
  454. book_id,
  455. unit_id,
  456. book_course_id,
  457. question_type,
  458. source,
  459. big_question_index,
  460. date_format(analysis_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') analysis_submit_time,
  461. page_index,
  462. image,
  463. precision_percent,
  464. auditing_user_id,
  465. handle_user_id,
  466. deal_status,
  467. remark,
  468. analysis_submit_type,
  469. answer_image,
  470. t.num,
  471. small_question_name,
  472. ifnull(parent_id, '') parent_id,
  473. big_name,
  474. real_exam_type,
  475. date_format(publish_time, '%Y-%m-%dT%H:%i:%s.000Z') publish_time,
  476. update_type,
  477. analysis_user_id,
  478. ifnull(difficulty_level, 0) difficulty_level,
  479. t.course_name,
  480. training_skill,
  481. concise_id,
  482. analysis_auditer_id,
  483. date_format(handler_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') handler_submit_time,
  484. date_format(analysis_handler_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') analysis_handler_submit_time,
  485. question_class_type,
  486. ifnull(khds.alias, '') knowledge_name,
  487. khds.course_name,
  488. khds.semester,
  489. khds.grade,
  490. date_format(t.repulse_time, '%Y-%m-%dT%H:%i:%s.000Z') repulse_time,
  491. t.question_path
  492. from (select * from kmt_exercise_question_know where kmt_exercise_question_know.loaded = 0 limit #{pageSize}) k
  493. join kmt_exercise_questions t on k.question_id = t.id
  494. left join zyb_know_how_details_sort khds on k.how_detail_sort_id = khds.id
  495. </select>
  496. <select id="countQuestionByKnowledgeAndVersion" resultType="java.lang.Integer">
  497. select count(distinct question_id)
  498. from kmt_exercise_question_know
  499. where how_details_id in
  500. <foreach collection="knowledgeIdList" open="(" item="knowledgeId" separator="," close=")">
  501. #{knowledgeId}
  502. </foreach>
  503. and kmt_exercise_question_know.version = #{version}
  504. </select>
  505. <!--查询未加工练习册 where eb.had_handle = 0 and eb.handle_user_id=#{handleUserId}
  506. left join kmt_exercise_questions eq on eb.id=eq.book_id
  507. where eq.deal_status in (0, 1) and eb.handle_user_id=#{handleUserId}
  508. group by eb.id
  509. -->
  510. <select id="findUnHandleBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  511. select eb.id exercise_book_id, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
  512. from kmt_exercise_book eb
  513. where eb.part_flag != 3 and eb.had_handle=0 and eb.handle_user_id=#{handleUserId}
  514. <if test="bookName != null and bookName != ''">
  515. <choose>
  516. <when test="searchType == 1">
  517. and eb.book_name = #{bookName}
  518. </when>
  519. <otherwise>
  520. and eb.book_name like concat('%',#{bookName},'%')
  521. </otherwise>
  522. </choose>
  523. </if>
  524. </select>
  525. <!--查询未分配加工人练习册-->
  526. <select id="findUndistributedHandlerBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  527. select eb.book_id id, group_concat(distinct eb.book_year order by eb.book_year asc) book_year_list, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.part_flag
  528. from kmt_exercise_book eb
  529. where eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
  530. and eb.handle_user_id is null
  531. group by eb.book_id
  532. </select>
  533. <!--查询未审核练习册 where eb.had_auditing=0 and eb.auditing_user_id=#{auditingUserId}
  534. left join kmt_exercise_questions eq on eb.id=eq.book_id
  535. where eq.deal_status in (3, 7) and eb.auditing_user_id=#{auditingUserId}
  536. group by eb.id
  537. -->
  538. <select id="findUnAuditingBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  539. select eb.id exercise_book_id, eb.book_id id,eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
  540. from kmt_exercise_book eb
  541. where eb.part_flag != 3 and eb.had_auditing=0 and eb.auditing_user_id=#{auditingUserId}
  542. <if test="bookName != null and bookName != ''">
  543. <choose>
  544. <when test="searchType == 1">
  545. and eb.book_name = #{bookName}
  546. </when>
  547. <otherwise>
  548. and eb.book_name like concat('%',#{bookName},'%')
  549. </otherwise>
  550. </choose>
  551. </if>
  552. </select>
  553. <!--查询未分配审核练习册-->
  554. <select id="findUndistributedAuditerBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  555. select eb.book_id id, group_concat(distinct eb.book_year order by eb.book_year asc) book_year_list, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.part_flag
  556. from kmt_exercise_book eb
  557. where eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
  558. and eb.auditing_user_id is null
  559. group by eb.book_id
  560. </select>
  561. <!--查询未加工解析的练习册-->
  562. <select id="findUnAnalysisHandleBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  563. select eb.id exercise_book_id, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
  564. from kmt_exercise_book eb
  565. where eb.part_flag != 3 and eb.analysis_handled=0 and eb.analysis_user_id=#{analysisUserId}
  566. <if test="bookName != null and bookName != ''">
  567. <choose>
  568. <when test="searchType == 1">
  569. and eb.book_name = #{bookName}
  570. </when>
  571. <otherwise>
  572. and eb.book_name like concat('%',#{bookName},'%')
  573. </otherwise>
  574. </choose>
  575. </if>
  576. </select>
  577. <!--查询未审核解析的练习册-->
  578. <select id="findUnAnalysisAuditingBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  579. select eb.id exercise_book_id, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
  580. from kmt_exercise_book eb
  581. where eb.part_flag != 3 and eb.analysis_audited=0 and eb.analysis_auditer_id=#{analysisAuditerId}
  582. <if test="bookName != null and bookName != ''">
  583. <choose>
  584. <when test="searchType == 1">
  585. and eb.book_name = #{bookName}
  586. </when>
  587. <otherwise>
  588. and eb.book_name like concat('%',#{bookName},'%')
  589. </otherwise>
  590. </choose>
  591. </if>
  592. </select>
  593. <select id="findUnCorrectAnswerBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  594. select eb.id exerciseBookId, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
  595. from kmt_exercise_book eb
  596. where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.answer_corrected_status = 0
  597. <if test="bookName != null and bookName != ''">
  598. <choose>
  599. <when test="searchType == 1">
  600. and eb.book_name = #{bookName}
  601. </when>
  602. <otherwise>
  603. and eb.book_name like concat('%',#{bookName},'%')
  604. </otherwise>
  605. </choose>
  606. </if>
  607. </select>
  608. <select id="findCorrectedAnswerBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  609. select eb.id exerciseBookId, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
  610. from kmt_exercise_book eb
  611. where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.proofread_status > 0
  612. <if test="bookName != null and bookName != ''">
  613. <choose>
  614. <when test="searchType == 1">
  615. and eb.book_name = #{bookName}
  616. </when>
  617. <otherwise>
  618. and eb.book_name like concat('%',#{bookName},'%')
  619. </otherwise>
  620. </choose>
  621. </if>
  622. </select>
  623. <!--查询未校对的练习册-->
  624. <select id="findExerciseBookListByIds" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  625. select eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.book_type
  626. from kmt_exercise_book eb
  627. where id in
  628. <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
  629. #{id}
  630. </foreach>
  631. </select>
  632. <!--查询所有练习册练习册-->
  633. <select id="findAllExerciseBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  634. select eb.id exercise_book_id, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type, eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
  635. from kmt_exercise_book eb
  636. where eb.part_flag != 3 and eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
  637. <if test="bookName != null and bookName != ''">
  638. <choose>
  639. <when test="searchType == 1">
  640. and eb.book_name = #{bookName}
  641. </when>
  642. <otherwise>
  643. and eb.book_name like concat('%',#{bookName},'%')
  644. </otherwise>
  645. </choose>
  646. </if>
  647. </select>
  648. <!--查询待加工审核的练习册单元 -->
  649. <select id="findUnHandleExerciseBookCourse" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  650. select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
  651. left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
  652. left join kmt_exercise_book eb on eq.exercise_book_id = eb.id
  653. where eq.exercise_book_id=#{bookId}
  654. <choose>
  655. <when test = "dealType == 1">
  656. and eq.deal_status in (0, 1) and eb.handle_user_id=#{userId}
  657. <if test="questionId != null and questionId != ''">
  658. and eq.id=#{questionId}
  659. </if>
  660. </when>
  661. <when test = "dealType == 2">
  662. and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
  663. <if test="questionId != null and questionId != ''">
  664. and eq.id=#{questionId}
  665. </if>
  666. </when>
  667. <when test = "dealType == 4">
  668. and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
  669. <if test="questionId != null and questionId != ''">
  670. and eq.id=#{questionId}
  671. </if>
  672. </when>
  673. <when test = "dealType == 5">
  674. and eq.deal_status in (9, 10) and eb.analysis_auditer_id=#{userId}
  675. <if test="questionId != null and questionId != ''">
  676. and eq.id=#{questionId}
  677. </if>
  678. </when>
  679. <when test = "dealType == 6">
  680. and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
  681. <if test="questionId != null and questionId != ''">
  682. and eq.id=#{questionId}
  683. </if>
  684. </when>
  685. <when test = "dealType == 7">
  686. and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
  687. <if test="questionId != null and questionId != ''">
  688. and eq.id=#{questionId}
  689. </if>
  690. </when>
  691. <otherwise>
  692. <if test="questionId != null and questionId != ''">
  693. and eq.id=#{questionId}
  694. </if>
  695. </otherwise>
  696. </choose>
  697. group by ebc.id
  698. order by ebc.period_sort
  699. </select>
  700. <!--查询待解析加工审核的练习册单元-->
  701. <select id="findAnalysisUnHandleExerciseBookCourse" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  702. select ebu.id, ebu.unit name, ebc.id book_course_id, ebc.period book_course from kmt_exercise_book_unit ebu
  703. left join kmt_exercise_book_course ebc on ebu.id=ebc.unit_id
  704. left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
  705. where ebu.book_id=#{bookId}
  706. <if test = "dealType == 2">
  707. and ebc.had_handle = 0
  708. </if>
  709. <if test = "dealType == 1">
  710. and ebc.had_auditing = 0
  711. </if>
  712. <if test = "dealType == 4">
  713. and eq.deal_status in (5, 8)
  714. </if>
  715. <if test = "dealType == 5">
  716. and eq.deal_status in (9, 10)
  717. </if>
  718. group by ebc.id
  719. order by ebu.num, ebc.period_sort
  720. </select>
  721. <!--查询练习册下所有单元课时-->
  722. <select id="findAllExerciseBookCourse" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  723. select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
  724. where (ebc.book_id = #{bookId} and ebc.is_common_flag = 0) or (ebc.exercise_book_id=#{exerciseBookId} and ebc.is_common_flag = 1)
  725. order by ebc.period_sort
  726. </select>
  727. <!--查询练习册下所有单元课时-->
  728. <select id="findAllExerciseBookCourseByExerciseBookId" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  729. select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
  730. where ebc.exercise_book_id=#{exerciseBookId}
  731. order by ebc.period_sort
  732. </select>
  733. <!--查询未加工/未审核的题目数量-->
  734. <select id ="findUnHandleQuestionCount" resultType="java.lang.Integer">
  735. select count(1) from kmt_exercise_questions where book_course_id=#{bookCourseId}
  736. and id not in
  737. <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
  738. #{id}
  739. </foreach>
  740. <if test = "dealType == 2">
  741. and deal_status in (3, 7)
  742. </if>
  743. <if test = "dealType == 1">
  744. and deal_status &lt; 2
  745. </if>
  746. </select>
  747. <!--查询未加工/未审核的课时数量-->
  748. <select id="findUnHandleBookCourseCount" resultType="java.lang.Integer">
  749. select count(1) from kmt_exercise_book_course where unit_id=#{unitId}
  750. and id != #{bookCourseId}
  751. <if test = "dealType == 2">
  752. and had_auditing = 0
  753. </if>
  754. <if test = "dealType == 1">
  755. and had_handle = 0
  756. </if>
  757. </select>
  758. <!--查询未加工/未审核的单元数量-->
  759. <select id="findUnHandleUnitCount" resultType="java.lang.Integer">
  760. select count(1) from kmt_exercise_book_unit where book_id=#{bookId}
  761. and id != #{unitId}
  762. <if test = "dealType == 2">
  763. and had_auditing = 0
  764. </if>
  765. <if test = "dealType == 1">
  766. and had_handle = 0
  767. </if>
  768. </select>
  769. <!--查询搜索的题目-->
  770. <select id="findKmtQuestionsById" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  771. select eq.id question_id, eq.course_name, eq.handle_user_id, eq.auditing_user_id, eq.analysis_user_id, eq.analysis_auditer_id, eq.book_course_id course_id,
  772. eq.big_question_index, eq.num small_question_index,
  773. eq.deal_status question_status, eq.create_time, eq.remark reason,
  774. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  775. eq.training_skill training_skills, parent_id, image question_image, eq.update_type
  776. from kmt_exercise_questions eq
  777. where (eq.id=#{questionId} or eq.parent_id=#{questionId}) and eq.question_class_type in (0, 2) and eq.book_id is null
  778. <choose>
  779. <when test="dealType == 1">
  780. and eq.handle_user_id = #{userId} and eq.deal_status &lt; 2
  781. </when>
  782. <when test="dealType == 2">
  783. and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
  784. </when>
  785. <otherwise>
  786. and eq.deal_status != 6
  787. </otherwise>
  788. </choose>
  789. order by eq.num
  790. </select>
  791. <!--根据知识点分页查询题目-->
  792. <select id="findKmtQuestionByDetailId" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  793. select eq.id question_id, eq.course_name, eq.handle_user_id, eq.auditing_user_id, eq.analysis_user_id, eq.analysis_auditer_id, eq.book_course_id course_id,
  794. eq.big_question_index, eq.small_question_name small_question_index,
  795. eq.deal_status question_status, eq.create_time, eq.remark reason,
  796. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  797. eq.training_skill training_skills, parent_id, image question_image
  798. from kmt_exercise_questions eq
  799. left join kmt_exercise_question_know eqk on eq.id = eqk.question_id
  800. where eqk.how_detail_sort_id = #{howDetailsId}
  801. <if test = "howDetailsKdId != null and howDetailsKdId != ''">
  802. and eqk.how_detail_kd_sort_id= #{howDetailsKdId}
  803. </if>
  804. and eq.book_id is null and (((eq.parent_id is null or eq.parent_id='') and not exists (select 1 from kmt_exercise_questions tmpeq where tmpeq.parent_id = eq.id))
  805. or (eq.parent_id is not null and eq.parent_id != ''))
  806. <choose>
  807. <when test="dealType == 1">
  808. and eq.handle_user_id = #{userId} and eq.deal_status &lt; 2
  809. </when>
  810. <when test="dealType == 2">
  811. and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
  812. </when>
  813. <otherwise>
  814. and eq.deal_status != 6
  815. </otherwise>
  816. </choose>
  817. <if test="userIdList.size() > 0">
  818. and (
  819. eq.handle_user_id in
  820. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  821. #{userId}
  822. </foreach>
  823. OR
  824. eq.auditing_user_id in
  825. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  826. #{userId}
  827. </foreach>
  828. )
  829. </if>
  830. group by eq.id
  831. order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
  832. </select>
  833. <!--根据年级,科目,版本,上下册分页查询题目-->
  834. <select id="findKmtQuestionByGradeSubjectVersionSemester" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  835. select eq.id question_id, eq.course_name, eq.handle_user_id, eq.auditing_user_id, eq.analysis_user_id, eq.analysis_auditer_id, eq.book_course_id course_id,
  836. eq.big_question_index, eq.small_question_name small_question_index,
  837. eq.deal_status question_status, eq.create_time, eq.remark reason,
  838. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  839. eq.training_skill training_skills, parent_id, image question_image
  840. from kmt_exercise_questions eq
  841. left join zyb_know_how_details_sort khds on eq.concise_id=khds.id
  842. where eq.book_id is null and eq.question_class_type in (0, 2)
  843. <if test = "grade != null and grade != ''">
  844. and khds.grade = #{grade}
  845. </if>
  846. <if test = "courseName != null and courseName != ''">
  847. and khds.course_name = #{courseName}
  848. </if>
  849. <if test = "type > 0">
  850. and khds.type = #{type}
  851. </if>
  852. <if test = "semester > 0">
  853. and khds.semester = #{semester}
  854. </if>
  855. <choose>
  856. <when test="dealType == 1">
  857. and eq.handle_user_id = #{userId} and eq.deal_status &lt; 2
  858. </when>
  859. <when test="dealType == 2">
  860. and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
  861. </when>
  862. <otherwise>
  863. and eq.deal_status != 6
  864. </otherwise>
  865. </choose>
  866. <if test="userIdList.size() > 0">
  867. and (
  868. eq.handle_user_id in
  869. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  870. #{userId}
  871. </foreach>
  872. OR
  873. eq.auditing_user_id in
  874. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  875. #{userId}
  876. </foreach>
  877. )
  878. </if>
  879. group by eq.id
  880. order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
  881. </select>
  882. <!--分页查询所有题目-->
  883. <select id="findAllKmtQuestions" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  884. select eq.id question_id, eq.course_name, eq.handle_user_id, eq.auditing_user_id, eq.analysis_user_id, eq.analysis_auditer_id, eq.book_course_id course_id,
  885. eq.big_question_index, eq.small_question_name small_question_index,
  886. eq.deal_status question_status, eq.create_time, eq.remark reason,
  887. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  888. eq.training_skill training_skills, eq.parent_id, image question_image
  889. from kmt_exercise_questions eq
  890. where eq.book_id is null and (((eq.parent_id is null or eq.parent_id='') and not exists (select 1 from kmt_exercise_questions tmpeq where tmpeq.parent_id = eq.id))
  891. or (eq.parent_id is not null and eq.parent_id != ''))
  892. <choose>
  893. <when test="dealType == 1">
  894. and eq.handle_user_id = #{userId} and eq.deal_status &lt; 2
  895. </when>
  896. <when test="dealType == 2">
  897. and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
  898. </when>
  899. <otherwise>
  900. and eq.deal_status != 6
  901. </otherwise>
  902. </choose>
  903. <if test="userIdList.size() > 0">
  904. and (
  905. eq.handle_user_id in
  906. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  907. #{userId}
  908. </foreach>
  909. OR
  910. eq.auditing_user_id in
  911. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  912. #{userId}
  913. </foreach>
  914. )
  915. </if>
  916. group by eq.id
  917. order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
  918. </select>
  919. <!--查询小题-->
  920. <select id="findSmallQuestionByParentIds" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  921. select eq.id question_id, eq.course_name, eq.handle_user_id, eq.auditing_user_id, eq.analysis_user_id, eq.analysis_auditer_id, eq.book_course_id course_id,
  922. eq.big_question_index, eq.small_question_name small_question_index,
  923. eq.deal_status question_status, eq.create_time, eq.remark reason,
  924. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  925. eq.training_skill training_skills, eq.parent_id, image question_image
  926. from kmt_exercise_questions eq
  927. where eq.parent_id in
  928. <foreach collection="parentIds" item="id" index="index" open="(" close=")" separator=",">
  929. #{id}
  930. </foreach>
  931. and eq.deal_status != 6
  932. order by eq.parent_id, eq.num
  933. </select>
  934. <!--查询大题-->
  935. <select id="findBigQuestionById" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  936. select eq.id question_id, eq.course_name, eq.handle_user_id, eq.auditing_user_id, eq.analysis_user_id, eq.analysis_auditer_id, eq.book_course_id course_id,
  937. eq.big_question_index, eq.small_question_name small_question_index,
  938. eq.deal_status question_status, eq.create_time, eq.remark reason,
  939. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  940. eq.training_skill training_skills, eq.parent_id, image question_image,eq.update_type
  941. from kmt_exercise_questions eq
  942. where eq.id = #{id}
  943. </select>
  944. <!--查询题目的知识点-->
  945. <select id="findQuestionKnowByQuestionIds" resultType="com.ssj.bean.kmt.kmt.model.QuestionListKnowModel">
  946. select eqk.question_id, hds.id how_details_id, hds.alias detail_name, hdks.id how_details_kd_id, hdks.alias kd_name,
  947. hds.grade, hds.course_name, hds.type version_type, hds.semester, khd.is_zt module_type, hs.alias how_name, hds.num, hdks.num
  948. from kmt_exercise_question_know eqk
  949. left join zyb_know_how_details_sort hds on eqk.how_detail_sort_id=hds.id
  950. left join zyb_know_how_details_sort hs on hds.how_id=hs.how_id and hds.type=hs.type and hds.semester=hs.semester and hds.grade=hs.grade and hs.stat=1
  951. left join zyb_know_how_details_sort hdks on eqk.how_detail_kd_sort_id=hdks.id
  952. left join zyb_know_how_details khd on hds.how_details_id=khd.id
  953. where question_id in
  954. <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
  955. #{id}
  956. </foreach>
  957. order by eqk.question_id, hds.num, hdks.num
  958. </select>
  959. <!--查询kmt题目的知识点-->
  960. <select id="findKmtQuestionKnowByQuestionIds" resultType="com.ssj.bean.kmt.kmt.model.QuestionListKnowModel">
  961. select eqk.question_id, hds.id how_details_id, hds.alias detail_name, hdks.id how_details_kd_id, hdks.alias kd_name,
  962. hds.grade, hds.course_name, hds.type version_type, hds.semester, khd.is_zt module_type, hs.alias how_name
  963. from kmt_quality_question_know eqk
  964. left join zyb_know_how_details_sort hds on eqk.how_detail_sort_id=hds.id
  965. left join zyb_know_how_details_sort hs on hds.how_id=hs.how_id and hds.type=hs.type and hds.semester=hs.semester and hds.grade=hs.grade and hs.stat=1
  966. left join zyb_know_how_details_sort hdks on eqk.how_detail_kd_sort_id=hdks.id
  967. left join zyb_know_how_details khd on hds.how_details_id=khd.id
  968. where question_id in
  969. <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
  970. #{id}
  971. </foreach>
  972. order by eqk.question_id, hds.num, hdks.num
  973. </select>
  974. <!--通过子题目id查询父题目-->
  975. <select id="findPrentQuestionByChildQuestionId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  976. select parent.* from kmt_exercise_questions child left join kmt_exercise_questions parent on child.parent_id=parent.id
  977. where child.id=#{questionId} and parent.id is not null
  978. </select>
  979. <!--分页查询作业批改带学校的练习册-->
  980. <select id="findHomeworkCorrectFilterBooksBySchool" resultType="com.ssj.service.sys.homework.vo.HomeworkExerciseBookDto">
  981. select eb.id book_id, eb.book_name, eb.part_flag, eb.course_name, eb.version version_type, eb.semester from kmt_exercise_book eb
  982. left join scon_homework_exercise_except hee on eb.id=hee.except_book_id
  983. and hee.school=#{school}
  984. where hee.id is null and eb.course_name=#{subject}
  985. <if test="versionType > 0">
  986. and version=#{versionType}
  987. </if>
  988. and eb.semester=#{semester} and eb.grade=#{grade}
  989. and eb.book_type in (0, 1, 3)
  990. order by eb.id
  991. </select>
  992. <!--分页查询作业批改的练习册-->
  993. <select id="findHomeworkCorrectFilterBooks" resultType="com.ssj.service.sys.homework.vo.HomeworkExerciseBookDto">
  994. select eb.id book_id, eb.book_name, eb.part_flag, eb.course_name, eb.version version_type, eb.semester from kmt_exercise_book eb where eb.course_name=#{subject}
  995. and eb.semester=#{semester} and eb.grade=#{grade}
  996. <if test="versionType > 0">
  997. and version=#{versionType}
  998. </if>
  999. and eb.book_type in (0, 1, 3)
  1000. order by eb.id
  1001. </select>
  1002. <!-- 查询练习册记录-->
  1003. <select id="findExerciseBookById" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1004. select * from kmt_exercise_book where id=#{bookId}
  1005. </select>
  1006. <select id="findExerciseBookByBookIdAndYearAndType" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1007. select id, book_id from kmt_exercise_book where book_id=#{bookId} and book_year=#{bookYear}
  1008. and book_type=#{bookType}
  1009. limit 1
  1010. </select>
  1011. <!-- 查询练习册单元课时-->
  1012. <select id="findByBookIds" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBookCourse">
  1013. select eb.id book_id, ebc.book_name, ebc.unit_id, ebc.unit, ebc.id, ebc.period, ebc.grade,
  1014. ebc.course_name, ebc.version, ebc.semester, eb.part_flag remark from kmt_exercise_book_course ebc
  1015. left join kmt_exercise_book eb on ebc.book_id=eb.book_id where eb.id in
  1016. <foreach collection="bookIds" item="id" index="index" open="(" close=")" separator=",">
  1017. #{id}
  1018. </foreach>
  1019. order by eb.id,ebc.unit_sort,ebc.period_sort limit 5000
  1020. </select>
  1021. <!-- 删除加工的知识点 -->
  1022. <delete id="deleteKmtExerciseQuestionKnowByQuestionIds">
  1023. delete from kmt_exercise_question_know where question_id in
  1024. <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
  1025. #{id}
  1026. </foreach>
  1027. </delete>
  1028. <delete id="deleteKmtExerciseBookStatusCountByExerciseBookIds">
  1029. delete from kmt_exercise_book_status_count where exercise_book_id in
  1030. <foreach collection="exerciseBookIdSet" item="id" index="index" open="(" close=")" separator=",">
  1031. #{id}
  1032. </foreach>
  1033. </delete>
  1034. <!-- 题目提交审核 -->
  1035. <update id="updateKmtExerciseQuestion2Review">
  1036. UPDATE kmt_exercise_questions set deal_status=3 WHERE id in
  1037. <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
  1038. #{id}
  1039. </foreach>
  1040. </update>
  1041. <update id="updateLoadStatus">
  1042. update kmt_exercise_question_know set loaded = 1 where loaded = 0 and id in
  1043. <foreach collection="kmtExerciseQuestionKnowIdList" open="(" item="id" separator="," close=")">
  1044. #{id}
  1045. </foreach>
  1046. </update>
  1047. <!--更新练习册为未加工-->
  1048. <update id="updateKmtExerciseBookNotHandle">
  1049. update kmt_exercise_book set had_handle=0 where id=#{id}
  1050. </update>
  1051. <!--更新练习册为未审核-->
  1052. <update id="updateKmtExerciseBookNotAuditing">
  1053. update kmt_exercise_book set had_auditing=0 where id=#{id}
  1054. </update>
  1055. <!--更新练习册为解析未加工-->
  1056. <update id="updateKmtExerciseBookAnalysisNotHandle">
  1057. update kmt_exercise_book set analysis_handled=0 where id=#{id}
  1058. </update>
  1059. <!--更新练习册为解析未审核-->
  1060. <update id="updateKmtExerciseBookAnalysisNotAuditing">
  1061. update kmt_exercise_book set analysis_audited=0 where id=#{id}
  1062. </update>
  1063. <!--更新练习册课时为未加工-->
  1064. <update id="updateKmtExerciseBookCourseNotHandle">
  1065. update kmt_exercise_book_course set had_handle=0, had_auditing=0 where id=#{id}
  1066. </update>
  1067. <!--更新练习册课时为未审核-->
  1068. <update id="updateKmtExerciseBookCourseNotAuditing">
  1069. update kmt_exercise_book_course set had_auditing=0 where id=#{id}
  1070. </update>
  1071. <update id="updateExerciseQuestionKnowEsLoadStatus">
  1072. update kmt_exercise_question_know set loaded = #{newLoaded}
  1073. where id in
  1074. <foreach collection="kmtExerciseQuestionKnowIdList" open="(" item="kmtExerciseQuestionKnowId" separator="," close=")">
  1075. #{kmtExerciseQuestionKnowId}
  1076. </foreach>
  1077. </update>
  1078. <select id="getBookId" resultType="String" parameterType="java.util.Map">
  1079. select id
  1080. from kmt_exercise_book eb
  1081. where eb.course_name = #{map.subject}
  1082. and eb.grade = #{map.grade}
  1083. and eb.semester = #{map.semester}
  1084. and eb.book_type in (0, 1, 3)
  1085. and not exists (
  1086. select 1 from scon_homework_exercise_except t1
  1087. where t1.school = #{map.school}
  1088. and t1.grade = #{map.grade}
  1089. and t1.course_name = #{map.subject}
  1090. and eb.book_id = t1.except_book_id
  1091. )
  1092. <if test='map.version != null and map.version > 0'>
  1093. and version = #{map.version}
  1094. </if>
  1095. </select>
  1096. <select id="findAllChild" resultType="com.ssj.service.conch.parents.v2.dto.TrainRecommendQuestionDTO">
  1097. select
  1098. id,
  1099. difficulty_level difficulty,
  1100. question_type optionTypeInt,
  1101. course_name,
  1102. num
  1103. from kmt_exercise_questions
  1104. where parent_id = #{parentId}
  1105. order by num
  1106. </select>
  1107. <sql id="exercisePublic" >
  1108. t.id exerciseBookId,
  1109. t.url1,
  1110. t.url2,
  1111. t.book_name bookName,
  1112. t.press,
  1113. t.course_name subject,
  1114. t.grade,
  1115. t.version,
  1116. t.version_name versionName,
  1117. t.semester,
  1118. t.print_year printYear,
  1119. t.book_year bookYear,
  1120. t.book_year useYear,
  1121. t.status,
  1122. t.org_nums orgNums,
  1123. t.progress,
  1124. t.total_grade_priority priority,
  1125. t.identified_nums identifiedNums,
  1126. t.answer_correcter_id answerCorrecterId,
  1127. t.book_type,
  1128. t.check_time checkTime,
  1129. t.ai_rollback_import aiRollbackImport,
  1130. t.updated_time,
  1131. t.assigned_batch
  1132. </sql>
  1133. <select id="findExerciseList" resultType="com.ssj.service.kmt.exercisesys.dto.Exercise1Dto" parameterType="java.util.Map">
  1134. select
  1135. <include refid="exercisePublic" />
  1136. from kmt_exercise_book t
  1137. where 1=1
  1138. <!--未校对-->
  1139. <if test='map.proofreadStatus == "0" '>
  1140. and not exists (
  1141. select 1 from kmt_exercise_book_status_count t1
  1142. where t.id = t1.exercise_book_id
  1143. and t1.data_status = 1
  1144. and t1.status > 0
  1145. and t1.status &lt; 5
  1146. )
  1147. and t.status is not null
  1148. and t.proofread_status = 0
  1149. and t.answer_correcter_id is null
  1150. and t.part_flag != 3
  1151. </if>
  1152. <if test="map.bookType != null and map.bookType != '' ">
  1153. and t.book_type = ${map.bookType}
  1154. </if>
  1155. <if test="map.progress != null and map.progress != '' ">
  1156. and t.progress = #{map.progress}
  1157. </if>
  1158. <if test="map.subject != null and map.subject != '' ">
  1159. and t.course_name = #{map.subject}
  1160. </if>
  1161. <if test="map.grade != null and map.grade != '' ">
  1162. and t.grade = #{map.grade}
  1163. </if>
  1164. <if test="map.bookName != null and map.bookName != '' ">
  1165. and t.book_name like concat('%',#{map.bookName},'%')
  1166. </if>
  1167. <if test="map.semester != null and map.semester != '' and map.semester > 0 ">
  1168. and t.semester = #{map.semester}
  1169. </if>
  1170. <if test="map.versionName != null and map.versionName != '' ">
  1171. and t.version_name = #{map.versionName}
  1172. </if>
  1173. <if test="map.bookYear != null and map.bookYear != '' ">
  1174. and t.book_year = #{map.bookYear}
  1175. </if>
  1176. order by t.updated_time desc,t.book_name
  1177. </select>
  1178. <select id="findTeacherExerciseList" resultType="com.ssj.service.kmt.exercisesys.dto.Exercise1Dto" parameterType="java.util.Map">
  1179. select
  1180. <include refid="exercisePublic" />
  1181. ,t1.name teacherName, t1.user_id, t.create_time
  1182. from kmt_exercise_book t
  1183. left join tb_lib_manager t1 on t.answer_correcter_id = t1.user_id
  1184. and t1.type = 17
  1185. and t1.authority = 8
  1186. and t1.state = 1
  1187. where 1=1
  1188. <if test="map.teacherName != null and map.teacherName != '' ">
  1189. and t1.name regexp #{map.teacherName}
  1190. </if>
  1191. <if test="map.exerciseName != null and map.exerciseName != '' ">
  1192. and t.book_name regexp #{map.exerciseName}
  1193. </if>
  1194. <if test="map.beginTime != null and map.beginTime != '' ">
  1195. and t.check_time >= #{map.beginTime}
  1196. </if>
  1197. <if test="map.endTime != null and map.endTime != '' ">
  1198. and t.check_time &lt;= #{map.endTime}
  1199. </if>
  1200. <!--校对中-->
  1201. <if test='map.type == "1" '>
  1202. and t.part_flag != 3
  1203. and t.answer_corrected_status = 0
  1204. and t.answer_correcter_id is not null
  1205. order by t1.name,t1.user_id,t.book_name
  1206. </if>
  1207. <!--已校对-->
  1208. <if test='map.type == "2" '>
  1209. and t.part_flag != 3
  1210. and t.answer_corrected_status = 1
  1211. order by t1.name,t1.user_id,t.book_name,t.create_time asc
  1212. </if>
  1213. </select>
  1214. <select id="findLastExerciseRollbackByQuestionId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionRollback">
  1215. select * from kmt_exercise_question_rollback where question_id=#{questionId} order by create_time desc limit 1
  1216. </select>
  1217. <select id="findLibList" resultType="com.ssj.bean.weixin.libmy.domain.TbLibJoin" parameterType="java.util.Map">
  1218. select t1.*
  1219. from tb_lib_join t1
  1220. where 1=1
  1221. and t1.type = 1
  1222. <if test="map.name != null and map.name != '' ">
  1223. and t1.league_name regexp #{map.name}
  1224. </if>
  1225. and exists (
  1226. select 1 from fx_merchant t2 where t1.id = t2.lib_id and t2.sign_service > 0
  1227. )
  1228. order by t1.league_name
  1229. </select>
  1230. <select id="findExerciseBookCount" resultType="com.ssj.service.kmt.exercisesys.dto.ExerciseBookCountDTO">
  1231. select status,
  1232. count(*) totalCount,
  1233. sum(if(course_name = '语文', 1, 0)) chineseCount,
  1234. sum(if(course_name = '数学', 1, 0)) mathCount,
  1235. sum(if(course_name = '英语', 1, 0)) englishCount
  1236. from kmt_exercise_book_status_count
  1237. where data_status = 1
  1238. group by status
  1239. </select>
  1240. <select id="findAllLib" resultType="java.util.Map">
  1241. select t1.lib_id libId,t3.league_lat leagueLet,t3.league_lng leagueLng,t3.league_name leagueName, ifNull(t4.sign_service,0) signService
  1242. from kmt_exercise_book_lib t1
  1243. left join kmt_exercise_book t2 on t1.exercise_book_id =t2.id and t1.is_delete=0
  1244. left join tb_lib_join t3 on t1.lib_id=t3.id
  1245. left join fx_merchant t4 on t1.lib_id=t4.lib_id
  1246. where t1.lib_id is not null and t1.lib_id !=''
  1247. <if test="subject != null and subject != '' ">
  1248. and t2.course_name=#{subject}
  1249. </if>
  1250. and t1.is_delete=0
  1251. and t4.sign_service!=0
  1252. and t4.sign_service is not null
  1253. group by libId
  1254. </select>
  1255. <select id="findAllExerciseBook" resultType="com.ssj.service.kmt.dto.exercise.KmtExerciseBookLibDto">
  1256. select distinct t1.book_id bookId, t1.book_name exerciseName,t1.version_name version,t1.total_grade_priority priority,t1.semester,t1.grade,t1.progress progress,t1.total_grade_priority totalPriority,t1.create_time createTime
  1257. from kmt_exercise_book_lib t
  1258. left join kmt_exercise_book t1 on t.exercise_book_id =t1.id
  1259. where t.lib_id=#{libId}
  1260. and t1.course_name=#{subject}
  1261. and t.is_delete=0
  1262. </select>
  1263. <select id="findAllExportLib" resultType="java.util.Map">
  1264. select distinct t1.exercise_book_id bookId, t1.lib_id libId,t3.league_lat leagueLet,t3.league_lng leagueLng,t3.league_name leagueName,ifNull(t4.sign_service,0)signService
  1265. from kmt_exercise_book_lib t1
  1266. left join kmt_exercise_book t2 on t1.exercise_book_id =t2.id
  1267. left join tb_lib_join t3 on t1.lib_id=t3.id
  1268. left join fx_merchant t4 on t1.lib_id=t4.lib_id
  1269. where t1.lib_id is not null
  1270. <if test="subject != null and subject != '' ">
  1271. and t2.course_name=#{subject}
  1272. </if>
  1273. and t1.is_delete=0
  1274. </select>
  1275. <select id="findQuestionByParentId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  1276. select * from kmt_exercise_questions where (id in
  1277. <foreach collection="parentIds" open="(" item="id" separator="," close=")">
  1278. #{id}
  1279. </foreach>or parent_id in
  1280. <foreach collection="parentIds" open="(" item="id" separator="," close=")">
  1281. #{id}
  1282. </foreach>
  1283. ) and deal_status != 6
  1284. order by num
  1285. limit 2000
  1286. </select>
  1287. <select id="findKmtExerciseQuestionRollbackListByQuestionId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionRollback">
  1288. select * from kmt_exercise_question_rollback where question_id= #{questionId} order by create_time desc
  1289. </select>
  1290. <select id="findByUserIdAndTypeIn" resultType="com.ssj.bean.weixin.libmy.domain.TbLibManager">
  1291. select * from tb_lib_manager where user_id= #{userId}
  1292. and type in(17,18) limit 1
  1293. </select>
  1294. <select id="findLibSignCount" resultType="com.ssj.service.kmt.exercisesys.dto.ExercisePriorityDto">
  1295. select t1.id id,t1.exercise_book_id exerciseBookId,t1.lib_id libId,t2.sign_service signService from kmt_exercise_book_lib t1 left join fx_merchant t2
  1296. on t1.lib_id=t2.lib_id
  1297. where t1.exercise_book_id is not null
  1298. and t1.is_delete=0
  1299. limit 10000
  1300. </select>
  1301. <select id="findExerciseQuestionByExerciseBookId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  1302. select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
  1303. eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
  1304. eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
  1305. eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
  1306. eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
  1307. eq.update_type, eq.difficulty_level, eq.training_skill, eq.course_name, eq.is_common_flag, eq.question_year, eq.exercise_book_id, eq.es_loaded,
  1308. eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time, eq.handler_submit_time,
  1309. eq.proofread_status, eq.question_path
  1310. from kmt_exercise_questions eq
  1311. left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eq.exercise_book_id=#{exerciseBookId} limit 10000
  1312. </select>
  1313. <select id="findExerciseQuestionByIds" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  1314. select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
  1315. eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
  1316. eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
  1317. eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
  1318. eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
  1319. eq.update_type, eq.difficulty_level, eq.training_skill, eq.course_name, eq.is_common_flag, eq.question_year, eq.exercise_book_id, eq.es_loaded,
  1320. eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time, eq.handler_submit_time,
  1321. eq.proofread_status, eq.question_path
  1322. from kmt_exercise_questions eq
  1323. left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eq.id in
  1324. <foreach collection="ids" open="(" item="id" separator="," close=")">
  1325. #{id}
  1326. </foreach>
  1327. limit 10000
  1328. </select>
  1329. <!--更新练习册涉及到的机构签约数-->
  1330. <update id="updateKmtExerciseBookByExerciseBookId">
  1331. update kmt_exercise_book set exercise_relevancy_num=#{exerciseRelevancyNum} where id=#{exerciseBooId}
  1332. </update>
  1333. <select id="findAllExerciseBookBySignNum" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1334. select * from kmt_exercise_book
  1335. where
  1336. exercise_relevancy_num !=0
  1337. and exercise_relevancy_num is not null
  1338. order by exercise_relevancy_num desc
  1339. limit 10000
  1340. </select>
  1341. <select id="findAnswerProofreadExerciseBookList"
  1342. resultType="com.ssj.service.kmt.exercisesys.dto.AnswerProofreadExerciseBookDTO">
  1343. select distinct t1.id exerciseBookId,
  1344. t1.book_name,
  1345. t1.course_name subject,
  1346. t1.grade,
  1347. t1.version,
  1348. t1.semester,
  1349. t1.proofread_status,
  1350. t1.book_type,
  1351. t1.latest_answer_wrong_date_time proofreadDate,
  1352. t3.name
  1353. from kmt_exercise_book t1 left join tb_lib_manager t3
  1354. on t1.answer_correcter_id=t3.user_id
  1355. and t3.type=17 and t3.authority=8 and t3.state=1
  1356. where t1.proofread_status in (2, 3)
  1357. <if test="req.subject != null and req.subject != ''">
  1358. and t1.course_name = #{req.subject}
  1359. </if>
  1360. <if test="req.grade != null and req.grade != ''">
  1361. and t1.grade = #{req.grade}
  1362. </if>
  1363. <if test="req.bookName != null and req.bookName != ''">
  1364. and t1.book_name like concat('%',#{req.bookName},'%')
  1365. </if>
  1366. <if test="req.proofreadDate != null and req.proofreadDate != ''">
  1367. and date(t1.latest_answer_wrong_date_time) = #{req.proofreadDate}
  1368. </if>
  1369. order by t1.proofread_status
  1370. </select>
  1371. <select id="findQuestionListAnswerWrong" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  1372. select eq.id question_id, eq.course_name, eq.handle_user_id, eq.auditing_user_id, eq.analysis_user_id,
  1373. eq.analysis_auditer_id, eq.book_course_id course_id, eq.big_question_index,
  1374. eq.small_question_name small_question_index,
  1375. eq.deal_status question_status, eq.create_time, eq.remark reason, eq.question_type question_types,
  1376. eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  1377. eq.training_skill training_skills, eq.parent_id, eq.question_path,eq.num
  1378. from kmt_exercise_questions eq
  1379. where eq.exercise_book_id = #{req.exerciseBookId}
  1380. and eq.book_course_id = #{req.periodId}
  1381. and eq.proofread_status = 2
  1382. order by eq.num, eq.create_time
  1383. </select>
  1384. <select id="findRepulsedQuestion" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  1385. select eq.id question_id,
  1386. eq.course_name,
  1387. eb.handle_user_id,
  1388. eb.auditing_user_id,
  1389. eb.analysis_user_id,
  1390. eb.analysis_auditer_id,
  1391. eq.book_course_id course_id,
  1392. eq.big_question_index,
  1393. eq.small_question_name small_question_index,
  1394. eq.deal_status question_status,
  1395. eq.create_time,
  1396. eq.remark reason,
  1397. eq.from_user_id,
  1398. eq.to_user_id,
  1399. eq.question_type question_types,
  1400. eq.difficulty_level difficulty_levels,
  1401. eq.real_exam_type real_exam_types,
  1402. eq.training_skill training_skills,
  1403. eq.parent_id,
  1404. eq.question_path,
  1405. eq.num
  1406. from kmt_exercise_questions eq
  1407. left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
  1408. where eq.exercise_book_id = #{req.exerciseBookId}
  1409. and eq.deal_status in
  1410. <foreach collection="dealStatusList" open="(" item="dealStatus" separator="," close=")">
  1411. #{dealStatus}
  1412. </foreach>
  1413. order by eq.num, eq.create_time, eq.deal_status
  1414. limit 0, 5000
  1415. </select>
  1416. <update id="updateKmtExerciseBookById">
  1417. update kmt_exercise_book set priority=#{priority} where id=#{id}
  1418. </update>
  1419. <update id="updateKmtExerciseBookByPriority">
  1420. update kmt_exercise_book set total_grade_priority=#{totalGradePriority} where id=#{id}
  1421. </update>
  1422. <select id="findUnproofreadExerciseId" resultType="java.util.Map">
  1423. select id from kmt_exercise_book eb where eb.answer_correcter_id is not null
  1424. </select>
  1425. <select id="findExerciseStatusByBookId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  1426. select eq.* from kmt_exercise_questions eq left kmt_exercise_book eb on eq.exercise_book_id=eb.id where eb.answer_correcter_id is not null and eq.book_id=#{bookId}
  1427. </select>
  1428. <update id="updateExerciseBookStatusByIdAndStatus">
  1429. update kmt_exercise_book set proofread_status=#{proofreadStatus} where id=#{id}
  1430. </update>
  1431. <update id="updateExerciseBookProofreadResult">
  1432. update kmt_exercise_book set proofread_status=#{type}, latest_answer_wrong_date_time = now() where id=#{exerciseBookId}
  1433. </update>
  1434. <select id="countAnswerWrongQuestion" resultType="java.lang.Integer">
  1435. select count(*) from kmt_exercise_questions where exercise_book_id = #{exerciseBookId} and proofread_status = 2 and deal_status not in (2, 6)
  1436. and id not in
  1437. <foreach collection="excludeQuestionIdSet" open="(" item="id" close=")" separator=",">
  1438. #{id}
  1439. </foreach>
  1440. </select>
  1441. <select id="teacherAnswerProofreadDetail" resultType="java.util.Map">
  1442. select count(1) total,sum(answer_corrected_status) finishedNums
  1443. from kmt_exercise_book
  1444. where answer_correcter_id = #{userId}
  1445. </select>
  1446. <select id="findUnitAndPeriodList" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  1447. select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course
  1448. from kmt_exercise_book_course ebc
  1449. where ebc.id in (select distinct book_course_id
  1450. from kmt_exercise_questions
  1451. where exercise_book_id = #{request.exerciseBookId} and proofread_status = 2)
  1452. </select>
  1453. <select id="findKmtExerciseQuestionErrorsByQuestionIds" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionErrors">
  1454. select * from kmt_exercise_question_errors where question_id in
  1455. <foreach collection="questionIds" open="(" item="id" close=")" separator=",">
  1456. #{id}
  1457. </foreach>
  1458. and error_user_auth=#{beType}
  1459. </select>
  1460. <select id="findKmtExerciseQuestionByErrorUserId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionErrors">
  1461. select * from kmt_exercise_question_errors where error_user_id=#{userId} order by create_time desc
  1462. </select>
  1463. <select id="countQuestionErrorCountByExerciseBookId" resultType="java.lang.Integer">
  1464. select count(1) from kmt_exercise_question_errors where exercise_book_id=#{exerciseBookId}
  1465. and error_user_id=#{userId} and error_user_auth=#{type}
  1466. </select>
  1467. <select id="findSameExerciseBookList" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1468. SELECT t.*
  1469. FROM kmt_exercise_book t,
  1470. (select book_name,
  1471. course_name,
  1472. grade,
  1473. version_name,
  1474. semester,
  1475. book_type,
  1476. book_year,
  1477. COUNT(book_name) c1,
  1478. COUNT(course_name) c2,
  1479. COUNT(grade) c3,
  1480. COUNT(version_name) c4,
  1481. COUNT(semester) c5,
  1482. COUNT(book_type) c6,
  1483. COUNT(book_year) c7
  1484. from kmt_exercise_book
  1485. group by book_name, course_name, grade, version_name, semester, book_type, book_year
  1486. HAVING c1 > 1
  1487. and c2 > 1
  1488. and c3 > 1
  1489. and c4 > 1
  1490. and c5 > 1
  1491. and c6 > 1
  1492. and c7 > 1) t1
  1493. where t.book_name = t1.book_name
  1494. and t.course_name = t1.course_name
  1495. and t.grade = t1.grade
  1496. and t.version_name = t1.version_name
  1497. and t.semester = t1.semester
  1498. and t.book_type = t1.book_type
  1499. and t.book_year = t1.book_year
  1500. order by t.book_name, t.course_name, t.grade, t.version_name, t.semester, t.book_type, t.book_year, t.part_flag
  1501. </select>
  1502. <select id="countUnFinishQuestionsByExerciseBookId" resultType="java.lang.Integer">
  1503. select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
  1504. <if test="type == 1">
  1505. and deal_status in (0, 1)
  1506. </if>
  1507. <if test="type == 2">
  1508. and deal_status in (3, 7)
  1509. </if>
  1510. <if test="type == 3">
  1511. and deal_status in (5, 8)
  1512. </if>
  1513. <if test="type == 4">
  1514. and deal_status in (9, 10)
  1515. </if>
  1516. </select>
  1517. <select id="findDistributionCount"
  1518. resultType="com.ssj.service.kmt.exercisesys.dto.ExerciseDistributionCountDTO">
  1519. select sum(if(handle_user_id is null or auditing_user_id is null or analysis_user_id is null or
  1520. analysis_auditer_id is null, 1, 0)) notDistributedExerciseBookCount,
  1521. count(*) totalExerciseBookCount
  1522. from kmt_exercise_book
  1523. where part_flag &lt;> 3
  1524. </select>
  1525. <select id="findDistributionExerciseBookList" resultMap="DistributionExerciseBookDTOResultMap">
  1526. select eb.exerciseBookId,
  1527. eb.importDate,
  1528. eb.subject,
  1529. eb.grade,
  1530. eb.version_name,
  1531. eb.semester,
  1532. eb.book_name,
  1533. eb.book_type,
  1534. eb.assigned_batch,
  1535. (select count(distinct unit_id)
  1536. from kmt_exercise_book_course ebc
  1537. where ebc.exercise_book_id = eb.exerciseBookId) unitNum,
  1538. (select count(*)
  1539. from kmt_exercise_book_course ebc
  1540. where ebc.exercise_book_id = eb.exerciseBookId) courseNum,
  1541. ebcHandle.accuracy intHandleAccuracy,
  1542. ebcHandleAudit.accuracy intHandleAuditAccuracy,
  1543. ebcAnalysis.accuracy intAnalysisAccuracy,
  1544. ebtrHandle.teacher_id handlerTeacherId,
  1545. ebtrHandle.teacher_name handlerName,
  1546. ebtrHandle.salary_given handlerSalaryGiven,
  1547. ebtrHandle.salary_given_time handlerSalaryGivenTime,
  1548. ebtrHandle.create_time handlerDistributeTime,
  1549. ebtrHandleAudit.teacher_id handlerAuditUserTeacherId,
  1550. ebtrHandleAudit.teacher_name handlerAuditUserName,
  1551. ebtrHandleAudit.salary_given handlerAuditUserSalaryGiven,
  1552. ebtrHandleAudit.salary_given_time handlerAuditUserSalaryGivenTime,
  1553. ebtrHandleAudit.create_time handlerAuditUserDistributeTime,
  1554. ebtrAnalysis.teacher_id analyserTeacherId,
  1555. ebtrAnalysis.teacher_name analyserName,
  1556. ebtrAnalysis.salary_given analyserSalaryGiven,
  1557. ebtrAnalysis.salary_given_time analyserSalaryGivenTime,
  1558. ebtrAnalysis.create_time analyserDistributeTime,
  1559. ebtrAnalysisAudit.teacher_id analysisAuditUserTeacherId,
  1560. ebtrAnalysisAudit.teacher_name analysisAuditUserName,
  1561. ebtrAnalysisAudit.salary_given analysisAuditUserSalaryGiven,
  1562. ebtrAnalysisAudit.salary_given_time analysisAuditUserSalaryGivenTime,
  1563. ebtrAnalysisAudit.create_time analysisAuditUserDistributeTime
  1564. from (select id exerciseBookId,
  1565. create_time importDate,
  1566. course_name subject,
  1567. grade,
  1568. version_name,
  1569. semester,
  1570. book_name,
  1571. book_type,
  1572. handle_user_id,
  1573. auditing_user_id,
  1574. analysis_user_id,
  1575. analysis_auditer_id,
  1576. assigned_batch
  1577. from kmt_exercise_book
  1578. where (3 > part_flag or part_flag > 3)
  1579. <if test="req.type == 1">
  1580. and (
  1581. <choose>
  1582. <when test="(req.handler != null and req.handler > 0) or
  1583. (req.handleAuditUser != null and req.handleAuditUser > 0) or
  1584. (req.analyser != null and req.analyser > 0) or
  1585. (req.analysisAuditUser != null and req.analysisAuditUser > 0)">
  1586. <if test="req.handler != null and req.handler > 0">
  1587. handle_user_id is null and
  1588. </if>
  1589. <if test="req.handleAuditUser != null and req.handleAuditUser > 0">
  1590. auditing_user_id is null and
  1591. </if>
  1592. <if test="req.analyser != null and req.analyser > 0">
  1593. analysis_user_id is null and
  1594. </if>
  1595. <if test="req.analysisAuditUser != null and req.analysisAuditUser > 0">
  1596. analysis_auditer_id is null and
  1597. </if>
  1598. 1 = 1
  1599. </when>
  1600. <otherwise>
  1601. handle_user_id is null
  1602. or auditing_user_id is null
  1603. or analysis_user_id is null
  1604. or analysis_auditer_id is null
  1605. </otherwise>
  1606. </choose>
  1607. )
  1608. </if>
  1609. <if test="req.type == 2">
  1610. and (handle_user_id is not null
  1611. and auditing_user_id is not null
  1612. and analysis_user_id is not null
  1613. and analysis_auditer_id is not null)
  1614. </if>
  1615. <if test="req.bookName != null and req.bookName != ''">
  1616. and book_name like '%${req.bookName}%'
  1617. </if>
  1618. <if test="req.subject != null and req.subject != ''">
  1619. and course_name = #{req.subject}
  1620. </if>
  1621. <if test="req.grade != null and req.grade != ''">
  1622. and grade = #{req.grade}
  1623. </if>
  1624. <if test="req.version != null and req.version > 0">
  1625. and version = #{req.version}
  1626. </if>
  1627. <if test="req.semester != null and req.semester > 0">
  1628. and semester = #{req.semester}
  1629. </if>
  1630. <if test="req.bookType != null and req.bookType > -1">
  1631. and book_type = #{req.bookType}
  1632. </if>
  1633. <if test="req.startTime != null and req.startTime != ''">
  1634. and create_time > #{req.startTime}
  1635. </if>
  1636. <if test="req.endTime != null and req.endTime != ''">
  1637. and '${req.endTime} 23:59:59' > create_time
  1638. </if>
  1639. order by create_time desc
  1640. limit #{offset}, #{pageSize}) eb
  1641. left join kmt_exercise_book_teacher_record ebtrHandle
  1642. on eb.exerciseBookId = ebtrHandle.exercise_book_id and ebtrHandle.authority_type = 1
  1643. left join kmt_exercise_book_count ebcHandle
  1644. on eb.exerciseBookId = ebcHandle.exercise_book_id and ebcHandle.type = 1
  1645. left join kmt_exercise_book_teacher_record ebtrHandleAudit
  1646. on eb.exerciseBookId = ebtrHandleAudit.exercise_book_id and ebtrHandleAudit.authority_type = 2
  1647. left join kmt_exercise_book_count ebcHandleAudit
  1648. on eb.exerciseBookId = ebcHandleAudit.exercise_book_id and ebcHandleAudit.type = 2
  1649. left join kmt_exercise_book_teacher_record ebtrAnalysis
  1650. on eb.exerciseBookId = ebtrAnalysis.exercise_book_id and ebtrAnalysis.authority_type = 3
  1651. left join kmt_exercise_book_count ebcAnalysis
  1652. on eb.exerciseBookId = ebcAnalysis.exercise_book_id and ebcAnalysis.type = 3
  1653. left join kmt_exercise_book_teacher_record ebtrAnalysisAudit
  1654. on eb.exerciseBookId = ebtrAnalysisAudit.exercise_book_id and ebtrAnalysisAudit.authority_type = 4
  1655. left join kmt_exercise_book_count ebcAnalysisAudit
  1656. on eb.exerciseBookId = ebcAnalysisAudit.exercise_book_id and ebcAnalysisAudit.type = 4
  1657. order by eb.importDate desc
  1658. </select>
  1659. <select id="countDistributionExerciseBook" resultType="java.lang.Integer">
  1660. select count(*)
  1661. from kmt_exercise_book
  1662. where part_flag &lt;> 3
  1663. <if test="req.type == 1">
  1664. and (
  1665. <choose>
  1666. <when test="(req.handler != null and req.handler > 0) or
  1667. (req.handleAuditUser != null and req.handleAuditUser > 0) or
  1668. (req.analyser != null and req.analyser > 0) or
  1669. (req.analysisAuditUser != null and req.analysisAuditUser > 0)">
  1670. <if test="req.handler != null and req.handler > 0">
  1671. handle_user_id is null and
  1672. </if>
  1673. <if test="req.handleAuditUser != null and req.handleAuditUser > 0">
  1674. auditing_user_id is null and
  1675. </if>
  1676. <if test="req.analyser != null and req.analyser > 0">
  1677. analysis_user_id is null and
  1678. </if>
  1679. <if test="req.analysisAuditUser != null and req.analysisAuditUser > 0">
  1680. analysis_auditer_id is null and
  1681. </if>
  1682. 1 = 1
  1683. </when>
  1684. <otherwise>
  1685. handle_user_id is null
  1686. or auditing_user_id is null
  1687. or analysis_user_id is null
  1688. or analysis_auditer_id is null
  1689. </otherwise>
  1690. </choose>
  1691. )
  1692. </if>
  1693. <if test="req.type == 2">
  1694. and (handle_user_id is not null
  1695. and auditing_user_id is not null
  1696. and analysis_user_id is not null
  1697. and analysis_auditer_id is not null)
  1698. </if>
  1699. <if test="req.bookName != null and req.bookName != ''">
  1700. and book_name like '%${req.bookName}%'
  1701. </if>
  1702. <if test="req.subject != null and req.subject != ''">
  1703. and course_name = #{req.subject}
  1704. </if>
  1705. <if test="req.grade != null and req.grade != ''">
  1706. and grade = #{req.grade}
  1707. </if>
  1708. <if test="req.version != null and req.version > 0">
  1709. and version = #{req.version}
  1710. </if>
  1711. <if test="req.semester != null and req.semester > 0">
  1712. and semester = #{req.semester}
  1713. </if>
  1714. <if test="req.bookType != null and req.bookType > -1">
  1715. and book_type = #{req.bookType}
  1716. </if>
  1717. <if test="req.startTime != null and req.startTime != ''">
  1718. and create_time > #{req.startTime}
  1719. </if>
  1720. <if test="req.endTime != null and req.endTime != ''">
  1721. and '${req.endTime} 23:59:59' > create_time
  1722. </if>
  1723. </select>
  1724. <update id="updateAnswerCorrecterIdByIds">
  1725. update kmt_exercise_book set answer_correcter_id = #{teacherId}
  1726. where id in
  1727. <foreach collection="exerciseBookIds" open="(" item="exerciseBookId" separator="," close=")">
  1728. #{exerciseBookId}
  1729. </foreach>
  1730. </update>
  1731. <update id="updateAnswerCorrecterIdByExerciseBookIds">
  1732. update kmt_exercise_questions set answer_correcter_id = #{teacherId}
  1733. where exercise_book_id in
  1734. <foreach collection="exerciseBookIds" open="(" item="exerciseBookId" separator="," close=")">
  1735. #{exerciseBookId}
  1736. </foreach>
  1737. </update>
  1738. <select id="findExportDistributionExerciseBookList" resultType="com.ssj.service.kmt.exercisesys.dto.ExportDistributionExerciseBookDTO">
  1739. select ebdc.*, eb.assigned_batch
  1740. from kmt_exercise_book_distribution_count ebdc join kmt_exercise_book eb on ebdc.exercise_book_id=eb.id
  1741. <where>
  1742. <if test="req.startTime != null and req.startTime != ''">
  1743. and ebdc.import_date > #{req.startTime}
  1744. </if>
  1745. <if test="req.endTime != null and req.endTime != ''">
  1746. and '${req.endTime} 23:59:59' > ebdc.import_date
  1747. </if>
  1748. </where>
  1749. order by ebdc.import_date desc
  1750. limit #{offset}
  1751. </select>
  1752. <select id="findDistributionTeacher"
  1753. resultType="com.ssj.service.kmt.exercisesys.dto.DistributionTeacherDTO">
  1754. select teacher_id,
  1755. teacher_name,
  1756. salary_given,
  1757. salary_given_time
  1758. <if test="authorityType == 1">
  1759. , (select max(handler_submit_time)
  1760. from kmt_exercise_questions eq
  1761. where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 0) lastSubmitTime
  1762. </if>
  1763. <if test="authorityType == 2">
  1764. , (select max(publish_time)
  1765. from kmt_exercise_questions eq
  1766. where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 3) lastSubmitTime
  1767. </if>
  1768. <if test="authorityType == 3">
  1769. , (select max(analysis_handler_submit_time)
  1770. from kmt_exercise_questions eq
  1771. where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 5) lastSubmitTime
  1772. </if>
  1773. <if test="authorityType == 4">
  1774. , (select max(analysis_submit_time)
  1775. from kmt_exercise_questions eq
  1776. where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status = 11) lastSubmitTime
  1777. </if>
  1778. from kmt_exercise_book_teacher_record
  1779. where exercise_book_id = #{exerciseBookId}
  1780. and teacher_id = #{userId}
  1781. and authority_type = #{authorityType}
  1782. order by create_time desc
  1783. limit 1
  1784. </select>
  1785. <select id="findAllExerciseBookPage" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1786. select * from kmt_exercise_book
  1787. where part_flag &lt;> 3
  1788. <if test="selectedExerciseBookIdList != null and selectedExerciseBookIdList.size > 0">
  1789. and id in
  1790. <foreach collection="selectedExerciseBookIdList" open="(" item="selectedExerciseBookId" separator="," close=")">
  1791. #{selectedExerciseBookId}
  1792. </foreach>
  1793. </if>
  1794. limit #{offset}, #{pageSize}
  1795. </select>
  1796. <select id="countNotCheckAnswerCount" resultType="java.lang.Integer">
  1797. select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
  1798. and deal_status != 2 and proofread_status = 0
  1799. </select>
  1800. <select id="countAllNotCheckAnswerCount" resultType="java.lang.Integer">
  1801. select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
  1802. and proofread_status = 0
  1803. </select>
  1804. <select id="findExerciseBooksByBookId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1805. select * from kmt_exercise_book where book_id=#{bookId}
  1806. </select>
  1807. <select id="findExerciseTeacherByExerciseBookIdsAndAuthType" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBookTeacherRecord">
  1808. select * from kmt_exercise_book_teacher_record where exercise_book_id in
  1809. <foreach collection="exerciseBookIds" open="(" item="id" separator="," close=")">
  1810. #{id}
  1811. </foreach>
  1812. and authority_type = #{authType}
  1813. </select>
  1814. <select id="findBookCountByExerciseBookIdAndType" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBookCount">
  1815. select * from kmt_exercise_book_count where exercise_book_id=#{exerciseBookId} and type=#{type} limit 1
  1816. </select>
  1817. <update id="updateKmtExerciseBookCountById">
  1818. UPDATE kmt_exercise_book_count set accuracy=#{accuracy} WHERE id = #{bookCountId}
  1819. </update>
  1820. <select id="findAllDistinctLibBySubject" resultType="java.util.Map">
  1821. SELECT DISTINCT lib_id FROM
  1822. kmt_exercise_book_lib t
  1823. LEFT JOIN kmt_exercise_book t1 ON t.exercise_book_id = t1.id
  1824. WHERE
  1825. t.is_delete = 0
  1826. and t.lib_id is not null
  1827. AND t1.course_name = #{subjct}
  1828. </select>
  1829. <select id="findSignService" resultType="com.ssj.bean.sys.fx.domain.Merchant">
  1830. select * from fx_merchant where lib_id=#{libId} and sign_service is not null limit 1
  1831. </select>
  1832. <select id="findExerciseBookByQuestionId" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  1833. select eb.id exercise_book_id, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type,
  1834. eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
  1835. from kmt_exercise_book eb, kmt_exercise_questions eq
  1836. where eb.id=eq.exercise_book_id and eq.id=#{questionId} and eb.part_flag != 3
  1837. </select>
  1838. </mapper>