KmtExerciseMapper.xml 97 KB

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