KmtExerciseMapper.xml 92 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883
  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. and eb.book_name like concat('%',#{bookName},'%')
  516. </if>
  517. </select>
  518. <!--查询未分配加工人练习册-->
  519. <select id="findUndistributedHandlerBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  520. 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
  521. from kmt_exercise_book eb
  522. where eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
  523. and eb.handle_user_id is null
  524. group by eb.book_id
  525. </select>
  526. <!--查询未审核练习册 where eb.had_auditing=0 and eb.auditing_user_id=#{auditingUserId}
  527. left join kmt_exercise_questions eq on eb.id=eq.book_id
  528. where eq.deal_status in (3, 7) and eb.auditing_user_id=#{auditingUserId}
  529. group by eb.id
  530. -->
  531. <select id="findUnAuditingBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  532. 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
  533. from kmt_exercise_book eb
  534. where eb.part_flag != 3 and eb.had_auditing=0 and eb.auditing_user_id=#{auditingUserId}
  535. <if test="bookName != null and bookName != ''">
  536. and eb.book_name like concat('%',#{bookName},'%')
  537. </if>
  538. </select>
  539. <!--查询未分配审核练习册-->
  540. <select id="findUndistributedAuditerBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  541. 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
  542. from kmt_exercise_book eb
  543. where eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
  544. and eb.auditing_user_id is null
  545. group by eb.book_id
  546. </select>
  547. <!--查询未加工解析的练习册-->
  548. <select id="findUnAnalysisHandleBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  549. 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
  550. from kmt_exercise_book eb
  551. where eb.part_flag != 3 and eb.analysis_handled=0 and eb.analysis_user_id=#{analysisUserId}
  552. <if test="bookName != null and bookName != ''">
  553. and eb.book_name like concat('%',#{bookName},'%')
  554. </if>
  555. </select>
  556. <!--查询未审核解析的练习册-->
  557. <select id="findUnAnalysisAuditingBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  558. 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
  559. from kmt_exercise_book eb
  560. where eb.part_flag != 3 and eb.analysis_audited=0 and eb.analysis_auditer_id=#{analysisAuditerId}
  561. <if test="bookName != null and bookName != ''">
  562. and eb.book_name like concat('%',#{bookName},'%')
  563. </if>
  564. </select>
  565. <select id="findUnCorrectAnswerBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  566. 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
  567. from kmt_exercise_book eb
  568. where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.answer_corrected_status = 0
  569. <if test="bookName != null and bookName != ''">
  570. and eb.book_name like concat('%',#{bookName},'%')
  571. </if>
  572. </select>
  573. <select id="findCorrectedAnswerBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  574. 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
  575. from kmt_exercise_book eb
  576. where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.proofread_status > 0
  577. <if test="bookName != null and bookName != ''">
  578. and eb.book_name like concat('%',#{bookName},'%')
  579. </if>
  580. </select>
  581. <!--查询未校对的练习册-->
  582. <select id="findExerciseBookListByIds" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  583. 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
  584. from kmt_exercise_book eb
  585. where id in
  586. <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
  587. #{id}
  588. </foreach>
  589. </select>
  590. <!--查询所有练习册练习册-->
  591. <select id="findAllExerciseBooks" resultType="com.ssj.service.kmt.dto.ExerciseBookDto">
  592. 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
  593. from kmt_exercise_book eb
  594. where eb.part_flag != 3 and eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
  595. <if test="bookName != null and bookName != ''">
  596. and eb.book_name like concat('%',#{bookName},'%')
  597. </if>
  598. </select>
  599. <!--查询待加工审核的练习册单元 -->
  600. <select id="findUnHandleExerciseBookCourse" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  601. 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
  602. left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
  603. left join kmt_exercise_book eb on eq.exercise_book_id = eb.id
  604. where eq.exercise_book_id=#{bookId}
  605. <if test = "dealType == 1">
  606. and eq.deal_status in (0, 1) and eb.handle_user_id=#{userId}
  607. </if>
  608. <if test = "dealType == 2">
  609. and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
  610. </if>
  611. <if test = "dealType == 4">
  612. and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
  613. </if>
  614. <if test = "dealType == 5">
  615. and eq.deal_status in (9, 10) and eb.analysis_auditer_id=#{userId}
  616. </if>
  617. <if test = "dealType == 6">
  618. and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
  619. </if>
  620. <if test = "dealType == 7">
  621. and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
  622. </if>
  623. group by ebc.id
  624. order by ebc.period_sort
  625. </select>
  626. <!--查询待解析加工审核的练习册单元-->
  627. <select id="findAnalysisUnHandleExerciseBookCourse" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  628. select ebu.id, ebu.unit name, ebc.id book_course_id, ebc.period book_course from kmt_exercise_book_unit ebu
  629. left join kmt_exercise_book_course ebc on ebu.id=ebc.unit_id
  630. left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
  631. where ebu.book_id=#{bookId}
  632. <if test = "dealType == 2">
  633. and ebc.had_handle = 0
  634. </if>
  635. <if test = "dealType == 1">
  636. and ebc.had_auditing = 0
  637. </if>
  638. <if test = "dealType == 4">
  639. and eq.deal_status in (5, 8)
  640. </if>
  641. <if test = "dealType == 5">
  642. and eq.deal_status in (9, 10)
  643. </if>
  644. group by ebc.id
  645. order by ebu.num, ebc.period_sort
  646. </select>
  647. <!--查询练习册下所有单元课时-->
  648. <select id="findAllExerciseBookCourse" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  649. 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
  650. where (ebc.book_id = #{bookId} and ebc.is_common_flag = 0) or (ebc.exercise_book_id=#{exerciseBookId} and ebc.is_common_flag = 1)
  651. order by ebc.period_sort
  652. </select>
  653. <!--查询练习册下所有单元课时-->
  654. <select id="findAllExerciseBookCourseByExerciseBookId" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  655. 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
  656. where ebc.exercise_book_id=#{exerciseBookId}
  657. order by ebc.period_sort
  658. </select>
  659. <!--查询未加工/未审核的题目数量-->
  660. <select id ="findUnHandleQuestionCount" resultType="java.lang.Integer">
  661. select count(1) from kmt_exercise_questions where book_course_id=#{bookCourseId}
  662. and id not in
  663. <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
  664. #{id}
  665. </foreach>
  666. <if test = "dealType == 2">
  667. and deal_status in (3, 7)
  668. </if>
  669. <if test = "dealType == 1">
  670. and deal_status &lt; 2
  671. </if>
  672. </select>
  673. <!--查询未加工/未审核的课时数量-->
  674. <select id="findUnHandleBookCourseCount" resultType="java.lang.Integer">
  675. select count(1) from kmt_exercise_book_course where unit_id=#{unitId}
  676. and id != #{bookCourseId}
  677. <if test = "dealType == 2">
  678. and had_auditing = 0
  679. </if>
  680. <if test = "dealType == 1">
  681. and had_handle = 0
  682. </if>
  683. </select>
  684. <!--查询未加工/未审核的单元数量-->
  685. <select id="findUnHandleUnitCount" resultType="java.lang.Integer">
  686. select count(1) from kmt_exercise_book_unit where book_id=#{bookId}
  687. and id != #{unitId}
  688. <if test = "dealType == 2">
  689. and had_auditing = 0
  690. </if>
  691. <if test = "dealType == 1">
  692. and had_handle = 0
  693. </if>
  694. </select>
  695. <!--查询搜索的题目-->
  696. <select id="findKmtQuestionsById" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  697. 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,
  698. eq.big_question_index, eq.num small_question_index,
  699. eq.deal_status question_status, eq.create_time, eq.remark reason,
  700. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  701. eq.training_skill training_skills, parent_id, image question_image, eq.update_type
  702. from kmt_exercise_questions eq
  703. where (eq.id=#{questionId} or eq.parent_id=#{questionId}) and eq.question_class_type in (0, 2) and eq.book_id is null
  704. <choose>
  705. <when test="dealType == 1">
  706. and eq.handle_user_id = #{userId} and eq.deal_status &lt; 2
  707. </when>
  708. <when test="dealType == 2">
  709. and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
  710. </when>
  711. <otherwise>
  712. and eq.deal_status != 6
  713. </otherwise>
  714. </choose>
  715. order by eq.num
  716. </select>
  717. <!--根据知识点分页查询题目-->
  718. <select id="findKmtQuestionByDetailId" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  719. 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,
  720. eq.big_question_index, eq.small_question_name small_question_index,
  721. eq.deal_status question_status, eq.create_time, eq.remark reason,
  722. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  723. eq.training_skill training_skills, parent_id, image question_image
  724. from kmt_exercise_questions eq
  725. left join kmt_exercise_question_know eqk on eq.id = eqk.question_id
  726. where eqk.how_detail_sort_id = #{howDetailsId}
  727. <if test = "howDetailsKdId != null and howDetailsKdId != ''">
  728. and eqk.how_detail_kd_sort_id= #{howDetailsKdId}
  729. </if>
  730. 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))
  731. or (eq.parent_id is not null and eq.parent_id != ''))
  732. <choose>
  733. <when test="dealType == 1">
  734. and eq.handle_user_id = #{userId} and eq.deal_status &lt; 2
  735. </when>
  736. <when test="dealType == 2">
  737. and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
  738. </when>
  739. <otherwise>
  740. and eq.deal_status != 6
  741. </otherwise>
  742. </choose>
  743. <if test="userIdList.size() > 0">
  744. and (
  745. eq.handle_user_id in
  746. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  747. #{userId}
  748. </foreach>
  749. OR
  750. eq.auditing_user_id in
  751. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  752. #{userId}
  753. </foreach>
  754. )
  755. </if>
  756. group by eq.id
  757. order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
  758. </select>
  759. <!--根据年级,科目,版本,上下册分页查询题目-->
  760. <select id="findKmtQuestionByGradeSubjectVersionSemester" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  761. 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,
  762. eq.big_question_index, eq.small_question_name small_question_index,
  763. eq.deal_status question_status, eq.create_time, eq.remark reason,
  764. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  765. eq.training_skill training_skills, parent_id, image question_image
  766. from kmt_exercise_questions eq
  767. left join zyb_know_how_details_sort khds on eq.concise_id=khds.id
  768. where eq.book_id is null and eq.question_class_type in (0, 2)
  769. <if test = "grade != null and grade != ''">
  770. and khds.grade = #{grade}
  771. </if>
  772. <if test = "courseName != null and courseName != ''">
  773. and khds.course_name = #{courseName}
  774. </if>
  775. <if test = "type > 0">
  776. and khds.type = #{type}
  777. </if>
  778. <if test = "semester > 0">
  779. and khds.semester = #{semester}
  780. </if>
  781. <choose>
  782. <when test="dealType == 1">
  783. and eq.handle_user_id = #{userId} and eq.deal_status &lt; 2
  784. </when>
  785. <when test="dealType == 2">
  786. and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
  787. </when>
  788. <otherwise>
  789. and eq.deal_status != 6
  790. </otherwise>
  791. </choose>
  792. <if test="userIdList.size() > 0">
  793. and (
  794. eq.handle_user_id in
  795. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  796. #{userId}
  797. </foreach>
  798. OR
  799. eq.auditing_user_id in
  800. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  801. #{userId}
  802. </foreach>
  803. )
  804. </if>
  805. group by eq.id
  806. order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
  807. </select>
  808. <!--分页查询所有题目-->
  809. <select id="findAllKmtQuestions" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  810. 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,
  811. eq.big_question_index, eq.small_question_name small_question_index,
  812. eq.deal_status question_status, eq.create_time, eq.remark reason,
  813. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  814. eq.training_skill training_skills, eq.parent_id, image question_image
  815. from kmt_exercise_questions eq
  816. 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))
  817. or (eq.parent_id is not null and eq.parent_id != ''))
  818. <choose>
  819. <when test="dealType == 1">
  820. and eq.handle_user_id = #{userId} and eq.deal_status &lt; 2
  821. </when>
  822. <when test="dealType == 2">
  823. and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
  824. </when>
  825. <otherwise>
  826. and eq.deal_status != 6
  827. </otherwise>
  828. </choose>
  829. <if test="userIdList.size() > 0">
  830. and (
  831. eq.handle_user_id in
  832. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  833. #{userId}
  834. </foreach>
  835. OR
  836. eq.auditing_user_id in
  837. <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
  838. #{userId}
  839. </foreach>
  840. )
  841. </if>
  842. group by eq.id
  843. order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
  844. </select>
  845. <!--查询小题-->
  846. <select id="findSmallQuestionByParentIds" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  847. 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,
  848. eq.big_question_index, eq.small_question_name small_question_index,
  849. eq.deal_status question_status, eq.create_time, eq.remark reason,
  850. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  851. eq.training_skill training_skills, eq.parent_id, image question_image
  852. from kmt_exercise_questions eq
  853. where eq.parent_id in
  854. <foreach collection="parentIds" item="id" index="index" open="(" close=")" separator=",">
  855. #{id}
  856. </foreach>
  857. and eq.deal_status != 6
  858. order by eq.parent_id, eq.num
  859. </select>
  860. <!--查询大题-->
  861. <select id="findBigQuestionById" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  862. 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,
  863. eq.big_question_index, eq.small_question_name small_question_index,
  864. eq.deal_status question_status, eq.create_time, eq.remark reason,
  865. eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  866. eq.training_skill training_skills, eq.parent_id, image question_image,eq.update_type
  867. from kmt_exercise_questions eq
  868. where eq.id = #{id}
  869. </select>
  870. <!--查询题目的知识点-->
  871. <select id="findQuestionKnowByQuestionIds" resultType="com.ssj.bean.kmt.kmt.model.QuestionListKnowModel">
  872. select eqk.question_id, hds.id how_details_id, hds.alias detail_name, hdks.id how_details_kd_id, hdks.alias kd_name,
  873. hds.grade, hds.course_name, hds.type version_type, hds.semester, khd.is_zt module_type, hs.alias how_name, hds.num, hdks.num
  874. from kmt_exercise_question_know eqk
  875. left join zyb_know_how_details_sort hds on eqk.how_detail_sort_id=hds.id
  876. 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
  877. left join zyb_know_how_details_sort hdks on eqk.how_detail_kd_sort_id=hdks.id
  878. left join zyb_know_how_details khd on hds.how_details_id=khd.id
  879. where question_id in
  880. <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
  881. #{id}
  882. </foreach>
  883. order by eqk.question_id, hds.num, hdks.num
  884. </select>
  885. <!--查询kmt题目的知识点-->
  886. <select id="findKmtQuestionKnowByQuestionIds" resultType="com.ssj.bean.kmt.kmt.model.QuestionListKnowModel">
  887. select eqk.question_id, hds.id how_details_id, hds.alias detail_name, hdks.id how_details_kd_id, hdks.alias kd_name,
  888. hds.grade, hds.course_name, hds.type version_type, hds.semester, khd.is_zt module_type, hs.alias how_name
  889. from kmt_quality_question_know eqk
  890. left join zyb_know_how_details_sort hds on eqk.how_detail_sort_id=hds.id
  891. 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
  892. left join zyb_know_how_details_sort hdks on eqk.how_detail_kd_sort_id=hdks.id
  893. left join zyb_know_how_details khd on hds.how_details_id=khd.id
  894. where question_id in
  895. <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
  896. #{id}
  897. </foreach>
  898. order by eqk.question_id, hds.num, hdks.num
  899. </select>
  900. <!--通过子题目id查询父题目-->
  901. <select id="findPrentQuestionByChildQuestionId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  902. select parent.* from kmt_exercise_questions child left join kmt_exercise_questions parent on child.parent_id=parent.id
  903. where child.id=#{questionId} and parent.id is not null
  904. </select>
  905. <!--分页查询作业批改带学校的练习册-->
  906. <select id="findHomeworkCorrectFilterBooksBySchool" resultType="com.ssj.service.sys.homework.vo.HomeworkExerciseBookDto">
  907. 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
  908. left join scon_homework_exercise_except hee on eb.id=hee.except_book_id
  909. and hee.school=#{school}
  910. where hee.id is null and eb.course_name=#{subject}
  911. <if test="versionType > 0">
  912. and version=#{versionType}
  913. </if>
  914. and eb.semester=#{semester} and eb.grade=#{grade}
  915. and eb.book_type in (0, 1, 3)
  916. order by eb.id
  917. </select>
  918. <!--分页查询作业批改的练习册-->
  919. <select id="findHomeworkCorrectFilterBooks" resultType="com.ssj.service.sys.homework.vo.HomeworkExerciseBookDto">
  920. 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}
  921. and eb.semester=#{semester} and eb.grade=#{grade}
  922. <if test="versionType > 0">
  923. and version=#{versionType}
  924. </if>
  925. and eb.book_type in (0, 1, 3)
  926. order by eb.id
  927. </select>
  928. <!-- 查询练习册记录-->
  929. <select id="findExerciseBookById" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  930. select * from kmt_exercise_book where id=#{bookId}
  931. </select>
  932. <select id="findExerciseBookByBookIdAndYearAndType" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  933. select id, book_id from kmt_exercise_book where book_id=#{bookId} and book_year=#{bookYear}
  934. and book_type=#{bookType}
  935. limit 1
  936. </select>
  937. <!-- 查询练习册单元课时-->
  938. <select id="findByBookIds" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBookCourse">
  939. select eb.id book_id, ebc.book_name, ebc.unit_id, ebc.unit, ebc.id, ebc.period, ebc.grade,
  940. ebc.course_name, ebc.version, ebc.semester, eb.part_flag remark from kmt_exercise_book_course ebc
  941. left join kmt_exercise_book eb on ebc.book_id=eb.book_id where eb.id in
  942. <foreach collection="bookIds" item="id" index="index" open="(" close=")" separator=",">
  943. #{id}
  944. </foreach>
  945. order by eb.id,ebc.unit_sort,ebc.period_sort limit 5000
  946. </select>
  947. <!-- 删除加工的知识点 -->
  948. <delete id="deleteKmtExerciseQuestionKnowByQuestionIds">
  949. delete from kmt_exercise_question_know where question_id in
  950. <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
  951. #{id}
  952. </foreach>
  953. </delete>
  954. <delete id="deleteKmtExerciseBookStatusCountByExerciseBookIds">
  955. delete from kmt_exercise_book_status_count where exercise_book_id in
  956. <foreach collection="exerciseBookIdSet" item="id" index="index" open="(" close=")" separator=",">
  957. #{id}
  958. </foreach>
  959. </delete>
  960. <!-- 题目提交审核 -->
  961. <update id="updateKmtExerciseQuestion2Review">
  962. UPDATE kmt_exercise_questions set deal_status=3 WHERE id in
  963. <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
  964. #{id}
  965. </foreach>
  966. </update>
  967. <update id="updateLoadStatus">
  968. update kmt_exercise_question_know set loaded = 1 where loaded = 0 and id in
  969. <foreach collection="kmtExerciseQuestionKnowIdList" open="(" item="id" separator="," close=")">
  970. #{id}
  971. </foreach>
  972. </update>
  973. <!--更新练习册为未加工-->
  974. <update id="updateKmtExerciseBookNotHandle">
  975. update kmt_exercise_book set had_handle=0 where id=#{id}
  976. </update>
  977. <!--更新练习册为未审核-->
  978. <update id="updateKmtExerciseBookNotAuditing">
  979. update kmt_exercise_book set had_auditing=0 where id=#{id}
  980. </update>
  981. <!--更新练习册为解析未加工-->
  982. <update id="updateKmtExerciseBookAnalysisNotHandle">
  983. update kmt_exercise_book set analysis_handled=0 where id=#{id}
  984. </update>
  985. <!--更新练习册为解析未审核-->
  986. <update id="updateKmtExerciseBookAnalysisNotAuditing">
  987. update kmt_exercise_book set analysis_audited=0 where id=#{id}
  988. </update>
  989. <!--更新练习册课时为未加工-->
  990. <update id="updateKmtExerciseBookCourseNotHandle">
  991. update kmt_exercise_book_course set had_handle=0, had_auditing=0 where id=#{id}
  992. </update>
  993. <!--更新练习册课时为未审核-->
  994. <update id="updateKmtExerciseBookCourseNotAuditing">
  995. update kmt_exercise_book_course set had_auditing=0 where id=#{id}
  996. </update>
  997. <update id="updateExerciseQuestionKnowEsLoadStatus">
  998. update kmt_exercise_question_know set loaded = #{newLoaded}
  999. where id in
  1000. <foreach collection="kmtExerciseQuestionKnowIdList" open="(" item="kmtExerciseQuestionKnowId" separator="," close=")">
  1001. #{kmtExerciseQuestionKnowId}
  1002. </foreach>
  1003. </update>
  1004. <select id="getBookId" resultType="String" parameterType="java.util.Map">
  1005. select id
  1006. from kmt_exercise_book eb
  1007. where eb.course_name = #{map.subject}
  1008. and eb.grade = #{map.grade}
  1009. and eb.semester = #{map.semester}
  1010. and eb.book_type in (0, 1, 3)
  1011. and not exists (
  1012. select 1 from scon_homework_exercise_except t1
  1013. where t1.school = #{map.school}
  1014. and t1.grade = #{map.grade}
  1015. and t1.course_name = #{map.subject}
  1016. and eb.book_id = t1.except_book_id
  1017. )
  1018. <if test='map.version != null and map.version > 0'>
  1019. and version = #{map.version}
  1020. </if>
  1021. </select>
  1022. <select id="findAllChild" resultType="com.ssj.service.conch.parents.v2.dto.TrainRecommendQuestionDTO">
  1023. select
  1024. id,
  1025. difficulty_level difficulty,
  1026. question_type optionTypeInt,
  1027. course_name,
  1028. num
  1029. from kmt_exercise_questions
  1030. where parent_id = #{parentId}
  1031. order by num
  1032. </select>
  1033. <sql id="exercisePublic" >
  1034. t.id exerciseBookId,
  1035. t.url1,
  1036. t.url2,
  1037. t.book_name bookName,
  1038. t.press,
  1039. t.course_name subject,
  1040. t.grade,
  1041. t.version,
  1042. t.version_name versionName,
  1043. t.semester,
  1044. t.print_year printYear,
  1045. t.book_year bookYear,
  1046. t.book_year useYear,
  1047. t.status,
  1048. t.org_nums orgNums,
  1049. t.progress,
  1050. t.total_grade_priority priority,
  1051. t.identified_nums identifiedNums,
  1052. t.answer_correcter_id answerCorrecterId,
  1053. t.book_type,
  1054. t.check_time checkTime,
  1055. t.ai_rollback_import aiRollbackImport,
  1056. t.updated_time,
  1057. t.assigned_batch
  1058. </sql>
  1059. <select id="findExerciseList" resultType="com.ssj.service.kmt.exercisesys.dto.Exercise1Dto" parameterType="java.util.Map">
  1060. select
  1061. <include refid="exercisePublic" />
  1062. from kmt_exercise_book t
  1063. where 1=1
  1064. <!--未校对-->
  1065. <if test='map.proofreadStatus == "0" '>
  1066. and not exists (
  1067. select 1 from kmt_exercise_book_status_count t1
  1068. where t.id = t1.exercise_book_id
  1069. and t1.data_status = 1
  1070. and t1.status > 0
  1071. and t1.status &lt; 5
  1072. )
  1073. and t.status is not null
  1074. and t.proofread_status = 0
  1075. and t.answer_correcter_id is null
  1076. and t.part_flag != 3
  1077. </if>
  1078. <if test="map.bookType != null and map.bookType != '' ">
  1079. and t.book_type = ${map.bookType}
  1080. </if>
  1081. <if test="map.progress != null and map.progress != '' ">
  1082. and t.progress = #{map.progress}
  1083. </if>
  1084. <if test="map.subject != null and map.subject != '' ">
  1085. and t.course_name = #{map.subject}
  1086. </if>
  1087. <if test="map.grade != null and map.grade != '' ">
  1088. and t.grade = #{map.grade}
  1089. </if>
  1090. <if test="map.bookName != null and map.bookName != '' ">
  1091. and t.book_name like concat('%',#{map.bookName},'%')
  1092. </if>
  1093. <if test="map.semester != null and map.semester != '' and map.semester > 0 ">
  1094. and t.semester = #{map.semester}
  1095. </if>
  1096. <if test="map.versionName != null and map.versionName != '' ">
  1097. and t.version_name = #{map.versionName}
  1098. </if>
  1099. <if test="map.bookYear != null and map.bookYear != '' ">
  1100. and t.book_year = #{map.bookYear}
  1101. </if>
  1102. order by t.updated_time desc,t.book_name
  1103. </select>
  1104. <select id="findTeacherExerciseList" resultType="com.ssj.service.kmt.exercisesys.dto.Exercise1Dto" parameterType="java.util.Map">
  1105. select
  1106. <include refid="exercisePublic" />
  1107. ,t1.name teacherName, t1.user_id, t.create_time
  1108. from kmt_exercise_book t
  1109. left join tb_lib_manager t1 on t.answer_correcter_id = t1.user_id
  1110. and t1.type = 17
  1111. and t1.authority = 8
  1112. and t1.state = 1
  1113. where 1=1
  1114. <if test="map.teacherName != null and map.teacherName != '' ">
  1115. and t1.name regexp #{map.teacherName}
  1116. </if>
  1117. <if test="map.exerciseName != null and map.exerciseName != '' ">
  1118. and t.book_name regexp #{map.exerciseName}
  1119. </if>
  1120. <if test="map.beginTime != null and map.beginTime != '' ">
  1121. and t.check_time >= #{map.beginTime}
  1122. </if>
  1123. <if test="map.endTime != null and map.endTime != '' ">
  1124. and t.check_time &lt;= #{map.endTime}
  1125. </if>
  1126. <!--校对中-->
  1127. <if test='map.type == "1" '>
  1128. and t.part_flag != 3
  1129. and t.answer_corrected_status = 0
  1130. and t.answer_correcter_id is not null
  1131. order by t1.name,t1.user_id,t.book_name
  1132. </if>
  1133. <!--已校对-->
  1134. <if test='map.type == "2" '>
  1135. and t.part_flag != 3
  1136. and t.answer_corrected_status = 1
  1137. order by t1.name,t1.user_id,t.book_name,t.create_time asc
  1138. </if>
  1139. </select>
  1140. <select id="findLastExerciseRollbackByQuestionId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionRollback">
  1141. select * from kmt_exercise_question_rollback where question_id=#{questionId} order by create_time desc limit 1
  1142. </select>
  1143. <select id="findLibList" resultType="com.ssj.bean.weixin.libmy.domain.TbLibJoin" parameterType="java.util.Map">
  1144. select t1.*
  1145. from tb_lib_join t1
  1146. where 1=1
  1147. and t1.type = 1
  1148. <if test="map.name != null and map.name != '' ">
  1149. and t1.league_name regexp #{map.name}
  1150. </if>
  1151. and exists (
  1152. select 1 from fx_merchant t2 where t1.id = t2.lib_id and t2.sign_service > 0
  1153. )
  1154. order by t1.league_name
  1155. </select>
  1156. <select id="findExerciseBookCount" resultType="com.ssj.service.kmt.exercisesys.dto.ExerciseBookCountDTO">
  1157. select status,
  1158. count(*) totalCount,
  1159. sum(if(course_name = '语文', 1, 0)) chineseCount,
  1160. sum(if(course_name = '数学', 1, 0)) mathCount,
  1161. sum(if(course_name = '英语', 1, 0)) englishCount
  1162. from kmt_exercise_book_status_count
  1163. where data_status = 1
  1164. group by status
  1165. </select>
  1166. <select id="findAllLib" resultType="java.util.Map">
  1167. select t1.lib_id libId,t3.league_lat leagueLet,t3.league_lng leagueLng,t3.league_name leagueName, ifNull(t4.sign_service,0) signService
  1168. from kmt_exercise_book_lib t1
  1169. left join kmt_exercise_book t2 on t1.exercise_book_id =t2.id and t1.is_delete=0
  1170. left join tb_lib_join t3 on t1.lib_id=t3.id
  1171. left join fx_merchant t4 on t1.lib_id=t4.lib_id
  1172. where t1.lib_id is not null and t1.lib_id !=''
  1173. <if test="subject != null and subject != '' ">
  1174. and t2.course_name=#{subject}
  1175. </if>
  1176. and t1.is_delete=0
  1177. and t4.sign_service!=0
  1178. and t4.sign_service is not null
  1179. group by libId
  1180. </select>
  1181. <select id="findAllExerciseBook" resultType="com.ssj.service.kmt.dto.exercise.KmtExerciseBookLibDto">
  1182. 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
  1183. from kmt_exercise_book_lib t
  1184. left join kmt_exercise_book t1 on t.exercise_book_id =t1.id
  1185. where t.lib_id=#{libId}
  1186. and t1.course_name=#{subject}
  1187. and t.is_delete=0
  1188. </select>
  1189. <select id="findAllExportLib" resultType="java.util.Map">
  1190. 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
  1191. from kmt_exercise_book_lib t1
  1192. left join kmt_exercise_book t2 on t1.exercise_book_id =t2.id
  1193. left join tb_lib_join t3 on t1.lib_id=t3.id
  1194. left join fx_merchant t4 on t1.lib_id=t4.lib_id
  1195. where t1.lib_id is not null
  1196. <if test="subject != null and subject != '' ">
  1197. and t2.course_name=#{subject}
  1198. </if>
  1199. and t1.is_delete=0
  1200. </select>
  1201. <select id="findQuestionByParentId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  1202. select * from kmt_exercise_questions where (id in
  1203. <foreach collection="parentIds" open="(" item="id" separator="," close=")">
  1204. #{id}
  1205. </foreach>or parent_id in
  1206. <foreach collection="parentIds" open="(" item="id" separator="," close=")">
  1207. #{id}
  1208. </foreach>
  1209. ) and deal_status != 6
  1210. order by num
  1211. limit 2000
  1212. </select>
  1213. <select id="findKmtExerciseQuestionRollbackListByQuestionId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionRollback">
  1214. select * from kmt_exercise_question_rollback where question_id= #{questionId} order by create_time desc
  1215. </select>
  1216. <select id="findByUserIdAndTypeIn" resultType="com.ssj.bean.weixin.libmy.domain.TbLibManager">
  1217. select * from tb_lib_manager where user_id= #{userId}
  1218. and type in(17,18) limit 1
  1219. </select>
  1220. <select id="findLibSignCount" resultType="com.ssj.service.kmt.exercisesys.dto.ExercisePriorityDto">
  1221. 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
  1222. on t1.lib_id=t2.lib_id
  1223. where t1.exercise_book_id is not null
  1224. and t1.is_delete=0
  1225. limit 10000
  1226. </select>
  1227. <select id="findExerciseQuestionByExerciseBookId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  1228. select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
  1229. eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
  1230. eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
  1231. eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
  1232. eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
  1233. 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,
  1234. eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time, eq.handler_submit_time,
  1235. eq.proofread_status, eq.question_path
  1236. from kmt_exercise_questions eq
  1237. left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eq.exercise_book_id=#{exerciseBookId} limit 10000
  1238. </select>
  1239. <select id="findExerciseQuestionByIds" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  1240. select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
  1241. eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
  1242. eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
  1243. eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
  1244. eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
  1245. 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,
  1246. eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time, eq.handler_submit_time,
  1247. eq.proofread_status, eq.question_path
  1248. from kmt_exercise_questions eq
  1249. left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eq.id in
  1250. <foreach collection="ids" open="(" item="id" separator="," close=")">
  1251. #{id}
  1252. </foreach>
  1253. limit 10000
  1254. </select>
  1255. <!--更新练习册涉及到的机构签约数-->
  1256. <update id="updateKmtExerciseBookByExerciseBookId">
  1257. update kmt_exercise_book set exercise_relevancy_num=#{exerciseRelevancyNum} where id=#{exerciseBooId}
  1258. </update>
  1259. <select id="findAllExerciseBookBySignNum" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1260. select * from kmt_exercise_book
  1261. where
  1262. exercise_relevancy_num !=0
  1263. and exercise_relevancy_num is not null
  1264. order by exercise_relevancy_num desc
  1265. limit 10000
  1266. </select>
  1267. <select id="findAnswerProofreadExerciseBookList"
  1268. resultType="com.ssj.service.kmt.exercisesys.dto.AnswerProofreadExerciseBookDTO">
  1269. select distinct t1.id exerciseBookId,
  1270. t1.book_name,
  1271. t1.course_name subject,
  1272. t1.grade,
  1273. t1.version,
  1274. t1.semester,
  1275. t1.proofread_status,
  1276. t1.book_type,
  1277. t1.latest_answer_wrong_date_time proofreadDate,
  1278. t3.name
  1279. from kmt_exercise_book t1 left join tb_lib_manager t3
  1280. on t1.answer_correcter_id=t3.user_id
  1281. and t3.type=17 and t3.authority=8 and t3.state=1
  1282. where t1.proofread_status in (2, 3)
  1283. <if test="req.subject != null and req.subject != ''">
  1284. and t1.course_name = #{req.subject}
  1285. </if>
  1286. <if test="req.grade != null and req.grade != ''">
  1287. and t1.grade = #{req.grade}
  1288. </if>
  1289. <if test="req.bookName != null and req.bookName != ''">
  1290. and t1.book_name like concat('%',#{req.bookName},'%')
  1291. </if>
  1292. <if test="req.proofreadDate != null and req.proofreadDate != ''">
  1293. and date(t1.latest_answer_wrong_date_time) = #{req.proofreadDate}
  1294. </if>
  1295. order by t1.proofread_status
  1296. </select>
  1297. <select id="findQuestionListAnswerWrong" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  1298. select eq.id question_id, eq.course_name, eq.handle_user_id, eq.auditing_user_id, eq.analysis_user_id,
  1299. eq.analysis_auditer_id, eq.book_course_id course_id, eq.big_question_index,
  1300. eq.small_question_name small_question_index,
  1301. eq.deal_status question_status, eq.create_time, eq.remark reason, eq.question_type question_types,
  1302. eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
  1303. eq.training_skill training_skills, eq.parent_id, eq.question_path,eq.num
  1304. from kmt_exercise_questions eq
  1305. where eq.exercise_book_id = #{req.exerciseBookId}
  1306. and eq.book_course_id = #{req.periodId}
  1307. and eq.proofread_status = 2
  1308. order by eq.num, eq.create_time
  1309. </select>
  1310. <select id="findRepulsedQuestion" resultType="com.ssj.service.kmt.dto.ExerciseQuetionDto">
  1311. select eq.id question_id,
  1312. eq.course_name,
  1313. eb.handle_user_id,
  1314. eb.auditing_user_id,
  1315. eb.analysis_user_id,
  1316. eb.analysis_auditer_id,
  1317. eq.book_course_id course_id,
  1318. eq.big_question_index,
  1319. eq.small_question_name small_question_index,
  1320. eq.deal_status question_status,
  1321. eq.create_time,
  1322. eq.remark reason,
  1323. eq.from_user_id,
  1324. eq.to_user_id,
  1325. eq.question_type question_types,
  1326. eq.difficulty_level difficulty_levels,
  1327. eq.real_exam_type real_exam_types,
  1328. eq.training_skill training_skills,
  1329. eq.parent_id,
  1330. eq.question_path,
  1331. eq.num
  1332. from kmt_exercise_questions eq
  1333. left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
  1334. where eq.exercise_book_id = #{req.exerciseBookId}
  1335. and eq.deal_status in
  1336. <foreach collection="dealStatusList" open="(" item="dealStatus" separator="," close=")">
  1337. #{dealStatus}
  1338. </foreach>
  1339. order by eq.num, eq.create_time, eq.deal_status
  1340. limit 0, 5000
  1341. </select>
  1342. <update id="updateKmtExerciseBookById">
  1343. update kmt_exercise_book set priority=#{priority} where id=#{id}
  1344. </update>
  1345. <update id="updateKmtExerciseBookByPriority">
  1346. update kmt_exercise_book set total_grade_priority=#{totalGradePriority} where id=#{id}
  1347. </update>
  1348. <select id="findUnproofreadExerciseId" resultType="java.util.Map">
  1349. select id from kmt_exercise_book eb where eb.answer_correcter_id is not null
  1350. </select>
  1351. <select id="findExerciseStatusByBookId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestion">
  1352. 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}
  1353. </select>
  1354. <update id="updateExerciseBookStatusByIdAndStatus">
  1355. update kmt_exercise_book set proofread_status=#{proofreadStatus} where id=#{id}
  1356. </update>
  1357. <update id="updateExerciseBookProofreadResult">
  1358. update kmt_exercise_book set proofread_status=#{type}, latest_answer_wrong_date_time = now() where id=#{exerciseBookId}
  1359. </update>
  1360. <select id="countAnswerWrongQuestion" resultType="java.lang.Integer">
  1361. select count(*) from kmt_exercise_questions where exercise_book_id = #{exerciseBookId} and proofread_status = 2 and deal_status not in (2, 6)
  1362. and id not in
  1363. <foreach collection="excludeQuestionIdSet" open="(" item="id" close=")" separator=",">
  1364. #{id}
  1365. </foreach>
  1366. </select>
  1367. <select id="teacherAnswerProofreadDetail" resultType="java.util.Map">
  1368. select count(1) total,sum(answer_corrected_status) finishedNums
  1369. from kmt_exercise_book
  1370. where answer_correcter_id = #{userId}
  1371. </select>
  1372. <select id="findUnitAndPeriodList" resultType="com.ssj.service.kmt.dto.exercise.ExerciseUnitBookcourseDto">
  1373. select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course
  1374. from kmt_exercise_book_course ebc
  1375. where ebc.id in (select distinct book_course_id
  1376. from kmt_exercise_questions
  1377. where exercise_book_id = #{request.exerciseBookId} and proofread_status = 2)
  1378. </select>
  1379. <select id="findKmtExerciseQuestionErrorsByQuestionIds" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionErrors">
  1380. select * from kmt_exercise_question_errors where question_id in
  1381. <foreach collection="questionIds" open="(" item="id" close=")" separator=",">
  1382. #{id}
  1383. </foreach>
  1384. and error_user_auth=#{beType}
  1385. </select>
  1386. <select id="findKmtExerciseQuestionByErrorUserId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseQuestionErrors">
  1387. select * from kmt_exercise_question_errors where error_user_id=#{userId} order by create_time desc
  1388. </select>
  1389. <select id="countQuestionErrorCountByExerciseBookId" resultType="java.lang.Integer">
  1390. select count(1) from kmt_exercise_question_errors where exercise_book_id=#{exerciseBookId}
  1391. and error_user_id=#{userId} and error_user_auth=#{type}
  1392. </select>
  1393. <select id="findSameExerciseBookList" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1394. SELECT t.*
  1395. FROM kmt_exercise_book t,
  1396. (select book_name,
  1397. course_name,
  1398. grade,
  1399. version_name,
  1400. semester,
  1401. book_type,
  1402. book_year,
  1403. COUNT(book_name) c1,
  1404. COUNT(course_name) c2,
  1405. COUNT(grade) c3,
  1406. COUNT(version_name) c4,
  1407. COUNT(semester) c5,
  1408. COUNT(book_type) c6,
  1409. COUNT(book_year) c7
  1410. from kmt_exercise_book
  1411. group by book_name, course_name, grade, version_name, semester, book_type, book_year
  1412. HAVING c1 > 1
  1413. and c2 > 1
  1414. and c3 > 1
  1415. and c4 > 1
  1416. and c5 > 1
  1417. and c6 > 1
  1418. and c7 > 1) t1
  1419. where t.book_name = t1.book_name
  1420. and t.course_name = t1.course_name
  1421. and t.grade = t1.grade
  1422. and t.version_name = t1.version_name
  1423. and t.semester = t1.semester
  1424. and t.book_type = t1.book_type
  1425. and t.book_year = t1.book_year
  1426. order by t.book_name, t.course_name, t.grade, t.version_name, t.semester, t.book_type, t.book_year, t.part_flag
  1427. </select>
  1428. <select id="countUnFinishQuestionsByExerciseBookId" resultType="java.lang.Integer">
  1429. select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
  1430. <if test="type == 1">
  1431. and deal_status in (0, 1)
  1432. </if>
  1433. <if test="type == 2">
  1434. and deal_status in (3, 7)
  1435. </if>
  1436. <if test="type == 3">
  1437. and deal_status in (5, 8)
  1438. </if>
  1439. <if test="type == 4">
  1440. and deal_status in (9, 10)
  1441. </if>
  1442. </select>
  1443. <select id="findDistributionCount"
  1444. resultType="com.ssj.service.kmt.exercisesys.dto.ExerciseDistributionCountDTO">
  1445. select sum(if(handle_user_id is null or auditing_user_id is null or analysis_user_id is null or
  1446. analysis_auditer_id is null, 1, 0)) notDistributedExerciseBookCount,
  1447. count(*) totalExerciseBookCount
  1448. from kmt_exercise_book
  1449. where part_flag &lt;> 3
  1450. </select>
  1451. <select id="findDistributionExerciseBookList" resultMap="DistributionExerciseBookDTOResultMap">
  1452. select eb.exerciseBookId,
  1453. eb.importDate,
  1454. eb.subject,
  1455. eb.grade,
  1456. eb.version_name,
  1457. eb.semester,
  1458. eb.book_name,
  1459. eb.book_type,
  1460. eb.assigned_batch,
  1461. (select count(distinct unit_id)
  1462. from kmt_exercise_book_course ebc
  1463. where ebc.exercise_book_id = eb.exerciseBookId) unitNum,
  1464. (select count(*)
  1465. from kmt_exercise_book_course ebc
  1466. where ebc.exercise_book_id = eb.exerciseBookId) courseNum,
  1467. ebcHandle.accuracy intHandleAccuracy,
  1468. ebcHandleAudit.accuracy intHandleAuditAccuracy,
  1469. ebcAnalysis.accuracy intAnalysisAccuracy,
  1470. ebtrHandle.teacher_id handlerTeacherId,
  1471. ebtrHandle.teacher_name handlerName,
  1472. ebtrHandle.salary_given handlerSalaryGiven,
  1473. ebtrHandle.salary_given_time handlerSalaryGivenTime,
  1474. ebtrHandle.create_time handlerDistributeTime,
  1475. ebtrHandleAudit.teacher_id handlerAuditUserTeacherId,
  1476. ebtrHandleAudit.teacher_name handlerAuditUserName,
  1477. ebtrHandleAudit.salary_given handlerAuditUserSalaryGiven,
  1478. ebtrHandleAudit.salary_given_time handlerAuditUserSalaryGivenTime,
  1479. ebtrHandleAudit.create_time handlerAuditUserDistributeTime,
  1480. ebtrAnalysis.teacher_id analyserTeacherId,
  1481. ebtrAnalysis.teacher_name analyserName,
  1482. ebtrAnalysis.salary_given analyserSalaryGiven,
  1483. ebtrAnalysis.salary_given_time analyserSalaryGivenTime,
  1484. ebtrAnalysis.create_time analyserDistributeTime,
  1485. ebtrAnalysisAudit.teacher_id analysisAuditUserTeacherId,
  1486. ebtrAnalysisAudit.teacher_name analysisAuditUserName,
  1487. ebtrAnalysisAudit.salary_given analysisAuditUserSalaryGiven,
  1488. ebtrAnalysisAudit.salary_given_time analysisAuditUserSalaryGivenTime,
  1489. ebtrAnalysisAudit.create_time analysisAuditUserDistributeTime
  1490. from (select id exerciseBookId,
  1491. create_time importDate,
  1492. course_name subject,
  1493. grade,
  1494. version_name,
  1495. semester,
  1496. book_name,
  1497. book_type,
  1498. handle_user_id,
  1499. auditing_user_id,
  1500. analysis_user_id,
  1501. analysis_auditer_id,
  1502. assigned_batch
  1503. from kmt_exercise_book
  1504. where (3 > part_flag or part_flag > 3)
  1505. <if test="req.type == 1">
  1506. and (
  1507. <choose>
  1508. <when test="(req.handler != null and req.handler > 0) or
  1509. (req.handleAuditUser != null and req.handleAuditUser > 0) or
  1510. (req.analyser != null and req.analyser > 0) or
  1511. (req.analysisAuditUser != null and req.analysisAuditUser > 0)">
  1512. <if test="req.handler != null and req.handler > 0">
  1513. handle_user_id is null and
  1514. </if>
  1515. <if test="req.handleAuditUser != null and req.handleAuditUser > 0">
  1516. auditing_user_id is null and
  1517. </if>
  1518. <if test="req.analyser != null and req.analyser > 0">
  1519. analysis_user_id is null and
  1520. </if>
  1521. <if test="req.analysisAuditUser != null and req.analysisAuditUser > 0">
  1522. analysis_auditer_id is null and
  1523. </if>
  1524. 1 = 1
  1525. </when>
  1526. <otherwise>
  1527. handle_user_id is null
  1528. or auditing_user_id is null
  1529. or analysis_user_id is null
  1530. or analysis_auditer_id is null
  1531. </otherwise>
  1532. </choose>
  1533. )
  1534. </if>
  1535. <if test="req.type == 2">
  1536. and (handle_user_id is not null
  1537. and auditing_user_id is not null
  1538. and analysis_user_id is not null
  1539. and analysis_auditer_id is not null)
  1540. </if>
  1541. <if test="req.bookName != null and req.bookName != ''">
  1542. and book_name like '%${req.bookName}%'
  1543. </if>
  1544. <if test="req.subject != null and req.subject != ''">
  1545. and course_name = #{req.subject}
  1546. </if>
  1547. <if test="req.grade != null and req.grade != ''">
  1548. and grade = #{req.grade}
  1549. </if>
  1550. <if test="req.version != null and req.version > 0">
  1551. and version = #{req.version}
  1552. </if>
  1553. <if test="req.semester != null and req.semester > 0">
  1554. and semester = #{req.semester}
  1555. </if>
  1556. <if test="req.bookType != null and req.bookType > -1">
  1557. and book_type = #{req.bookType}
  1558. </if>
  1559. <if test="req.startTime != null and req.startTime != ''">
  1560. and create_time > #{req.startTime}
  1561. </if>
  1562. <if test="req.endTime != null and req.endTime != ''">
  1563. and '${req.endTime} 23:59:59' > create_time
  1564. </if>
  1565. order by create_time desc
  1566. limit #{offset}, #{pageSize}) eb
  1567. left join kmt_exercise_book_teacher_record ebtrHandle
  1568. on eb.exerciseBookId = ebtrHandle.exercise_book_id and ebtrHandle.authority_type = 1
  1569. left join kmt_exercise_book_count ebcHandle
  1570. on eb.exerciseBookId = ebcHandle.exercise_book_id and ebcHandle.type = 1
  1571. left join kmt_exercise_book_teacher_record ebtrHandleAudit
  1572. on eb.exerciseBookId = ebtrHandleAudit.exercise_book_id and ebtrHandleAudit.authority_type = 2
  1573. left join kmt_exercise_book_count ebcHandleAudit
  1574. on eb.exerciseBookId = ebcHandleAudit.exercise_book_id and ebcHandleAudit.type = 2
  1575. left join kmt_exercise_book_teacher_record ebtrAnalysis
  1576. on eb.exerciseBookId = ebtrAnalysis.exercise_book_id and ebtrAnalysis.authority_type = 3
  1577. left join kmt_exercise_book_count ebcAnalysis
  1578. on eb.exerciseBookId = ebcAnalysis.exercise_book_id and ebcAnalysis.type = 3
  1579. left join kmt_exercise_book_teacher_record ebtrAnalysisAudit
  1580. on eb.exerciseBookId = ebtrAnalysisAudit.exercise_book_id and ebtrAnalysisAudit.authority_type = 4
  1581. left join kmt_exercise_book_count ebcAnalysisAudit
  1582. on eb.exerciseBookId = ebcAnalysisAudit.exercise_book_id and ebcAnalysisAudit.type = 4
  1583. order by eb.importDate desc
  1584. </select>
  1585. <select id="countDistributionExerciseBook" resultType="java.lang.Integer">
  1586. select count(*)
  1587. from kmt_exercise_book
  1588. where part_flag &lt;> 3
  1589. <if test="req.type == 1">
  1590. and (
  1591. <choose>
  1592. <when test="(req.handler != null and req.handler > 0) or
  1593. (req.handleAuditUser != null and req.handleAuditUser > 0) or
  1594. (req.analyser != null and req.analyser > 0) or
  1595. (req.analysisAuditUser != null and req.analysisAuditUser > 0)">
  1596. <if test="req.handler != null and req.handler > 0">
  1597. handle_user_id is null and
  1598. </if>
  1599. <if test="req.handleAuditUser != null and req.handleAuditUser > 0">
  1600. auditing_user_id is null and
  1601. </if>
  1602. <if test="req.analyser != null and req.analyser > 0">
  1603. analysis_user_id is null and
  1604. </if>
  1605. <if test="req.analysisAuditUser != null and req.analysisAuditUser > 0">
  1606. analysis_auditer_id is null and
  1607. </if>
  1608. 1 = 1
  1609. </when>
  1610. <otherwise>
  1611. handle_user_id is null
  1612. or auditing_user_id is null
  1613. or analysis_user_id is null
  1614. or analysis_auditer_id is null
  1615. </otherwise>
  1616. </choose>
  1617. )
  1618. </if>
  1619. <if test="req.type == 2">
  1620. and (handle_user_id is not null
  1621. and auditing_user_id is not null
  1622. and analysis_user_id is not null
  1623. and analysis_auditer_id is not null)
  1624. </if>
  1625. <if test="req.bookName != null and req.bookName != ''">
  1626. and book_name like '%${req.bookName}%'
  1627. </if>
  1628. <if test="req.subject != null and req.subject != ''">
  1629. and course_name = #{req.subject}
  1630. </if>
  1631. <if test="req.grade != null and req.grade != ''">
  1632. and grade = #{req.grade}
  1633. </if>
  1634. <if test="req.version != null and req.version > 0">
  1635. and version = #{req.version}
  1636. </if>
  1637. <if test="req.semester != null and req.semester > 0">
  1638. and semester = #{req.semester}
  1639. </if>
  1640. <if test="req.bookType != null and req.bookType > -1">
  1641. and book_type = #{req.bookType}
  1642. </if>
  1643. <if test="req.startTime != null and req.startTime != ''">
  1644. and create_time > #{req.startTime}
  1645. </if>
  1646. <if test="req.endTime != null and req.endTime != ''">
  1647. and '${req.endTime} 23:59:59' > create_time
  1648. </if>
  1649. </select>
  1650. <update id="updateAnswerCorrecterIdByIds">
  1651. update kmt_exercise_book set answer_correcter_id = #{teacherId}
  1652. where id in
  1653. <foreach collection="exerciseBookIds" open="(" item="exerciseBookId" separator="," close=")">
  1654. #{exerciseBookId}
  1655. </foreach>
  1656. </update>
  1657. <update id="updateAnswerCorrecterIdByExerciseBookIds">
  1658. update kmt_exercise_questions set answer_correcter_id = #{teacherId}
  1659. where exercise_book_id in
  1660. <foreach collection="exerciseBookIds" open="(" item="exerciseBookId" separator="," close=")">
  1661. #{exerciseBookId}
  1662. </foreach>
  1663. </update>
  1664. <select id="findExportDistributionExerciseBookList" resultType="com.ssj.service.kmt.exercisesys.dto.ExportDistributionExerciseBookDTO">
  1665. select ebdc.*, eb.assigned_batch
  1666. from kmt_exercise_book_distribution_count ebdc join kmt_exercise_book eb on ebdc.exercise_book_id=eb.id
  1667. <where>
  1668. <if test="req.startTime != null and req.startTime != ''">
  1669. and ebdc.import_date > #{req.startTime}
  1670. </if>
  1671. <if test="req.endTime != null and req.endTime != ''">
  1672. and '${req.endTime} 23:59:59' > ebdc.import_date
  1673. </if>
  1674. </where>
  1675. order by ebdc.import_date desc
  1676. limit #{offset}
  1677. </select>
  1678. <select id="findDistributionTeacher"
  1679. resultType="com.ssj.service.kmt.exercisesys.dto.DistributionTeacherDTO">
  1680. select teacher_id,
  1681. teacher_name,
  1682. salary_given,
  1683. salary_given_time
  1684. <if test="authorityType == 1">
  1685. , (select max(handler_submit_time)
  1686. from kmt_exercise_questions eq
  1687. where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 0) lastSubmitTime
  1688. </if>
  1689. <if test="authorityType == 2">
  1690. , (select max(publish_time)
  1691. from kmt_exercise_questions eq
  1692. where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 3) lastSubmitTime
  1693. </if>
  1694. <if test="authorityType == 3">
  1695. , (select max(analysis_handler_submit_time)
  1696. from kmt_exercise_questions eq
  1697. where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 5) lastSubmitTime
  1698. </if>
  1699. <if test="authorityType == 4">
  1700. , (select max(analysis_submit_time)
  1701. from kmt_exercise_questions eq
  1702. where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status = 11) lastSubmitTime
  1703. </if>
  1704. from kmt_exercise_book_teacher_record
  1705. where exercise_book_id = #{exerciseBookId}
  1706. and teacher_id = #{userId}
  1707. and authority_type = #{authorityType}
  1708. order by create_time desc
  1709. limit 1
  1710. </select>
  1711. <select id="findAllExerciseBookPage" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1712. select * from kmt_exercise_book
  1713. where part_flag &lt;> 3
  1714. <if test="selectedExerciseBookIdList != null and selectedExerciseBookIdList.size > 0">
  1715. and id in
  1716. <foreach collection="selectedExerciseBookIdList" open="(" item="selectedExerciseBookId" separator="," close=")">
  1717. #{selectedExerciseBookId}
  1718. </foreach>
  1719. </if>
  1720. limit #{offset}, #{pageSize}
  1721. </select>
  1722. <select id="countNotCheckAnswerCount" resultType="java.lang.Integer">
  1723. select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
  1724. and deal_status != 2 and proofread_status = 0
  1725. </select>
  1726. <select id="countAllNotCheckAnswerCount" resultType="java.lang.Integer">
  1727. select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
  1728. and proofread_status = 0
  1729. </select>
  1730. <select id="findExerciseBooksByBookId" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBook">
  1731. select * from kmt_exercise_book where book_id=#{bookId}
  1732. </select>
  1733. <select id="findExerciseTeacherByExerciseBookIdsAndAuthType" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBookTeacherRecord">
  1734. select * from kmt_exercise_book_teacher_record where exercise_book_id in
  1735. <foreach collection="exerciseBookIds" open="(" item="id" separator="," close=")">
  1736. #{id}
  1737. </foreach>
  1738. and authority_type = #{authType}
  1739. </select>
  1740. <select id="findBookCountByExerciseBookIdAndType" resultType="com.ssj.bean.kmt.kmt.domain.KmtExerciseBookCount">
  1741. select * from kmt_exercise_book_count where exercise_book_id=#{exerciseBookId} and type=#{type} limit 1
  1742. </select>
  1743. <update id="updateKmtExerciseBookCountById">
  1744. UPDATE kmt_exercise_book_count set accuracy=#{accuracy} WHERE id = #{bookCountId}
  1745. </update>
  1746. <select id="findAllDistinctLibBySubject" resultType="java.util.Map">
  1747. SELECT DISTINCT lib_id FROM
  1748. kmt_exercise_book_lib t
  1749. LEFT JOIN kmt_exercise_book t1 ON t.exercise_book_id = t1.id
  1750. WHERE
  1751. t.is_delete = 0
  1752. and t.lib_id is not null
  1753. AND t1.course_name = #{subjct}
  1754. </select>
  1755. <select id="findSignService" resultType="com.ssj.bean.sys.fx.domain.Merchant">
  1756. select * from fx_merchant where lib_id=#{libId} and sign_service is not null limit 1
  1757. </select>
  1758. </mapper>