1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.aijia.kmt.mapper.KmtExerciseMapper">
- <resultMap id="DistributionExerciseBookDTOResultMap" type="com.aijia.kmt.dto.DistributionExerciseBookDTO">
- <id column="exerciseBookId" property="exerciseBookId"/>
- <result column="importDate" property="importDate"/>
- <result column="subject" property="subject"/>
- <result column="grade" property="grade"/>
- <result column="version_name" property="versionName"/>
- <result column="semester" property="semester"/>
- <result column="book_name" property="bookName"/>
- <result column="book_type" property="bookType"/>
- <result column="unitNum" property="unitNum"/>
- <result column="courseNum" property="courseNum"/>
- <result column="intHandleAccuracy" property="intHandleAccuracy"/>
- <result column="intHandleAuditAccuracy" property="intHandleAuditAccuracy"/>
- <result column="intAnalysisAccuracy" property="intAnalysisAccuracy"/>
- <result column="assigned_batch" property="assignedBatch"/>
- <collection property="handleUserList" ofType="com.aijia.kmt.dto.DistributionTeacherDTO">
- <result column="handlerTeacherId" property="teacherId"/>
- <result column="handlerSalaryGiven" property="salaryGiven"/>
- <result column="handlerSalaryGivenTime" property="salaryGivenTime"/>
- <result column="handlerName" property="teacherName"/>
- <result column="handlerDistributeTime" property="createTime"/>
- </collection>
- <collection property="auditingUserList" ofType="com.aijia.kmt.dto.DistributionTeacherDTO">
- <result column="handlerAuditUserTeacherId" property="teacherId"/>
- <result column="handlerAuditUserSalaryGiven" property="salaryGiven"/>
- <result column="handlerAuditUserSalaryGivenTime" property="salaryGivenTime"/>
- <result column="handlerAuditUserName" property="teacherName"/>
- <result column="handlerAuditUserDistributeTime" property="createTime"/>
- </collection>
- <collection property="analysisUserList" ofType="com.aijia.kmt.dto.DistributionTeacherDTO">
- <result column="analyserTeacherId" property="teacherId"/>
- <result column="analyserSalaryGiven" property="salaryGiven"/>
- <result column="analyserSalaryGivenTime" property="salaryGivenTime"/>
- <result column="analyserName" property="teacherName"/>
- <result column="analyserDistributeTime" property="createTime"/>
- </collection>
- <collection property="analysisAuditerList" ofType="com.aijia.kmt.dto.DistributionTeacherDTO">
- <result column="analysisAuditUserTeacherId" property="teacherId"/>
- <result column="analysisAuditUserSalaryGiven" property="salaryGiven"/>
- <result column="analysisAuditUserSalaryGivenTime" property="salaryGivenTime"/>
- <result column="analysisAuditUserName" property="teacherName"/>
- <result column="analysisAuditUserDistributeTime" property="createTime"/>
- </collection>
- </resultMap>
- <resultMap id="ExportDistributionExerciseBookDTOResultMap" type="com.aijia.kmt.dto.ExportDistributionExerciseBookDTO">
- <id column="exercise_book_id" property="exerciseBookId"/>
- <result column="import_date" property="importDate"/>
- <result column="subject" property="subject"/>
- <result column="grade" property="grade"/>
- <result column="version_name" property="version"/>
- <result column="semester" property="semester"/>
- <result column="book_name" property="bookName"/>
- <result column="book_type" property="bookType"/>
- <result column="unit_count" property="unitCount"/>
- <result column="course_count" property="courseCount"/>
- </resultMap>
- <select id="findWrongQuestionKnowHowDetailIdList" resultType="java.lang.String">
- select kmt_exercise_question_know.how_details_id
- from kmt_exercise_question_know
- where kmt_exercise_question_know.question_id = #{questionId}
- union all
- select kmt_exercise_question_know.how_details_id
- from kmt_exercise_question_know,
- kmt_exercise_questions brother,
- kmt_exercise_questions
- where kmt_exercise_question_know.question_id = brother.id
- and brother.parent_id = kmt_exercise_questions.parent_id
- and kmt_exercise_questions.id = #{questionId}
- and ifnull(length(kmt_exercise_questions.parent_id), 0) > 0
- </select>
- <!-- 查询题目列表 -->
- <!-- 条件 :,eq.concise_id-->
- <select id="findKmtExerciseQuestionsByIdIn" resultType="com.aijia.kmt.po.KmtExerciseQuestion" >
- select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
- eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
- eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
- eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
- eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
- 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,
- eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time,
- eq.proofread_status, eq.question_path, eq.handler_submit_time,eq.enumerate
- from kmt_exercise_questions eq
- left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eq.id in
- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- limit 0, 5000
- </select>
- <!-- 查询打回题目列表 -->
- <select id="findKmtExerciseQuestionRollbacks" resultType="com.aijia.kmt.po.KmtExerciseQuestionRollback">
- SELECT * FROM kmt_exercise_question_rollback where question_id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- and type=#{dealType}
- </select>
- <!-- 查询待加工审核的题目 -->
- <select id="findQuestionByBookCourseIdAndUserId" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index, eq.is_common_flag,
- eq.deal_status question_status, eq.create_time, eq.remark reason, eq.from_user_id, eq.to_user_id,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, eq.parent_id, eq.proofread_status, eq.question_path, eq.num, eq.page_index,
- eq.image question_image, eq.concise_id start_X, eq.analysis_submit_type start_Y, eq.update_type end_X, eq.es_loaded end_Y,eq.enumerate
- from kmt_exercise_questions eq left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
- where eq.book_course_id = #{bookCourseId} and (eq.exercise_book_id=#{exerciseBookId} or eq.is_common_flag = 0)
- <if test = "dealType == 2">
- and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
- </if>
- <if test = "dealType == 1">
- and eq.deal_status < 2 and eb.handle_user_id=#{userId}
- </if>
- <if test = "dealType == 4">
- and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
- </if>
- <if test = "dealType == 5">
- and eq.deal_status in (9, 10) and eb.analysis_auditer_id = #{userId}
- </if>
- <if test = "dealType == 6">
- and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
- </if>
- <if test = "dealType == 7">
- and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
- </if>
- <if test="dealType == 3 and rollbackType > 0 ">
- <if test="rollbackType == 1">
- and eq.deal_status != 2
- </if>
- <if test="rollbackType == 2">
- and eq.deal_status > 2
- </if>
- <if test="rollbackType == 3">
- and eq.deal_status > 3 and eq.deal_status != 7
- </if>
- <if test="rollbackType == 4">
- and eq.deal_status > 8
- </if>
- <if test="rollbackType == 5">
- and eq.deal_status > 10
- </if>
- </if>
- order by eq.num, eq.create_time
- </select>
- <!-- 查询不同的题目 -->
- <select id="findPartQuestionByBookCourseId" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason, eq.from_user_id, eq.to_user_id,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, eq.parent_id, eq.proofread_status, eq.question_path, eq.num, eq.page_index,
- eq.image question_image, eq.concise_id start_X, eq.analysis_submit_type start_Y, eq.update_type end_X, eq.es_loaded end_Y,eq.enumerate
- from kmt_exercise_questions eq left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
- where eq.book_course_id = #{bookCourseId} and eq.exercise_book_id=#{exerciseBookId}
- order by eq.num, eq.create_time
- </select>
-
- <select id="findPartQuestionByBookCourseIdNew" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index,
- eq.small_question_name small_question_index,
- eq.deal_status question_status,
- eq.create_time,
- eq.remark reason,
- eq.from_user_id,
- eq.to_user_id,
- eq.question_type question_types,
- eq.difficulty_level difficulty_levels,
- eq.real_exam_type real_exam_types,
- eq.training_skill training_skills,
- eq.parent_id,
- eq.proofread_status,
- eq.question_path,
- t.number num,
- t.page_index,
- eq.image question_image,
- eq.concise_id start_X,
- eq.analysis_submit_type start_Y,
- eq.update_type end_X,
- eq.es_loaded end_Y,
- eq.enumerate,
- eq.exercise_book_id
- FROM
- q_question_workbook t
- LEFT JOIN kmt_exercise_questions eq ON t.question_id=eq.id
- LEFT JOIN kmt_exercise_book eb ON t.sub_book_id = eb.id
- <if test="req.publishStatus==3">
- LEFT JOIN q_question_info qi on t.question_id=qi.id
- </if>
- WHERE
- eq.exercise_book_id=#{req.exerciseBookId} and t.course_name=#{req.periodId} and t.unit_name=#{req.unitId}
- <if test="req.questionType > 0">
- and eq.question_type = #{req.questionType}
- </if>
- <if test="req.publishStatus == 1">
- and eq.deal_status in (0, 1, 3, 7)
- </if>
- <if test="req.publishStatus == 2">
- and eq.deal_status in (4, 5, 8, 9, 10, 11)
- </if>
- <if test="req.publishStatus==3">
- and (qi.answer_text='略' or qi.answer='略')
- </if>
- ORDER BY
- t.page_index,
- t.number
- </select>
- <!-- 查询待加工审核的题目 -->
- <select id="findQuestionByBookCourseId" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, eq.parent_id, eq.question_path
- from kmt_exercise_questions eq
- left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
- where eq.book_course_id = #{bookCourseId}
- order by eq.num, eq.create_time
- limit 0, 5000
- </select>
- <!-- 查询打回理由记录 -->
- <select id="findQuestionRollbackRecord" resultType="com.aijia.kmt.dto.exercise.KmtExerciseQuestionRollBackInfo">
- 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,
- 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)
- left join tb_lib_manager user2 on eqr.to_user_id = user2.user_id and user2.type in (17, 18)
- where eqr.question_id = #{questionId}
- order by eqr.create_time desc limit 20;
- </select>
- <!-- 查询打回理由记录老 -->
- <select id="findQuestionRollbackRecordOld" resultType="com.aijia.kmt.dto.exercise.ExerciseQuestionRollbacks">
- select eqr.id,eqr.create_time, eqr.reason, user1.name from_user, user1.type from_type, user2.name to_user,
- user2.type to_type from kmt_exercise_question_rollback eqr left join kmt_sys_user user1 on eqr.user_id = user1.id
- left join kmt_sys_user user2 on eqr.to_user_id = user2.id
- where eqr.question_id = #{questionId} order by eqr.create_time desc limit 20;
- </select>
- <select id="countWrongAndTotal" resultType="java.util.Map">
- select sum(ifnull(scon_homework_how_details.detail_count, 0)) wrong_count,
- sum(ifnull(scon_homework_how_details.total_count, 1)) total_count
- from scon_homework_how_details,
- scon_homework
- where scon_homework_how_details.homework_id = scon_homework.id
- and scon_homework.vip_id = #{vipId}
- <if test="subject != null and subject != ''">
- and scon_homework.subject = #{subject}
- </if>
- and scon_homework.create_time >= #{beginDateTime}
- and #{endDateTime} >= scon_homework.create_time
- and scon_homework_how_details.wrong_question_id is null
- union all
- select sum(if(kmt_homework_wrong_question.type = 1, 1, 0)) wrong_count, count(*) total_count
- from kmt_homework_wrong_question,
- scon_homework
- where kmt_homework_wrong_question.homework_id = scon_homework.id
- and scon_homework.vip_id = #{vipId}
- <if test="subject != null and subject != ''">
- and scon_homework.subject = #{subject}
- </if>
- and scon_homework.create_time >= #{beginDateTime}
- and #{endDateTime} >= scon_homework.create_time
- and kmt_homework_wrong_question.is_delete = 0
- </select>
- <select id="countPlatformCorrectionKnowledgeTimes" resultType="java.util.Map">
- select zyb_know_how_details_sort.alias, count(*) count_num
- from scon_homework_how_details,
- scon_homework,
- zyb_know_how_details_sort
- where scon_homework_how_details.homework_id = scon_homework.id
- and scon_homework_how_details.how_detail_id = zyb_know_how_details_sort.how_details_id
- and scon_homework_how_details.knowledge_version = zyb_know_how_details_sort.type
- and zyb_know_how_details_sort.stat = 2
- and scon_homework.vip_id = #{vipId}
- <if test="subject != null and subject != ''">
- and scon_homework.subject = #{subject}
- </if>
- and scon_homework.create_time > #{beginDateTimeStr}
- and #{endDateTimeStr} > scon_homework.create_time
- and scon_homework_how_details.wrong_question_id is null
- group by zyb_know_how_details_sort.alias
- </select>
- <select id="findWrongQuestion" resultType="java.util.Map">
- select kmt_homework_wrong_question.homework_id, kmt_homework_wrong_question.question_id
- from kmt_homework_wrong_question,
- scon_homework
- where kmt_homework_wrong_question.homework_id = scon_homework.id
- and scon_homework.vip_id = #{vipId}
- and scon_homework.subject = #{subject}
- and scon_homework.create_time > #{beginDateTimeStr}
- and #{endDateTimeStr} > scon_homework.create_time
- and kmt_homework_wrong_question.is_delete = 0
- </select>
- <select id="countCampusCorrectionKnowledgeTimesByQuestionIds" resultType="java.util.Map">
- select khds.alias, count(distinct eqk.question_id) count_num
- from (select question_id, how_detail_sort_id
- from kmt_exercise_question_know
- where question_id in
- <foreach collection="questionIdList" open="(" item="questionId" separator="," close=")">
- #{questionId}
- </foreach>
- ) eqk, zyb_know_how_details_sort khds
- where eqk.how_detail_sort_id = khds.id
- group by khds.alias
- </select>
- <select id="countKnowledgeMastery" resultType="java.util.Map">
- (select details_sort.alias,
- <if test="subject != null and subject != ''">
- <if test="subject == '语文' || subject == '数学'">
- details_sort.two_module module,
- </if>
- <if test="subject == '英语'">
- details_sort.module module,
- </if>
- </if>
- group_concat(how_sort.alias) how_name,
- sum(ifnull(scon_homework_how_details.detail_count, 0)) wrong_count,
- sum(ifnull(scon_homework_how_details.total_count, 1)) total_count,
- group_concat(details_sort.how_details_id) know_how_detail_id_str,
- group_concat(details_sort.type) knowledge_version_str
- from scon_homework_how_details,
- scon_homework,
- zyb_know_how_details_sort details_sort,
- zyb_know_how_details_sort how_sort
- where scon_homework_how_details.homework_id = scon_homework.id
- and scon_homework_how_details.how_detail_id = details_sort.how_details_id
- and scon_homework_how_details.knowledge_version = details_sort.type
- and details_sort.stat = 2
- and how_sort.how_id = details_sort.how_id
- and how_sort.stat = 1
- and how_sort.grade_num = details_sort.grade_num
- and how_sort.semester = details_sort.semester
- and scon_homework.vip_id = #{vipId}
- <if test="subject != null and subject != ''">
- and scon_homework.subject = #{subject}
- </if>
- and scon_homework.create_time > #{beginDateTimeStr}
- and #{endDateTimeStr} > scon_homework.create_time
- and scon_homework_how_details.wrong_question_id is null
- group by details_sort.alias)
- union all
- (select details_sort.alias,
- <if test="subject != null and subject != ''">
- <if test="subject == '语文' || subject == '数学'">
- details_sort.two_module module,
- </if>
- <if test="subject == '英语'">
- details_sort.module module,
- </if>
- </if>
- group_concat(how_sort.alias) how_name,
- sum(if(kmt_homework_wrong_question.type = 1, 1, 0)) wrong_count,
- count(*) total_count,
- group_concat(details_sort.how_details_id) know_how_detail_id_str,
- group_concat(details_sort.type) knowledge_version_str
- from kmt_homework_wrong_question,
- scon_homework,
- kmt_exercise_questions,
- kmt_exercise_book_course,
- kmt_exercise_question_know,
- zyb_know_how_details_sort details_sort,
- zyb_know_how_details_sort how_sort
- where kmt_homework_wrong_question.homework_id = scon_homework.id
- and kmt_homework_wrong_question.question_id = kmt_exercise_questions.id
- and kmt_exercise_questions.book_course_id = kmt_exercise_book_course.id
- and kmt_homework_wrong_question.question_id = kmt_exercise_question_know.question_id
- and kmt_exercise_question_know.how_details_id = details_sort.how_details_id
- and details_sort.type = kmt_exercise_book_course.version
- and details_sort.stat = 2
- and how_sort.how_id = details_sort.how_id
- and how_sort.stat = 1
- and how_sort.grade_num = details_sort.grade_num
- and how_sort.semester = details_sort.semester
- and scon_homework.vip_id = #{vipId}
- <if test="subject != null and subject != ''">
- and scon_homework.subject = #{subject}
- </if>
- and scon_homework.create_time > #{beginDateTimeStr}
- and #{endDateTimeStr} > scon_homework.create_time
- and kmt_homework_wrong_question.is_delete = 0
- group by details_sort.alias)
- </select>
- <!--查询题目列表关联的知识点id列表-->
- <select id="findHowDetailIdsByQuestionIds" resultType="java.lang.String">
- select how_details_id from kmt_exercise_question_know where question_id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- group by how_details_id
- </select>
-
- <select id="countPlatformCorrectionKnowledgeMastery" resultType="java.util.Map">
- select scon_homework_how_details.how_detail_id,
- scon_homework_how_details.knowledge_version version,
- scon_homework_how_details.grade,
- scon_homework_how_details.semester,
- sum(ifnull(scon_homework_how_details.detail_count, 0)) wrong_count,
- sum(ifnull(scon_homework_how_details.total_count, 1)) total_count
- from scon_homework_how_details,
- scon_homework,
- zyb_know_how_details_sort
- where scon_homework_how_details.homework_id = scon_homework.id
- and scon_homework_how_details.how_detail_id = zyb_know_how_details_sort.how_details_id
- and scon_homework_how_details.grade = zyb_know_how_details_sort.grade
- and scon_homework_how_details.semester = zyb_know_how_details_sort.semester
- and scon_homework_how_details.knowledge_version = zyb_know_how_details_sort.type
- and scon_homework.vip_id = #{vipId}
- <if test="subject != null and subject != ''">
- and scon_homework.subject = #{subject}
- </if>
- and scon_homework.create_time > #{beginDateTimeStr}
- and #{endDateTimeStr} > scon_homework.create_time
- and scon_homework_how_details.wrong_question_id is null
- group by zyb_know_how_details_sort.alias
- </select>
- <select id="findWrongQuestion4Mastery" resultType="java.util.Map">
- select kmt_homework_wrong_question.question_id, kmt_homework_wrong_question.type
- from kmt_homework_wrong_question,
- scon_homework
- where kmt_homework_wrong_question.homework_id = scon_homework.id
- and scon_homework.vip_id = #{vipId}
- and scon_homework.subject = #{subject}
- and scon_homework.create_time > #{beginDateTimeStr}
- and #{endDateTimeStr} > scon_homework.create_time
- and kmt_homework_wrong_question.is_delete = 0
- </select>
- <select id="findKnowledgeByQuestionId" resultType="java.util.Map">
- select khds.how_details_id how_detail_id, khds.type version, khds.grade, khds.semester, khds.alias
- from (select how_detail_sort_id from kmt_exercise_question_know where question_id = #{questionId}) eqk,
- zyb_know_how_details_sort khds
- where eqk.how_detail_sort_id = khds.id
- </select>
- <!--查询未解析的题目-->
- <select id="findUnAnalysisBookCourse" resultType="com.aijia.kmt.po.KmtExerciseBookCourse">
- select distinct t1.id, t1.book_id, t1.course_name, t1.version, t1.grade,
- t1.semester, t1.book_name, t1.unit, t1.period, t1.unit_id,
- t1.period_sort, t1.unit_sort from kmt_exercise_book_course t1 left join kmt_exercise_questions t2
- on t1.id = t2.book_course_id where t1.analysis_user_id=#{analysisUserId} and t2.analysis_submit_type=0
- order by t1.unit_sort, t1.period_sort limit 0, #{maxCount}
- </select>
- <select id="findData2EsByQuestionList" resultType="java.util.Map">
- select k.id,
- k.question_id,
- k.how_details_id,
- k.how_details_kd_id,
- k.how_detail_sort_id,
- k.how_detail_kd_sort_id,
- k.version,
- date_format(k.create_time, '%Y-%m-%dT%H:%i:%s.000Z') create_time,
- book_id,
- unit_id,
- book_course_id,
- question_type,
- source,
- big_question_index,
- date_format(analysis_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') analysis_submit_time,
- page_index,
- image,
- precision_percent,
- auditing_user_id,
- handle_user_id,
- deal_status,
- remark,
- analysis_submit_type,
- answer_image,
- t.num,
- small_question_name,
- ifnull(parent_id, '') parent_id,
- big_name,
- real_exam_type,
- date_format(publish_time, '%Y-%m-%dT%H:%i:%s.000Z') publish_time,
- update_type,
- analysis_user_id,
- ifnull(difficulty_level, 0) difficulty_level,
- t.course_name,
- training_skill,
- concise_id,
- analysis_auditer_id,
- date_format(handler_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') handler_submit_time,
- date_format(analysis_handler_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') analysis_handler_submit_time,
- question_class_type,
- ifnull(khds.alias, '') knowledge_name,
- khds.course_name,
- khds.semester,
- khds.grade,
- date_format(t.repulse_time, '%Y-%m-%dT%H:%i:%s.000Z') repulse_time,
- t.exercise_book_id,
- t.question_path
- from (select *
- from kmt_exercise_question_know
- where question_id in
- <foreach collection="questionIdList" open="(" item="questionId" separator="," close=")">
- #{questionId}
- </foreach>
- limit 1000) k join kmt_exercise_questions t on k.question_id = t.id
- left join zyb_know_how_details_sort khds on k.how_detail_sort_id = khds.id
- </select>
- <select id="findAll2Es" resultType="java.util.Map">
- select k.id,
- k.question_id,
- k.how_details_id,
- k.how_details_kd_id,
- k.how_detail_sort_id,
- k.how_detail_kd_sort_id,
- k.version,
- date_format(k.create_time, '%Y-%m-%dT%H:%i:%s.000Z') create_time,
- book_id,
- unit_id,
- book_course_id,
- question_type,
- source,
- big_question_index,
- date_format(analysis_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') analysis_submit_time,
- page_index,
- image,
- precision_percent,
- auditing_user_id,
- handle_user_id,
- deal_status,
- remark,
- analysis_submit_type,
- answer_image,
- t.num,
- small_question_name,
- ifnull(parent_id, '') parent_id,
- big_name,
- real_exam_type,
- date_format(publish_time, '%Y-%m-%dT%H:%i:%s.000Z') publish_time,
- update_type,
- analysis_user_id,
- ifnull(difficulty_level, 0) difficulty_level,
- t.course_name,
- training_skill,
- concise_id,
- analysis_auditer_id,
- date_format(handler_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') handler_submit_time,
- date_format(analysis_handler_submit_time, '%Y-%m-%dT%H:%i:%s.000Z') analysis_handler_submit_time,
- question_class_type,
- ifnull(khds.alias, '') knowledge_name,
- khds.course_name,
- khds.semester,
- khds.grade,
- date_format(t.repulse_time, '%Y-%m-%dT%H:%i:%s.000Z') repulse_time,
- t.exercise_book_id,
- t.question_path
- from (select * from kmt_exercise_question_know where kmt_exercise_question_know.loaded = 0 limit #{pageSize}) k
- join kmt_exercise_questions t on k.question_id = t.id
- left join zyb_know_how_details_sort khds on k.how_detail_sort_id = khds.id
- </select>
- <select id="countQuestionByKnowledgeAndVersion" resultType="java.lang.Integer">
- select count(distinct question_id)
- from kmt_exercise_question_know
- where how_details_id in
- <foreach collection="knowledgeIdList" open="(" item="knowledgeId" separator="," close=")">
- #{knowledgeId}
- </foreach>
- and kmt_exercise_question_know.version = #{version}
- </select>
- <!--查询未加工练习册 where eb.had_handle = 0 and eb.handle_user_id=#{handleUserId}
- left join kmt_exercise_questions eq on eb.id=eq.book_id
- where eq.deal_status in (0, 1) and eb.handle_user_id=#{handleUserId}
- group by eb.id
- -->
- <select id="findUnHandleBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.part_flag != 3 and eb.had_handle=0 and eb.handle_user_id=#{handleUserId}
- <if test="bookName != null and bookName != ''">
- <choose>
- <when test="searchType == 1">
- and eb.book_name = #{bookName}
- </when>
- <otherwise>
- and eb.book_name like concat('%',#{bookName},'%')
- </otherwise>
- </choose>
- </if>
- order by eb.book_name
- </select>
- <!--查询未分配加工人练习册-->
- <select id="findUndistributedHandlerBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
- and eb.handle_user_id is null
- group by eb.book_id
- </select>
- <!--查询未审核练习册 where eb.had_auditing=0 and eb.auditing_user_id=#{auditingUserId}
- left join kmt_exercise_questions eq on eb.id=eq.book_id
- where eq.deal_status in (3, 7) and eb.auditing_user_id=#{auditingUserId}
- group by eb.id
- -->
- <select id="findUnAuditingBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.part_flag != 3 and eb.had_auditing=0 and eb.auditing_user_id=#{auditingUserId}
- <if test="bookName != null and bookName != ''">
- <choose>
- <when test="searchType == 1">
- and eb.book_name = #{bookName}
- </when>
- <otherwise>
- and eb.book_name like concat('%',#{bookName},'%')
- </otherwise>
- </choose>
- </if>
- order by eb.book_name
- </select>
- <!--查询未分配审核练习册-->
- <select id="findUndistributedAuditerBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
- and eb.auditing_user_id is null
- group by eb.book_id
- </select>
- <!--查询未加工解析的练习册-->
- <select id="findUnAnalysisHandleBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.part_flag != 3 and eb.analysis_handled=0 and eb.analysis_user_id=#{analysisUserId}
- <if test="bookName != null and bookName != ''">
- <choose>
- <when test="searchType == 1">
- and eb.book_name = #{bookName}
- </when>
- <otherwise>
- and eb.book_name like concat('%',#{bookName},'%')
- </otherwise>
- </choose>
- </if>
- order by eb.book_name
- </select>
- <!--查询未审核解析的练习册-->
- <select id="findUnAnalysisAuditingBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.part_flag != 3 and eb.analysis_audited=0 and eb.analysis_auditer_id=#{analysisAuditerId}
- <if test="bookName != null and bookName != ''">
- <choose>
- <when test="searchType == 1">
- and eb.book_name = #{bookName}
- </when>
- <otherwise>
- and eb.book_name like concat('%',#{bookName},'%')
- </otherwise>
- </choose>
- </if>
- order by eb.book_name
- </select>
- <select id="findUnCorrectAnswerBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.answer_corrected_status = 0
- <if test="bookName != null and bookName != ''">
- <choose>
- <when test="searchType == 1">
- and eb.book_name = #{bookName}
- </when>
- <otherwise>
- and eb.book_name like concat('%',#{bookName},'%')
- </otherwise>
- </choose>
- </if>
- order by eb.book_name
- </select>
- <select id="findCorrectedAnswerBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.part_flag !=3 and eb.answer_correcter_id=#{userId} and eb.proofread_status > 0
- <if test="bookName != null and bookName != ''">
- <choose>
- <when test="searchType == 1">
- and eb.book_name = #{bookName}
- </when>
- <otherwise>
- and eb.book_name like concat('%',#{bookName},'%')
- </otherwise>
- </choose>
- </if>
- order by eb.book_name
- </select>
- <!--查询未校对的练习册-->
- <select id="findExerciseBookListByIds" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where id in
- <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <!--查询所有练习册练习册-->
- <select id="findAllExerciseBooks" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- 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
- from kmt_exercise_book eb
- where eb.part_flag != 3 and eb.course_name=#{subject} and eb.semester=#{semester} and eb.version=#{versionType} and eb.grade=#{grade}
- <if test="bookName != null and bookName != ''">
- <choose>
- <when test="searchType == 1">
- and eb.book_name = #{bookName}
- </when>
- <otherwise>
- and eb.book_name like concat('%',#{bookName},'%')
- </otherwise>
- </choose>
- </if>
- order by eb.book_name
- </select>
- <!--查询待加工审核的练习册单元 -->
- <select id="findUnHandleExerciseBookCourse" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
- left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
- left join kmt_exercise_book eb on eq.exercise_book_id = eb.id
- where eq.exercise_book_id=#{bookId}
- <choose>
- <when test = "dealType == 1">
- and eq.deal_status in (0, 1) and eb.handle_user_id=#{userId}
- <if test="questionId != null and questionId != ''">
- and eq.id=#{questionId}
- </if>
- </when>
- <when test = "dealType == 2">
- and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
- <if test="questionId != null and questionId != ''">
- and eq.id=#{questionId}
- </if>
- </when>
- <when test = "dealType == 4">
- and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
- <if test="questionId != null and questionId != ''">
- and eq.id=#{questionId}
- </if>
- </when>
- <when test = "dealType == 5">
- and eq.deal_status in (9, 10) and eb.analysis_auditer_id=#{userId}
- <if test="questionId != null and questionId != ''">
- and eq.id=#{questionId}
- </if>
- </when>
- <when test = "dealType == 6">
- and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
- <if test="questionId != null and questionId != ''">
- and eq.id=#{questionId}
- </if>
- </when>
- <when test = "dealType == 7">
- and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
- <if test="questionId != null and questionId != ''">
- and eq.id=#{questionId}
- </if>
- </when>
- <otherwise>
- <if test="questionId != null and questionId != ''">
- and eq.id=#{questionId}
- </if>
- </otherwise>
- </choose>
- group by ebc.id
- order by ebc.period_sort
- </select>
-
- <!--查询不同的练习册单元 -->
- <select id="findPartExerciseBookCourse" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
- left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
- where eq.exercise_book_id=#{exerciseBookId}
- group by ebc.id
- order by ebc.period_sort
- </select>
- <!--查询待解析加工审核的练习册单元-->
- <select id="findAnalysisUnHandleExerciseBookCourse" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select ebu.id, ebu.unit name, ebc.id book_course_id, ebc.period book_course from kmt_exercise_book_unit ebu
- left join kmt_exercise_book_course ebc on ebu.id=ebc.unit_id
- left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
- where ebu.book_id=#{bookId}
- <if test = "dealType == 2">
- and ebc.had_handle = 0
- </if>
- <if test = "dealType == 1">
- and ebc.had_auditing = 0
- </if>
- <if test = "dealType == 4">
- and eq.deal_status in (5, 8)
- </if>
- <if test = "dealType == 5">
- and eq.deal_status in (9, 10)
- </if>
- group by ebc.id
- order by ebu.num, ebc.period_sort
- </select>
- <!--查询练习册下所有单元课时-->
- <select id="findAllExerciseBookCourse" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
- where (ebc.book_id = #{bookId} and ebc.is_common_flag = 0) or (ebc.exercise_book_id=#{exerciseBookId} and ebc.is_common_flag = 1)
- order by ebc.period_sort
- </select>
- <!--查询练习册下所有单元课时-->
- <select id="findAllExerciseBookCourseByExerciseBookId" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
- where ebc.exercise_book_id=#{exerciseBookId}
- order by ebc.period_sort
- </select>
- <!--查询未加工/未审核的题目数量-->
- <select id ="findUnHandleQuestionCount" resultType="java.lang.Integer">
- select count(1) from kmt_exercise_questions where book_course_id=#{bookCourseId}
- and id not in
- <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- <if test = "dealType == 2">
- and deal_status in (3, 7)
- </if>
- <if test = "dealType == 1">
- and deal_status < 2
- </if>
- </select>
- <!--查询未加工/未审核的课时数量-->
- <select id="findUnHandleBookCourseCount" resultType="java.lang.Integer">
- select count(1) from kmt_exercise_book_course where unit_id=#{unitId}
- and id != #{bookCourseId}
- <if test = "dealType == 2">
- and had_auditing = 0
- </if>
- <if test = "dealType == 1">
- and had_handle = 0
- </if>
- </select>
- <!--查询未加工/未审核的单元数量-->
- <select id="findUnHandleUnitCount" resultType="java.lang.Integer">
- select count(1) from kmt_exercise_book_unit where book_id=#{bookId}
- and id != #{unitId}
- <if test = "dealType == 2">
- and had_auditing = 0
- </if>
- <if test = "dealType == 1">
- and had_handle = 0
- </if>
- </select>
- <!--查询搜索的题目-->
- <select id="findKmtQuestionsById" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.num small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, parent_id, image question_image, eq.update_type
- from kmt_exercise_questions eq
- where (eq.id=#{questionId} or eq.parent_id=#{questionId}) and eq.question_class_type in (0, 2) and eq.book_id is null
- <choose>
- <when test="dealType == 1">
- and eq.handle_user_id = #{userId} and eq.deal_status < 2
- </when>
- <when test="dealType == 2">
- and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
- </when>
- <otherwise>
- and eq.deal_status != 6
- </otherwise>
- </choose>
- order by eq.num
- </select>
- <!--根据知识点分页查询题目-->
- <select id="findKmtQuestionByDetailId" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, parent_id, image question_image
- from kmt_exercise_questions eq
- left join kmt_exercise_question_know eqk on eq.id = eqk.question_id
- where eqk.how_detail_sort_id = #{howDetailsId}
- <if test = "howDetailsKdId != null and howDetailsKdId != ''">
- and eqk.how_detail_kd_sort_id= #{howDetailsKdId}
- </if>
- 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))
- or (eq.parent_id is not null and eq.parent_id != ''))
- <choose>
- <when test="dealType == 1">
- and eq.handle_user_id = #{userId} and eq.deal_status < 2
- </when>
- <when test="dealType == 2">
- and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
- </when>
- <otherwise>
- and eq.deal_status != 6
- </otherwise>
- </choose>
- <if test="userIdList.size() > 0">
- and (
- eq.handle_user_id in
- <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- OR
- eq.auditing_user_id in
- <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- )
- </if>
- group by eq.id
- order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
- </select>
- <!--根据年级,科目,版本,上下册分页查询题目-->
- <select id="findKmtQuestionByGradeSubjectVersionSemester" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, parent_id, image question_image
- from kmt_exercise_questions eq
- left join zyb_know_how_details_sort khds on eq.concise_id=khds.id
- where eq.book_id is null and eq.question_class_type in (0, 2)
- <if test = "grade != null and grade != ''">
- and khds.grade = #{grade}
- </if>
- <if test = "courseName != null and courseName != ''">
- and khds.course_name = #{courseName}
- </if>
- <if test = "type > 0">
- and khds.type = #{type}
- </if>
- <if test = "semester > 0">
- and khds.semester = #{semester}
- </if>
- <choose>
- <when test="dealType == 1">
- and eq.handle_user_id = #{userId} and eq.deal_status < 2
- </when>
- <when test="dealType == 2">
- and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
- </when>
- <otherwise>
- and eq.deal_status != 6
- </otherwise>
- </choose>
- <if test="userIdList.size() > 0">
- and (
- eq.handle_user_id in
- <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- OR
- eq.auditing_user_id in
- <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- )
- </if>
- group by eq.id
- order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
- </select>
- <!--分页查询所有题目-->
- <select id="findAllKmtQuestions" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, eq.parent_id, image question_image
- from kmt_exercise_questions eq
- 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))
- or (eq.parent_id is not null and eq.parent_id != ''))
- <choose>
- <when test="dealType == 1">
- and eq.handle_user_id = #{userId} and eq.deal_status < 2
- </when>
- <when test="dealType == 2">
- and eq.auditing_user_id = #{userId} and eq.deal_status in (3, 7)
- </when>
- <otherwise>
- and eq.deal_status != 6
- </otherwise>
- </choose>
- <if test="userIdList.size() > 0">
- and (
- eq.handle_user_id in
- <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- OR
- eq.auditing_user_id in
- <foreach collection="userIdList" index="i" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- )
- </if>
- group by eq.id
- order by eq.handler_submit_time, eq.parent_id, eq.num, eq.id
- </select>
- <!--查询小题-->
- <select id="findSmallQuestionByParentIds" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, eq.parent_id, image question_image
- from kmt_exercise_questions eq
- where eq.parent_id in
- <foreach collection="parentIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- and eq.deal_status != 6
- order by eq.parent_id, eq.num
- </select>
- <!--查询大题-->
- <select id="findBigQuestionById" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, eq.parent_id, image question_image,eq.update_type
- from kmt_exercise_questions eq
- where eq.id = #{id}
- </select>
- <!--查询题目的知识点-->
- <select id="findQuestionKnowByQuestionIds" resultType="com.aijia.kmt.dto.QuestionListKnowModel">
- SELECT * from (
- select eqk.question_id, hds.id how_details_id, hds.alias detail_name, hdks.id how_details_kd_id, hdks.alias
- kd_name,
- hds.grade, hds.course_name, hds.type version_type, hds.semester, khd.is_zt module_type, hs.alias how_name,
- hds.num, hdks.num as num2
- from tr_train_user_question_know eqk
- left join zyb_know_how_details_sort hds on eqk.how_detail_sort_id=hds.id
- 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
- left join zyb_know_how_details_sort hdks on eqk.how_detail_kd_sort_id=hdks.id
- left join zyb_know_how_details khd on hds.how_details_id=khd.id
- where question_id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- and eqk.user_id = #{userId}
- union all
- select eqk1.question_id, hds1.id how_details_id, hds1.alias detail_name, hdks1.id how_details_kd_id, hdks1.alias
- kd_name,
- hds1.grade, hds1.course_name, hds1.type version_type, hds1.semester, khd1.is_zt module_type, hs1.alias how_name,
- hds1.num, hdks1.num as num2
- from kmt_exercise_question_know eqk1
- left join zyb_know_how_details_sort hds1 on eqk1.how_detail_sort_id=hds1.id
- left join zyb_know_how_details_sort hs1 on hds1.how_id=hs1.how_id and hds1.type=hs1.type and
- hds1.semester=hs1.semester and hds1.grade=hs1.grade and hs1.stat=1
- left join zyb_know_how_details_sort hdks1 on eqk1.how_detail_kd_sort_id=hdks1.id
- left join zyb_know_how_details khd1 on hds1.how_details_id=khd1.id
- where question_id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>and question_id not in (
- select question_id from tr_train_user_question_know where user_id = #{userId}
- )
- )t order by t.question_id, t.num, t.num2
- </select>
- <!--查询kmt题目的知识点-->
- <select id="findKmtQuestionKnowByQuestionIds" resultType="com.aijia.kmt.dto.QuestionListKnowModel">
- select eqk.question_id, hds.id how_details_id, hds.alias detail_name, hdks.id how_details_kd_id, hdks.alias kd_name,
- hds.grade, hds.course_name, hds.type version_type, hds.semester, khd.is_zt module_type, hs.alias how_name
- from kmt_quality_question_know eqk
- left join zyb_know_how_details_sort hds on eqk.how_detail_sort_id=hds.id
- 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
- left join zyb_know_how_details_sort hdks on eqk.how_detail_kd_sort_id=hdks.id
- left join zyb_know_how_details khd on hds.how_details_id=khd.id
- where question_id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- order by eqk.question_id, hds.num, hdks.num
- </select>
- <!--通过子题目id查询父题目-->
- <select id="findPrentQuestionByChildQuestionId" resultType="com.aijia.kmt.po.KmtExerciseQuestion">
- select parent.* from kmt_exercise_questions child left join kmt_exercise_questions parent on child.parent_id=parent.id
- where child.id=#{questionId} and parent.id is not null
- </select>
- <!-- 查询练习册记录-->
- <select id="findExerciseBookById" resultType="com.aijia.kmt.po.KmtExerciseBook">
- select * from kmt_exercise_book where id=#{bookId}
- </select>
- <select id="findExerciseBookByBookIdAndYearAndType" resultType="com.aijia.kmt.po.KmtExerciseBook">
- select id, book_id from kmt_exercise_book where book_id=#{bookId} and book_year=#{bookYear}
- and book_type=#{bookType}
- limit 1
- </select>
- <!-- 查询练习册单元课时-->
- <select id="findByBookIds" resultType="com.aijia.kmt.po.KmtExerciseBookCourse">
- select eb.id book_id, ebc.book_name, ebc.unit_id, ebc.unit, ebc.id, ebc.period, ebc.grade,
- ebc.course_name, ebc.version, ebc.semester, eb.part_flag remark from kmt_exercise_book_course ebc
- left join kmt_exercise_book eb on ebc.book_id=eb.book_id where eb.id in
- <foreach collection="bookIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- order by eb.id,ebc.unit_sort,ebc.period_sort limit 5000
- </select>
- <!-- 删除加工的知识点 -->
- <delete id="deleteKmtExerciseQuestionKnowByQuestionIds">
- delete from tr_train_user_question_know where question_id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- and user_id = #{userId}
- </delete>
- <delete id="deleteKmtExerciseBookStatusCountByExerciseBookIds">
- delete from kmt_exercise_book_status_count where exercise_book_id in
- <foreach collection="exerciseBookIdSet" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </delete>
- <!-- 题目提交审核 -->
- <update id="updateKmtExerciseQuestion2Review">
- UPDATE kmt_exercise_questions set deal_status=3 WHERE id in
- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </update>
- <update id="updateLoadStatus">
- update kmt_exercise_question_know set loaded = 1 where loaded = 0 and id in
- <foreach collection="kmtExerciseQuestionKnowIdList" open="(" item="id" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <!--更新练习册为未加工-->
- <update id="updateKmtExerciseBookNotHandle">
- update kmt_exercise_book set had_handle=0 where id=#{id}
- </update>
- <!--更新练习册为未审核-->
- <update id="updateKmtExerciseBookNotAuditing">
- update kmt_exercise_book set had_auditing=0 where id=#{id}
- </update>
- <!--更新练习册为解析未加工-->
- <update id="updateKmtExerciseBookAnalysisNotHandle">
- update kmt_exercise_book set analysis_handled=0 where id=#{id}
- </update>
- <!--更新练习册为解析未审核-->
- <update id="updateKmtExerciseBookAnalysisNotAuditing">
- update kmt_exercise_book set analysis_audited=0 where id=#{id}
- </update>
- <!--更新练习册课时为未加工-->
- <update id="updateKmtExerciseBookCourseNotHandle">
- update kmt_exercise_book_course set had_handle=0, had_auditing=0 where id=#{id}
- </update>
- <!--更新练习册课时为未审核-->
- <update id="updateKmtExerciseBookCourseNotAuditing">
- update kmt_exercise_book_course set had_auditing=0 where id=#{id}
- </update>
- <update id="updateExerciseQuestionKnowEsLoadStatus">
- update kmt_exercise_question_know set loaded = #{newLoaded}
- where id in
- <foreach collection="kmtExerciseQuestionKnowIdList" open="(" item="kmtExerciseQuestionKnowId" separator="," close=")">
- #{kmtExerciseQuestionKnowId}
- </foreach>
- </update>
- <select id="getBookId" resultType="String" parameterType="java.util.Map">
- select id
- from kmt_exercise_book eb
- where eb.course_name = #{map.subject}
- and eb.grade = #{map.grade}
- and eb.semester = #{map.semester}
- and eb.book_type in (0, 1, 3)
- and not exists (
- select 1 from scon_homework_exercise_except t1
- where t1.school = #{map.school}
- and t1.grade = #{map.grade}
- and t1.course_name = #{map.subject}
- and eb.book_id = t1.except_book_id
- )
- <if test='map.version != null and map.version > 0'>
- and version = #{map.version}
- </if>
- </select>
- <sql id="exercisePublic" >
- t.id exerciseBookId,
- t.url1,
- t.url2,
- t.book_name bookName,
- t.press,
- t.course_name subject,
- t.grade,
- t.version,
- t.version_name versionName,
- t.semester,
- t.print_year printYear,
- t.book_year bookYear,
- t.book_year useYear,
- t.status,
- t.org_nums orgNums,
- t.progress,
- if(t.progress = '已发布', date(t.publish_time), '') publishDate,
- t.total_grade_priority priority,
- t.identified_nums identifiedNums,
- t.answer_correcter_id answerCorrecterId,
- t.book_type,
- t.check_time checkTime,
- t.ai_rollback_import aiRollbackImport,
- t.updated_time,
- t.assigned_batch,
- date(t.allot_check_time) allotCheckTime
- </sql>
- <select id="findExerciseList" resultType="com.aijia.kmt.dto.Exercise1Dto" parameterType="java.util.Map">
- select
- <include refid="exercisePublic" />
- ,wb.book_question_pdf,
- wb.book_answer_pdf
- from kmt_exercise_book t
- left join q_workbook wb on t.parent_book_id=wb.id
- where 1=1
- <!--未校对-->
- <if test='map.proofreadStatus == "0" '>
- and not exists (
- select 1 from kmt_exercise_book_status_count t1
- where t.id = t1.exercise_book_id
- and t1.data_status = 1
- and t1.status > 0
- and t1.status < 5
- )
- and t.status is not null
- and t.proofread_status = 0
- and t.answer_correcter_id is null
- and t.part_flag != 3
- </if>
- <if test="map.bookType != null and map.bookType != '' ">
- and t.book_type = ${map.bookType}
- </if>
- <if test="map.progress != null and map.progress != '' ">
- and t.progress = #{map.progress}
- </if>
- <if test="map.subject != null and map.subject != '' ">
- and t.course_name = #{map.subject}
- </if>
- <if test="map.grade != null and map.grade != '' ">
- and t.grade = #{map.grade}
- </if>
- <if test="map.bookName != null and map.bookName != '' ">
- <choose>
- <when test="map.searchType == 1">
- and t.book_name = #{map.bookName}
- </when>
- <otherwise>
- and t.book_name like concat('%',#{map.bookName},'%')
- </otherwise>
- </choose>
- </if>
- <if test="map.semester != null and map.semester != ''">
- and t.semester = #{map.semester}
- </if>
- <if test="map.versionName != null and map.versionName != '' ">
- and t.version_name = #{map.versionName}
- </if>
- <if test="map.bookYear != null and map.bookYear != '' ">
- and t.book_year = #{map.bookYear}
- </if>
- <if test="map.assignedBatch != null and map.assignedBatch != '' ">
- and t.assigned_batch like concat('%',#{map.assignedBatch},'%')
- </if>
- <if test="map.versionType != null and map.versionType != ''">
- and t.version =#{map.versionType}
- </if>
- order by t.updated_time desc,t.book_name
- </select>
- <select id="findTeacherExerciseList" resultType="com.aijia.kmt.dto.Exercise1Dto" parameterType="java.util.Map">
- select
- <include refid="exercisePublic" />
- ,t1.name teacherName, t1.user_id, t.create_time
- from kmt_exercise_book t
- left join tb_lib_manager t1 on t.answer_correcter_id = t1.user_id
- and t1.type = 17
- and t1.authority = 8
- and t1.state = 1
- where 1=1
- <if test="map.teacherName != null and map.teacherName != '' ">
- and t1.name regexp #{map.teacherName}
- </if>
- <if test="map.exerciseName != null and map.exerciseName != '' ">
- and t.book_name regexp #{map.exerciseName}
- </if>
- <if test="map.beginTime != null and map.beginTime != '' ">
- and t.check_time >= #{map.beginTime}
- </if>
- <if test="map.endTime != null and map.endTime != '' ">
- and t.check_time <= #{map.endTime}
- </if>
- <if test="map.versionType != null and map.versionType != ''">
- and t.version =#{map.versionType}
- </if>
- <if test="map.bookType != null and map.bookType != ''">
- and t.book_type =#{map.bookType}
- </if>
- <if test="map.grade != null and map.grade != ''">
- and t.grade =#{map.grade}
- </if>
- <if test="map.subject != null and map.subject != ''">
- and t.course_name =#{map.subject}
- </if>
- <if test="map.semester != null and map.semester != ''">
- and t.semester =#{map.semester}
- </if>
- <if test="map.allotCheckTime != null and map.allotCheckTime != ''">
- and t.allot_check_time BETWEEN concat(#{map.allotCheckTime},' 00:00:00') AND concat(#{map.allotCheckTime},' 23:59:59')
- </if>
- <!--校对中-->
- <if test='map.type == "1" '>
- and t.part_flag != 3
- and t.answer_corrected_status = 0
- and t.answer_correcter_id is not null
- order by t1.name,t1.user_id,t.book_name
- </if>
- <!--已校对-->
- <if test='map.type == "2" '>
- and t.part_flag != 3
- and t.answer_corrected_status = 1
- order by t1.name,t1.user_id,t.book_name,t.create_time asc
- </if>
- </select>
- <select id="findLastExerciseRollbackByQuestionId" resultType="com.aijia.kmt.po.KmtExerciseQuestionRollback">
- select * from kmt_exercise_question_rollback where question_id=#{questionId} order by create_time desc limit 1
- </select>
- <select id="findLibList" resultType="com.aijia.kmt.po.TbLibJoin" parameterType="java.util.Map">
- select t1.*
- from tb_lib_join t1
- where 1=1
- and t1.type = 1
- <if test="map.name != null and map.name != '' ">
- and t1.league_name regexp #{map.name}
- </if>
- and exists (
- select 1 from fx_merchant t2 where t1.id = t2.lib_id and t2.sign_service > 0
- )
- order by t1.league_name
- </select>
- <select id="findExerciseBookCount" resultType="com.aijia.kmt.dto.ExerciseBookCountDTO">
- select status,
- count(*) totalCount,
- sum(if(course_name = '语文', 1, 0)) chineseCount,
- sum(if(course_name = '数学', 1, 0)) mathCount,
- sum(if(course_name = '英语', 1, 0)) englishCount
- from kmt_exercise_book_status_count
- where data_status = 1
- group by status
- </select>
- <select id="findAllLib" resultType="java.util.Map">
- select t1.lib_id libId,t3.league_lat leagueLet,t3.league_lng leagueLng,t3.league_name leagueName, ifNull(t4.sign_service,0) signService
- from kmt_exercise_book_lib t1
- left join kmt_exercise_book t2 on t1.exercise_book_id =t2.id and t1.is_delete=0
- left join tb_lib_join t3 on t1.lib_id=t3.id
- left join fx_merchant t4 on t1.lib_id=t4.lib_id
- where t1.lib_id is not null and t1.lib_id !=''
- <if test="subject != null and subject != '' ">
- and t2.course_name=#{subject}
- </if>
- and t1.is_delete=0
- and t4.sign_service!=0
- and t4.sign_service is not null
- group by libId
- </select>
- <select id="findAllExerciseBook" resultType="com.aijia.kmt.dto.exercise.KmtExerciseBookLibDto">
- select distinct t1.book_id bookId, t1.book_name exerciseName,t1.version_name version,t1.total_grade_priority priority,t1.semester,t1.grade,t1.progress progress,t1.total_grade_priority totalPriority,t1.create_time createTime
- from kmt_exercise_book_lib t
- left join kmt_exercise_book t1 on t.exercise_book_id =t1.id
- where t.lib_id=#{libId}
- and t1.course_name=#{subject}
- and t.is_delete=0
- </select>
- <select id="findAllExportLib" resultType="java.util.Map">
- select distinct t1.exercise_book_id bookId, t1.lib_id libId,t3.league_lat leagueLet,t3.league_lng leagueLng,t3.league_name leagueName,ifNull(t4.sign_service,0)signService
- from kmt_exercise_book_lib t1
- left join kmt_exercise_book t2 on t1.exercise_book_id =t2.id
- left join tb_lib_join t3 on t1.lib_id=t3.id
- left join fx_merchant t4 on t1.lib_id=t4.lib_id
- where t1.lib_id is not null
- <if test="subject != null and subject != '' ">
- and t2.course_name=#{subject}
- </if>
- and t1.is_delete=0
- </select>
- <select id="findQuestionByParentId" resultType="com.aijia.kmt.po.KmtExerciseQuestion">
- select * from kmt_exercise_questions where (id in
- <foreach collection="parentIds" open="(" item="id" separator="," close=")">
- #{id}
- </foreach>or parent_id in
- <foreach collection="parentIds" open="(" item="id" separator="," close=")">
- #{id}
- </foreach>
- ) and deal_status != 6
- order by num
- limit 2000
- </select>
- <select id="findKmtExerciseQuestionRollbackListByQuestionId" resultType="com.aijia.kmt.po.KmtExerciseQuestionRollback">
- select * from kmt_exercise_question_rollback where question_id= #{questionId} order by create_time desc
- </select>
- <select id="findByUserIdAndTypeIn" resultType="com.aijia.kmt.po.user.TbLibManager">
- select * from tb_lib_manager where user_id= #{userId}
- and type in(17,18) order by state, is_cancelled limit 1
- </select>
- <select id="findLibSignCount" resultType="com.aijia.kmt.dto.ExercisePriorityDto">
- 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
- on t1.lib_id=t2.lib_id
- where t1.exercise_book_id is not null
- and t1.is_delete=0
- limit 10000
- </select>
- <select id="findExerciseQuestionByExerciseBookId" resultType="com.aijia.kmt.po.KmtExerciseQuestion">
- select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
- eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
- eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
- eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
- eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
- 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,
- eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time, eq.handler_submit_time,
- eq.proofread_status, eq.question_path
- from kmt_exercise_questions eq
- left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eq.exercise_book_id=#{exerciseBookId} limit 10000
- </select>
- <select id="findExerciseQuestionByIds" resultType="com.aijia.kmt.po.KmtExerciseQuestion">
- select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
- eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
- eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
- eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
- eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
- 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,
- eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time, eq.handler_submit_time,
- eq.proofread_status, eq.question_path, eq.concise_id
- from kmt_exercise_questions eq
- left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eq.id in
- <foreach collection="ids" open="(" item="id" separator="," close=")">
- #{id}
- </foreach>
- limit 10000
- </select>
- <!--更新练习册涉及到的机构签约数-->
- <update id="updateKmtExerciseBookByExerciseBookId">
- update kmt_exercise_book set exercise_relevancy_num=#{exerciseRelevancyNum} where id=#{exerciseBooId}
- </update>
- <select id="findAllExerciseBookBySignNum" resultType="com.aijia.kmt.po.KmtExerciseBook">
- select * from kmt_exercise_book
- where
- exercise_relevancy_num !=0
- and exercise_relevancy_num is not null
- order by exercise_relevancy_num desc
- limit 10000
- </select>
- <select id="findAnswerProofreadExerciseBookList"
- resultType="com.aijia.kmt.dto.AnswerProofreadExerciseBookDTO">
- select distinct t1.id exerciseBookId,
- t1.book_name,
- t1.course_name subject,
- t1.grade,
- t1.version,
- t1.semester,
- t1.proofread_status,
- t1.book_type,
- t1.latest_answer_wrong_date_time proofreadDate,
- t3.name
- from kmt_exercise_book t1 left join tb_lib_manager t3
- on t1.answer_correcter_id=t3.user_id
- and t3.type=17 and t3.authority=8 and t3.state=1
- where t1.proofread_status in (2, 3)
- <if test="req.subject != null and req.subject != ''">
- and t1.course_name = #{req.subject}
- </if>
- <if test="req.grade != null and req.grade != ''">
- and t1.grade = #{req.grade}
- </if>
- <if test="req.bookName != null and req.bookName != ''">
- and t1.book_name like concat('%',#{req.bookName},'%')
- </if>
- <if test="req.proofreadDate != null and req.proofreadDate != ''">
- and date(t1.latest_answer_wrong_date_time) = #{req.proofreadDate}
- </if>
- order by t1.proofread_status,t1.latest_answer_wrong_date_time desc
- </select>
- <select id="findQuestionListAnswerWrong" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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, eq.big_question_index,
- eq.small_question_name small_question_index,
- eq.deal_status question_status, eq.create_time, eq.remark reason, eq.question_type question_types,
- eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, eq.parent_id, eq.question_path,eq.num, eq.image question_image
- from kmt_exercise_questions eq
- where eq.exercise_book_id = #{req.exerciseBookId}
- and eq.book_course_id = #{req.periodId}
- and eq.proofread_status = 2
- order by eq.num, eq.create_time
- </select>
- <select id="findRepulsedQuestion" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index,
- eq.small_question_name small_question_index,
- eq.deal_status question_status,
- eq.create_time,
- eq.remark reason,
- eq.from_user_id,
- eq.to_user_id,
- eq.question_type question_types,
- eq.difficulty_level difficulty_levels,
- eq.real_exam_type real_exam_types,
- eq.training_skill training_skills,
- eq.parent_id,
- eq.question_path,
- eq.num
- from kmt_exercise_questions eq
- left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
- where eq.exercise_book_id = #{req.exerciseBookId}
- and eq.deal_status in
- <foreach collection="dealStatusList" open="(" item="dealStatus" separator="," close=")">
- #{dealStatus}
- </foreach>
- order by eq.num, eq.create_time, eq.deal_status
- limit 0, 5000
- </select>
- <update id="updateKmtExerciseBookById">
- update kmt_exercise_book set priority=#{priority} where id=#{id}
- </update>
- <update id="updateKmtExerciseBookByPriority">
- update kmt_exercise_book set total_grade_priority=#{totalGradePriority} where id=#{id}
- </update>
- <select id="findUnproofreadExerciseId" resultType="java.util.Map">
- select id from kmt_exercise_book eb where eb.answer_correcter_id is not null
- </select>
- <select id="findExerciseStatusByBookId" resultType="com.aijia.kmt.po.KmtExerciseQuestion">
- select eq.* from kmt_exercise_questions eq left join kmt_exercise_book eb on eq.exercise_book_id=eb.id where eb.answer_correcter_id is not null and eq.book_id=#{bookId}
- </select>
- <update id="updateExerciseBookStatusByIdAndStatus">
- update kmt_exercise_book set proofread_status=#{proofreadStatus} where id=#{id}
- </update>
- <update id="updateExerciseBookProofreadResult">
- update kmt_exercise_book set proofread_status=#{type}, latest_answer_wrong_date_time = now() where id=#{exerciseBookId}
- </update>
- <select id="countAnswerWrongQuestion" resultType="java.lang.Integer">
- select count(*) from kmt_exercise_questions where exercise_book_id = #{exerciseBookId} and proofread_status = 2 and deal_status not in (2, 6)
- and id not in
- <foreach collection="excludeQuestionIdSet" open="(" item="id" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="teacherAnswerProofreadDetail" resultType="java.util.Map">
- select count(1) total,sum(answer_corrected_status) finishedNums
- from kmt_exercise_book
- where answer_correcter_id = #{userId}
- </select>
- <select id="findUnitAndPeriodList" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course
- from kmt_exercise_book_course ebc
- where ebc.id in (select distinct book_course_id
- from kmt_exercise_questions
- where exercise_book_id = #{request.exerciseBookId} and proofread_status = 2)
- </select>
- <select id="findKmtExerciseQuestionErrorsByQuestionIds" resultType="com.aijia.kmt.po.KmtExerciseQuestionErrors">
- select * from kmt_exercise_question_errors where question_id in
- <foreach collection="questionIds" open="(" item="id" close=")" separator=",">
- #{id}
- </foreach>
- and error_user_auth=#{beType}
- </select>
- <select id="findKmtExerciseQuestionByErrorUserId" resultType="com.aijia.kmt.po.KmtExerciseQuestionErrors">
- select * from kmt_exercise_question_errors where error_user_id=#{userId}
- and exercise_book_id=#{exerciseBookId}
- order by create_time desc
- </select>
- <select id="countQuestionErrorCountByExerciseBookId" resultType="java.lang.Integer">
- select count(1) from kmt_exercise_question_errors where exercise_book_id=#{exerciseBookId}
- and error_user_id=#{userId} and error_user_auth=#{type}
- </select>
- <select id="findSameExerciseBookList" resultType="com.aijia.kmt.po.KmtExerciseBook">
- SELECT t.*
- FROM kmt_exercise_book t,
- (select book_name,
- course_name,
- grade,
- version_name,
- semester,
- book_type,
- book_year,
- COUNT(book_name) c1,
- COUNT(course_name) c2,
- COUNT(grade) c3,
- COUNT(version_name) c4,
- COUNT(semester) c5,
- COUNT(book_type) c6,
- COUNT(book_year) c7
- from kmt_exercise_book
- group by book_name, course_name, grade, version_name, semester, book_type, book_year
- HAVING c1 > 1
- and c2 > 1
- and c3 > 1
- and c4 > 1
- and c5 > 1
- and c6 > 1
- and c7 > 1) t1
- where t.book_name = t1.book_name
- and t.course_name = t1.course_name
- and t.grade = t1.grade
- and t.version_name = t1.version_name
- and t.semester = t1.semester
- and t.book_type = t1.book_type
- and t.book_year = t1.book_year
- order by t.book_name, t.course_name, t.grade, t.version_name, t.semester, t.book_type, t.book_year, t.part_flag
- </select>
- <select id="countUnFinishQuestionsByExerciseBookId" resultType="java.lang.Integer">
- select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
- <if test="type == 1">
- and deal_status in (0, 1)
- </if>
- <if test="type == 2">
- and deal_status in (3, 7)
- </if>
- <if test="type == 3">
- and deal_status in (5, 8)
- </if>
- <if test="type == 4">
- and deal_status in (9, 10)
- </if>
- </select>
- <select id="findDistributionCount"
- resultType="com.aijia.kmt.dto.ExerciseDistributionCountDTO">
- select sum(if(handle_user_id is null or auditing_user_id is null or analysis_user_id is null or
- analysis_auditer_id is null, 1, 0)) notDistributedExerciseBookCount,
- count(*) totalExerciseBookCount
- from kmt_exercise_book
- where part_flag <> 3
- </select>
- <select id="findDistributionExerciseBookList" resultMap="DistributionExerciseBookDTOResultMap">
- select eb.exerciseBookId,
- eb.importDate,
- eb.subject,
- eb.grade,
- eb.version_name,
- eb.semester,
- eb.book_name,
- eb.book_type,
- eb.assigned_batch,
- (select count(distinct unit_name) from q_question_workbook where sub_book_id = eb.exerciseBookId) unitNum,
- (select count(distinct unit_name, course_name) from q_question_workbook where sub_book_id = eb.exerciseBookId) courseNum,
- ebcHandle.accuracy intHandleAccuracy,
- ebcHandleAudit.accuracy intHandleAuditAccuracy,
- ebcAnalysis.accuracy intAnalysisAccuracy,
- ebtrHandle.teacher_id handlerTeacherId,
- ebtrHandle.teacher_name handlerName,
- ebtrHandle.salary_given handlerSalaryGiven,
- ebtrHandle.salary_given_time handlerSalaryGivenTime,
- ebtrHandle.create_time handlerDistributeTime,
- ebtrHandleAudit.teacher_id handlerAuditUserTeacherId,
- ebtrHandleAudit.teacher_name handlerAuditUserName,
- ebtrHandleAudit.salary_given handlerAuditUserSalaryGiven,
- ebtrHandleAudit.salary_given_time handlerAuditUserSalaryGivenTime,
- ebtrHandleAudit.create_time handlerAuditUserDistributeTime,
- ebtrAnalysis.teacher_id analyserTeacherId,
- ebtrAnalysis.teacher_name analyserName,
- ebtrAnalysis.salary_given analyserSalaryGiven,
- ebtrAnalysis.salary_given_time analyserSalaryGivenTime,
- ebtrAnalysis.create_time analyserDistributeTime,
- ebtrAnalysisAudit.teacher_id analysisAuditUserTeacherId,
- ebtrAnalysisAudit.teacher_name analysisAuditUserName,
- ebtrAnalysisAudit.salary_given analysisAuditUserSalaryGiven,
- ebtrAnalysisAudit.salary_given_time analysisAuditUserSalaryGivenTime,
- ebtrAnalysisAudit.create_time analysisAuditUserDistributeTime
- from (select id exerciseBookId,
- create_time importDate,
- course_name subject,
- grade,
- version_name,
- semester,
- book_name,
- book_type,
- handle_user_id,
- auditing_user_id,
- analysis_user_id,
- analysis_auditer_id,
- assigned_batch
- from kmt_exercise_book
- where (3 > part_flag or part_flag > 3)
- <if test="req.type == 1">
- and (
- <choose>
- <when test="(req.handler != null and req.handler > 0) or
- (req.handleAuditUser != null and req.handleAuditUser > 0) or
- (req.analyser != null and req.analyser > 0) or
- (req.analysisAuditUser != null and req.analysisAuditUser > 0)">
- <trim suffixOverrides="and">
- <if test="req.handler != null and req.handler > 0">
- handle_user_id is null and
- </if>
- <if test="req.handleAuditUser != null and req.handleAuditUser > 0">
- auditing_user_id is null and
- </if>
- <if test="req.analyser != null and req.analyser > 0">
- analysis_user_id is null and
- </if>
- <if test="req.analysisAuditUser != null and req.analysisAuditUser > 0">
- analysis_auditer_id is null and
- </if>
- </trim>
- </when>
- <otherwise>
- handle_user_id is null
- or auditing_user_id is null
- or analysis_user_id is null
- or analysis_auditer_id is null
- </otherwise>
- </choose>
- )
- </if>
- <if test="req.type == 2">
- and (handle_user_id is not null
- and auditing_user_id is not null
- and analysis_user_id is not null
- and analysis_auditer_id is not null)
- </if>
- <if test="req.bookName != null and req.bookName != ''">
- <choose>
- <when test="req.searchType == 1">
- and book_name = #{req.bookName}
- </when>
- <otherwise>
- and book_name like '%${req.bookName}%'
- </otherwise>
- </choose>
- </if>
- <if test="req.subject != null and req.subject != ''">
- and course_name = #{req.subject}
- </if>
- <if test="req.grade != null and req.grade != ''">
- and grade = #{req.grade}
- </if>
- <if test="req.version != null and req.version > 0">
- and version = #{req.version}
- </if>
- <if test="req.semester != null and req.semester > 0">
- and semester = #{req.semester}
- </if>
- <if test="req.bookType != null and req.bookType > -1">
- and book_type = #{req.bookType}
- </if>
- <if test="req.startTime != null and req.startTime != ''">
- and create_time > #{req.startTime}
- </if>
- <if test="req.endTime != null and req.endTime != ''">
- and '${req.endTime} 23:59:59' > create_time
- </if>
- <if test="req.assignedBatch != null and req.assignedBatch != ''">
- and assigned_batch like '%${req.assignedBatch}%'
- </if>
- order by create_time desc
- limit #{offset}, #{pageSize}) eb
- left join kmt_exercise_book_teacher_record ebtrHandle
- on eb.exerciseBookId = ebtrHandle.exercise_book_id and ebtrHandle.authority_type = 1
- left join kmt_exercise_book_count ebcHandle
- on eb.exerciseBookId = ebcHandle.exercise_book_id and ebcHandle.type = 1
- left join kmt_exercise_book_teacher_record ebtrHandleAudit
- on eb.exerciseBookId = ebtrHandleAudit.exercise_book_id and ebtrHandleAudit.authority_type = 2
- left join kmt_exercise_book_count ebcHandleAudit
- on eb.exerciseBookId = ebcHandleAudit.exercise_book_id and ebcHandleAudit.type = 2
- left join kmt_exercise_book_teacher_record ebtrAnalysis
- on eb.exerciseBookId = ebtrAnalysis.exercise_book_id and ebtrAnalysis.authority_type = 3
- left join kmt_exercise_book_count ebcAnalysis
- on eb.exerciseBookId = ebcAnalysis.exercise_book_id and ebcAnalysis.type = 3
- left join kmt_exercise_book_teacher_record ebtrAnalysisAudit
- on eb.exerciseBookId = ebtrAnalysisAudit.exercise_book_id and ebtrAnalysisAudit.authority_type = 4
- left join kmt_exercise_book_count ebcAnalysisAudit
- on eb.exerciseBookId = ebcAnalysisAudit.exercise_book_id and ebcAnalysisAudit.type = 4
- order by eb.importDate desc
- </select>
- <select id="countDistributionExerciseBook" resultType="java.lang.Integer">
- select count(1)
- from kmt_exercise_book
- where part_flag <> 3
- <if test="req.type == 1">
- and (
- <choose>
- <when test="(req.handler != null and req.handler > 0) or
- (req.handleAuditUser != null and req.handleAuditUser > 0) or
- (req.analyser != null and req.analyser > 0) or
- (req.analysisAuditUser != null and req.analysisAuditUser > 0)">
- <trim suffixOverrides="and">
- <if test="req.handler != null and req.handler > 0">
- handle_user_id is null and
- </if>
- <if test="req.handleAuditUser != null and req.handleAuditUser > 0">
- auditing_user_id is null and
- </if>
- <if test="req.analyser != null and req.analyser > 0">
- analysis_user_id is null and
- </if>
- <if test="req.analysisAuditUser != null and req.analysisAuditUser > 0">
- analysis_auditer_id is null and
- </if>
- </trim>
- </when>
- <otherwise>
- handle_user_id is null
- or auditing_user_id is null
- or analysis_user_id is null
- or analysis_auditer_id is null
- </otherwise>
- </choose>
- )
- </if>
- <if test="req.type == 2">
- and (handle_user_id is not null
- and auditing_user_id is not null
- and analysis_user_id is not null
- and analysis_auditer_id is not null)
- </if>
- <if test="req.bookName != null and req.bookName != ''">
- and book_name like '%${req.bookName}%'
- </if>
- <if test="req.subject != null and req.subject != ''">
- and course_name = #{req.subject}
- </if>
- <if test="req.grade != null and req.grade != ''">
- and grade = #{req.grade}
- </if>
- <if test="req.version != null and req.version > 0">
- and version = #{req.version}
- </if>
- <if test="req.semester != null and req.semester > 0">
- and semester = #{req.semester}
- </if>
- <if test="req.bookType != null and req.bookType > -1">
- and book_type = #{req.bookType}
- </if>
- <if test="req.startTime != null and req.startTime != ''">
- and create_time > #{req.startTime}
- </if>
- <if test="req.endTime != null and req.endTime != ''">
- and '${req.endTime} 23:59:59' > create_time
- </if>
- <if test="req.assignedBatch != null and req.assignedBatch != ''">
- and assigned_batch like '%${req.assignedBatch}%'
- </if>
- </select>
- <update id="updateAnswerCorrecterIdByIds">
- update kmt_exercise_book set answer_correcter_id = #{teacherId},allot_check_time = now()
- where id in
- <foreach collection="exerciseBookIds" open="(" item="exerciseBookId" separator="," close=")">
- #{exerciseBookId}
- </foreach>
- </update>
- <update id="updateAnswerCorrecterIdByExerciseBookIds">
- update kmt_exercise_questions set answer_correcter_id = #{teacherId}
- where exercise_book_id in
- <foreach collection="exerciseBookIds" open="(" item="exerciseBookId" separator="," close=")">
- #{exerciseBookId}
- </foreach>
- </update>
- <select id="findExportDistributionExerciseBookList" resultType="com.aijia.kmt.dto.ExportDistributionExerciseBookDTO">
- select ebdc.*, eb.assigned_batch, count(eq.id) question_num
- from kmt_exercise_book_distribution_count ebdc join kmt_exercise_book eb on ebdc.exercise_book_id=eb.id
- join kmt_exercise_questions eq on eb.id=eq.exercise_book_id
- <where>
- <if test="req.startTime != null and req.startTime != ''">
- and ebdc.import_date > #{req.startTime}
- </if>
- <if test="req.endTime != null and req.endTime != ''">
- and '${req.endTime} 23:59:59' > ebdc.import_date
- </if>
- </where>
- group by ebdc.exercise_book_id
- order by ebdc.import_date desc
- limit #{offset}
- </select>
- <select id="findDistributionTeacher"
- resultType="com.aijia.kmt.dto.DistributionTeacherDTO">
- select teacher_id,
- teacher_name,
- salary_given,
- salary_given_time
- <if test="authorityType == 1">
- , (select max(handler_submit_time)
- from kmt_exercise_questions eq
- where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 0) lastSubmitTime
- </if>
- <if test="authorityType == 2">
- , (select max(publish_time)
- from kmt_exercise_questions eq
- where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 3) lastSubmitTime
- </if>
- <if test="authorityType == 3">
- , (select max(analysis_handler_submit_time)
- from kmt_exercise_questions eq
- where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status > 5) lastSubmitTime
- </if>
- <if test="authorityType == 4">
- , (select max(analysis_submit_time)
- from kmt_exercise_questions eq
- where eq.exercise_book_id = #{exerciseBookId} and eq.deal_status = 11) lastSubmitTime
- </if>
- from kmt_exercise_book_teacher_record
- where exercise_book_id = #{exerciseBookId}
- and teacher_id = #{userId}
- and authority_type = #{authorityType}
- order by create_time desc
- limit 1
- </select>
- <select id="findAllExerciseBookPage" resultType="com.aijia.kmt.po.KmtExerciseBook">
- select * from kmt_exercise_book
- where part_flag <> 3
- <if test="selectedExerciseBookIdList != null and selectedExerciseBookIdList.size > 0">
- and id in
- <foreach collection="selectedExerciseBookIdList" open="(" item="selectedExerciseBookId" separator="," close=")">
- #{selectedExerciseBookId}
- </foreach>
- </if>
- limit #{offset}, #{pageSize}
- </select>
- <select id="countNotCheckAnswerCount" resultType="java.lang.Integer">
- select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
- and deal_status not in (2, 6) and proofread_status = 0
- </select>
- <select id="countAllNotCheckAnswerCount" resultType="java.lang.Integer">
- select count(1) from kmt_exercise_questions where exercise_book_id=#{exerciseBookId}
- and proofread_status = 0
- </select>
- <select id="findExerciseBooksByBookId" resultType="com.aijia.kmt.po.KmtExerciseBook">
- select * from kmt_exercise_book where book_id=#{bookId}
- </select>
- <select id="findExerciseTeacherByExerciseBookIdsAndAuthType" resultType="com.aijia.kmt.po.KmtExerciseBookTeacherRecord">
- select * from kmt_exercise_book_teacher_record where exercise_book_id in
- <foreach collection="exerciseBookIds" open="(" item="id" separator="," close=")">
- #{id}
- </foreach>
- and authority_type = #{authType}
- </select>
- <select id="findBookCountByExerciseBookIdAndType" resultType="com.aijia.kmt.po.KmtExerciseBookCount">
- select * from kmt_exercise_book_count where exercise_book_id=#{exerciseBookId} and type=#{type} limit 1
- </select>
- <update id="updateKmtExerciseBookCountById">
- UPDATE kmt_exercise_book_count set accuracy=#{accuracy} WHERE id = #{bookCountId}
- </update>
- <select id="findAllDistinctLibBySubject" resultType="java.util.Map">
- SELECT DISTINCT lib_id FROM
- kmt_exercise_book_lib t
- LEFT JOIN kmt_exercise_book t1 ON t.exercise_book_id = t1.id
- WHERE
- t.is_delete = 0
- and t.lib_id is not null
- AND t1.course_name = #{subjct}
- </select>
- <select id="findExerciseBookByQuestionId" resultType="com.aijia.kmt.dto.ExerciseBookDto">
- select DISTINCT 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
- from kmt_exercise_book eb, kmt_exercise_questions eq,tr_train_exercise_role er
- where eb.id=eq.exercise_book_id and eb.part_flag != 3 and eb.book_id = er.exercise_id
- <if test="questionId != null and questionId != ''">
- and eb.id=#{questionId}
- </if>
- and er.role_type=#{roleType}
- <if test="subject != null and subject != ''">
- and er.subject=#{subject}
- </if>
- </select>
- <select id="findExerciseBookCourseByQuestionId" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select ebc.unit_id id, ebc.unit name, ebc.id book_course_id, ebc.period book_course, ebc.period_sort from kmt_exercise_book_course ebc
- left join kmt_exercise_questions eq on ebc.id=eq.book_course_id
- where eq.id=#{questionId}
- </select>
- <select id="findExerciseQuestionByQuestionId" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index, eq.is_common_flag,
- eq.deal_status question_status, eq.create_time, eq.remark reason, eq.from_user_id, eq.to_user_id,
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
- eq.training_skill training_skills, eq.parent_id, eq.proofread_status, eq.question_path, eq.num,eq.page_index,
- eq.image question_image, eq.concise_id start_X, eq.analysis_submit_type start_Y, eq.update_type end_X, eq.es_loaded end_Y,eq.enumerate
- from kmt_exercise_questions eq
- left join q_question_workbook qw on eq.id=qw.question_id
- left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
- where eq.id=#{questionId} and eq.deal_status !=6
- </select>
- <select id="findExerciseQuestionByQuestionIdAndBookId" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index, eq.small_question_name small_question_index, qw.is_diff is_common_flag,
- eq.deal_status question_status, eq.create_time, eq.remark reason, eq.from_user_id, eq.to_user_id,
- ifnull(ue.question_type,eq.question_type) question_types,
- ifnull(ue.difficulty_level,eq.difficulty_level) difficulty_levels,
- ifnull(ue.real_exam_type,eq.real_exam_type) real_exam_types,
- ifnull(ue.training_skill,eq.training_skill) training_skills,
- eq.parent_id, eq.proofread_status,
- ifnull(ue.question_path,eq.question_path) as question_path,
- qw.number num, eq.page_index,
- ifnull(ue.question_path,eq.image) question_image,
- ifnull(ue.concise_id,eq.concise_id) start_X,
- ifnull(ue.analysis_submit_type,eq.analysis_submit_type) start_Y,
- ifnull(ue.update_type,eq.update_type) end_X,
- ifnull(ue.es_loaded,eq.es_loaded) end_Y,
- ifnull(ue.enumerate,eq.enumerate) as enumerate,
- eq.exercise_book_id
- from kmt_exercise_questions eq
- left join q_question_workbook qw on eq.id=qw.question_id
- left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
- left join tr_train_user_exercise ue on eq.id = ue.question_id and ue.user_id=#{userId}
- where eq.id=#{questionId}
- and qw.sub_book_id=#{bookId} and eq.deal_status !=6
- </select>
- <update id="updateQuestionMinusNumByQuestionIds">
- UPDATE kmt_exercise_questions set num= num - #{size} WHERE id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </update>
- <update id="updateQuestionAddNumByQuestionIds">
- UPDATE kmt_exercise_questions set num= num + #{size} WHERE id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </update>
- <select id="findEditExerciseBooks" resultType="com.aijia.kmt.dto.exercise.ExerciseBookEditDto">
- select distinct eb.id exercise_book_id, eb.book_name exercise_book_name from kmt_exercise_question_rollback rb, kmt_exercise_questions eq, kmt_exercise_book eb
- where rb.question_id=eq.id and eq.exercise_book_id=eb.id and rb.type=2
- <choose>
- <when test="request.questionId != null and request.questionId != ''">
- and eq.id=#{request.questionId}
- </when>
- <otherwise>
- and eb.grade=#{request.grade}
- and eb.course_name=#{request.subject}
- and eb.version=#{request.versionType} and eb.semester=#{request.semester}
- <if test="request.bookName != null and request.bookName != ''">
- and eb.book_name like concat('%',#{request.bookName},'%')
- </if>
- </otherwise>
- </choose>
- order by eb.book_name
- </select>
- <select id="findEditExerciseQuestions" resultType="com.aijia.kmt.dto.exercise.ExerciseQuestionEditDto">
- select eq.id question_id, eb.book_name exercise_book_name, eb.course_name subject, eb.grade, eb.version version_type, eb.semester,
- eq.deal_status, eb.book_type type, rb.create_time, rb.user_id, eq.book_id, eq.exercise_book_id, eb.book_year,
- eq.book_course_id period_id, unit_id from kmt_exercise_question_rollback rb,
- kmt_exercise_questions eq, kmt_exercise_book eb
- where rb.question_id=eq.id and eq.exercise_book_id=eb.id and rb.type=2
- <choose>
- <when test="request.questionId != null and request.questionId != ''">
- and eq.id=#{request.questionId}
- </when>
- <otherwise>
- and eb.id=#{request.exerciseBookId}
- </otherwise>
- </choose>
- order by rb.create_time desc
- </select>
- <select id="findErrorExerciseBooks" resultType="com.aijia.kmt.dto.exercise.ExerciseBookEditDto">
- select distinct eb.id exercise_book_id, eb.book_name exercise_book_name from kmt_exercise_question_errors qe, kmt_exercise_book eb
- where qe.exercise_book_id = eb.id and error_user_id=#{userId}
- <if test="bookName != null and bookName != ''">
- and eb.book_name like concat('%',#{bookName},'%')
- </if>
- order by eb.book_name
- </select>
- <select id="findExerciseQuestionNum" resultType="com.aijia.kmt.dto.ExerciseQuestionNumberDto">
- select exercise_book_id, count(1) question_num from kmt_exercise_questions where exercise_book_id in
- <foreach collection="exerciseBookIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- and deal_status != 6
- group by exercise_book_id
- </select>
- <delete id="deleteKnowByQuestionId">
- delete from kmt_exercise_question_know where question_id in
- <foreach collection="questionIds" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </delete>
-
- <!-- 查询待加工审核的题目New-->
- <select id="findQuestionByBookCourseIdAndUserIdNew" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index,
- eq.small_question_name small_question_index,
- eq.is_common_flag,
- eq.deal_status question_status,
- eq.create_time,
- eq.remark reason,
- eq.from_user_id,
- eq.to_user_id,
- <if test="roleType == 1 or roleType ==2 ">
- ue.question_type as question_types,
- ue.difficulty_level as difficulty_levels,
- ue.real_exam_type as real_exam_types,
- ue.training_skill as training_skills,
- </if>
- <!-- 解析或者管理员-->
- <if test="roleType ==3 or roleType ==0 ">
- ifnull(ue.question_type,eq.question_type) question_types,
- ifnull(ue.difficulty_level,eq.difficulty_level) difficulty_levels,
- ifnull(ue.real_exam_type,eq.real_exam_type) real_exam_types,
- ifnull(ue.training_skill,eq.training_skill) training_skills,
- </if>
- eq.parent_id,
- eq.proofread_status,
- ifnull(ue.question_path,eq.question_path) as question_path,
- t.number as num,
- t.page_index,
- ifnull(ue.question_path,eq.image) question_image,
- ifnull(ue.concise_id,eq.concise_id) start_X,
- ifnull(ue.analysis_submit_type,eq.analysis_submit_type) start_Y,
- ifnull(ue.update_type,eq.update_type) end_X,
- ifnull(ue.es_loaded,eq.es_loaded) end_Y,
- ifnull(ue.enumerate,eq.enumerate) as enumerate,
- eq.exercise_book_id
- FROM
- q_question_workbook t
- LEFT JOIN kmt_exercise_questions eq ON t.question_id=eq.id
- LEFT JOIN kmt_exercise_book eb ON eq.exercise_book_id = eb.id
- left join tr_train_user_exercise ue on t.question_id = ue.question_id and ue.user_id=#{userId}
- <if test="req.publishStatus==3">
- LEFT JOIN q_question_info qi on t.question_id=qi.id
- </if>
- <if test="searchType==1">
- inner JOIN tr_train_question_check tk on tk.question_id=t.question_id and tk.status = 1
- </if>
- WHERE eq.deal_status != 6
- and t.sub_book_id=#{req.exerciseBookId}
- <if test="req.periodId !=null and req.periodId !=''">
- and t.course_name=#{req.periodId}
- </if>
- <if test="req.unitId !=null and req.unitId !=''">
- and t.unit_name=#{req.unitId}
- </if>
- <if test="req.questionId !=null and req.questionId !=''">
- and eq.id=#{req.questionId}
- </if>
- <if test="type == 0">
- and (ue.id is null or ue.status = 2)
- </if>
- order by t.number
- </select>
- <!-- 查询待加工审核的题目New-->
- <select id="findAllQuestionByGradeDetail" resultType="com.aijia.kmt.dto.ExerciseQuetionDto">
- 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,
- eq.big_question_index,
- eq.small_question_name small_question_index,
- eq.is_common_flag,
- eq.deal_status question_status,
- eq.create_time,
- eq.remark reason,
- eq.from_user_id,
- eq.to_user_id,
- eq.question_type question_types,
- eq.difficulty_level difficulty_levels,
- eq.real_exam_type real_exam_types,
- eq.training_skill training_skills,
- eq.parent_id,
- eq.proofread_status,
- eq.question_path,
- t.number as num,
- t.page_index,
- eq.image question_image,
- eq.concise_id start_X,
- eq.analysis_submit_type start_Y,
- eq.update_type end_X,
- eq.es_loaded end_Y,
- eq.enumerate,
- eq.exercise_book_id
- FROM
- q_question_workbook t
- LEFT JOIN kmt_exercise_questions eq ON t.question_id=eq.id
- LEFT JOIN kmt_exercise_book eb ON eq.exercise_book_id = eb.id
- <if test="req.publishStatus==3">
- LEFT JOIN q_question_info qi on t.question_id=qi.id
- </if>
- WHERE eb.grade=#{req.grade} and eb.course_name=#{req.subject} and eb.version=#{req.versionType} and eb.semester=#{req.semester} and eq.deal_status != 6
- <if test="req.questionType > 0">
- and eq.question_type=#{req.questionType}
- </if>
- <if test="req.publishStatus == 1">
- and eq.deal_status in (0, 1, 3, 7)
- </if>
- <if test="req.publishStatus == 2">
- and eq.deal_status in (4, 5, 8, 9, 10, 11)
- </if>
- <if test="req.rollbackType == 1">
- and eq.deal_status != 2
- </if>
- <if test="req.rollbackType == 2">
- and eq.deal_status > 2
- </if>
- <if test="req.rollbackType == 3">
- and eq.deal_status > 3 and eq.deal_status != 7
- </if>
- <if test="req.rollbackType == 4">
- and eq.deal_status > 8
- </if>
- <if test="req.rollbackType == 5">
- and eq.deal_status > 10
- </if>
- <if test="req.publishStatus==3">
- and (qi.answer_text='略' or qi.answer='略')
- </if>
- order by t.sub_book_id, t.number
- </select>
-
-
- <!--查询待加工审核的练习册单元 -->
- <select id="findUnHandleExerciseBookCourseNew" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select a.id,
- a.NAME,
- a.book_course_id,
- a.book_course,
- @i:=@i+1 as period_sort from (
- SELECT
- DISTINCT
- t.unit_name as id,
- t.unit_name as NAME,
- t.course_name as book_course_id,
- t.course_name as book_course
- FROM
- (
- SELECT
- t.unit_name,
- t.course_name,
- @group_row :=
- CASE
- WHEN @parent_code = t.course_name COLLATE utf8mb4_0900_ai_ci THEN
- @group_row + 1 ELSE 1
- END AS groupRow,
- @group_row2 :=
- CASE
- WHEN @parent_code = t.course_name COLLATE utf8mb4_0900_ai_ci
- AND eb.id IS NOT NULL THEN
- @group_row2 + 1 ELSE 1
- END AS groupRow2,
- @parent_code := t.course_name AS parent_code
- FROM
- q_question_workbook t
- INNER JOIN kmt_exercise_questions eq ON t.question_id = eq.id
- INNER JOIN tr_train_question_check ec ON t.question_id = ec.question_id and ec.status = 1
- LEFT JOIN tr_train_user_exercise eb ON eq.id = eb.question_id and eb.user_id ='a919d6d3-1e99-11ec-aea2-00163e02e90a'
- LEFT JOIN ( SELECT @group_row := 1, @group_row2 := 1, @parent_code := '' ) AS b ON 1 = 1
- WHERE
- eq.exercise_book_id =#{bookId}
- <if test="questionId != null and questionId != ''">
- and eq.id=#{questionId}
- </if>
- ORDER BY
- t.number
- ) t
- where t.groupRow <![CDATA[ <> ]]> t.groupRow2
- ) a,(select @i:=0) num
- </select>
-
- <select id="findExerciseBookCourseByQuestionIdNew" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select a.id,
- a.NAME,
- a.book_course_id,
- a.book_course,
- @i:=@i+1 as period_sort from (
- SELECT
- DISTINCT
- t.unit_name as id,
- t.unit_name as NAME,
- t.course_name as book_course_id,
- t.course_name as book_course
- FROM
- q_question_workbook t
- WHERE
- t.question_id=#{questionId}
- ) a,(select @i:=0) num
- </select>
-
- <!--查询练习册下所有单元课时-->
- <select id="findAllExerciseBookCourseByExerciseBookIdNew" resultType="com.aijia.kmt.dto.exercise.ExerciseUnitBookcourseDto">
- select a.id,
- a.NAME,
- a.book_course_id,
- a.book_course,
- @i:=@i+1 as period_sort from (
- SELECT
- DISTINCT
- t.unit_name as id,
- t.unit_name as NAME,
- t.course_name as book_course_id,
- t.course_name as book_course
- FROM
- q_question_workbook t
- <if test="type == 2">
- INNER JOIN tr_train_question_check ec ON t.question_id = ec.question_id and ec.status = 1
- </if>
- WHERE
- 1=1
- <if test="exerciseBookId != null and exerciseBookId != ''">
- and t.sub_book_id=#{exerciseBookId}
- </if>
- <if test="bookId != null and bookId != ''">
- and t.book_id=#{bookId}
- </if>
- <if test="isDiff != null and isDiff != ''">
- and t.is_diff=#{isDiff}
- </if>
- ORDER BY t.number
- ) a,(select @i:=0) num
- </select>
- <select id="findMaxSmallQuestionNumber" resultType="java.util.Map">
- select qw.number, qw.sort_number from kmt_exercise_questions eq, q_question_workbook qw
- where eq.id=qw.question_id and eq.exercise_book_id=qw.sub_book_id
- and eq.parent_id=#{parentId}
- and eq.question_class_type=2
- and eq.deal_status !=6
- order by qw.number desc limit 1
- </select>
- <select id="findIsNotFinishTask" resultType="java.lang.Integer">
- select 1
- from kmt_exercise_book eb,
- kmt_exercise_questions eq
- where eb.id = eq.exercise_book_id
- and ((eb.handle_user_id = #{userId} and eq.deal_status in (0, 1)) or
- (eb.auditing_user_id = #{userId} and eq.deal_status in (3, 7))
- or (eb.analysis_user_id = #{userId} and eq.deal_status in (5, 8)) or
- (eb.analysis_auditer_id = #{userId} and eq.deal_status in (9, 10))
- or (eb.answer_correcter_id=#{userId} and eq.proofread_status = 0))
- limit 1
- </select>
- <select id="findAllKmtExerciseQuestionsByIdIn" resultType="com.aijia.kmt.po.KmtExerciseQuestion">
- select eq.id, eq.book_id, eq.unit_id, eq.book_course_id,
- eb.auditing_user_id, eb.handle_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eb.answer_correcter_id,
- eq.question_type, eq.source, eq.big_question_index, eq.analysis_submit_time, eq.page_index,
- eq.image, eq.precision_percent, eq.create_time, eq.deal_status, eq.remark, eq.analysis_submit_type,
- eq.answer_image, eq.num, eq.small_question_name, eq.parent_id, eq.big_name, eq.real_exam_type, eq.publish_time,
- eq.update_type, eq.difficulty_level, eq.training_skill, eq.course_name, eq.is_common_flag, eq.question_year, eb.id exercise_book_id, eq.es_loaded,
- eq.analysis_handler_submit_time, eq.question_class_type, eq.repulse_time,
- eq.proofread_status, eq.question_path, eq.handler_submit_time,eq.enumerate
- FROM
- q_question_workbook t
- LEFT JOIN kmt_exercise_questions eq ON t.question_id=eq.id
- LEFT JOIN kmt_exercise_book eb ON t.sub_book_id = eb.id WHERE eq.id in
- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
- #{id}
- </foreach>
- limit 0, 5000
- </select>
- </mapper>
|