ClassGradeUserMapper.xml 113 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper">
  6. <resultMap type="com.zhongzheng.modules.grade.domain.ClassGradeUser" id="ClassGradeUserResult">
  7. <result property="id" column="id"/>
  8. <result property="userId" column="user_id"/>
  9. <result property="gradeId" column="grade_id"/>
  10. <result property="status" column="status"/>
  11. <result property="createTime" column="create_time"/>
  12. <result property="updateTime" column="update_time"/>
  13. <result property="createBy" column="create_by"/>
  14. <result property="fromType" column="from_type"/>
  15. <result property="periodStatus" column="period_status"/>
  16. <result property="orderGoodsId" column="order_goods_id"/>
  17. <result property="finishStatus" column="finish_status"/>
  18. <result property="officialStatus" column="official_status"/>
  19. <result property="learnStatus" column="learn_status"/>
  20. <result property="periodPlush" column="period_plush"/>
  21. <result property="periodTime" column="period_time"/>
  22. <result property="periodWaitTime" column="period_wait_time"/>
  23. <result property="changeGrade" column="change_grade"/>
  24. <result property="officialStatusMsg" column="official_status_msg"/>
  25. <result property="periodPlushMsg" column="period_plush_msg"/>
  26. <result property="officialStatusTime" column="official_status_time"/>
  27. <result property="periodPlushTime" column="period_plush_time"/>
  28. <result property="officialStatusNum" column="official_status_num"/>
  29. <result property="periodStatusNum" column="period_status_num"/>
  30. <result property="periodIngTime" column="period_ing_time"/>
  31. <result property="auditUserName" column="audit_user_name"/>
  32. <result property="toOldStatus" column="to_old_status"/>
  33. <result property="toOldResult" column="to_old_result"/>
  34. <result property="toOldTime" column="to_old_time"/>
  35. <result property="sevenPushCheck" column="seven_push_check"/>
  36. <result property="sevenPushReason" column="seven_push_reason"/>
  37. </resultMap>
  38. <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeUserVo" id="ClassGradeUserVoResult">
  39. <result property="id" column="id"/>
  40. <result property="userId" column="user_id"/>
  41. <result property="gradeId" column="grade_id"/>
  42. <result property="className" column="class_name"/>
  43. <result property="status" column="status"/>
  44. <result property="code" column="user_account"/>
  45. <result property="realName" column="realname"/>
  46. <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  47. <result property="createBy" column="create_by"/>
  48. <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  49. <result property="changeGrade" column="change_grade"/>
  50. <result property="interfacePushId" column="interface_push_id"/>
  51. <result property="classStatus" column="class_status"/>
  52. <result property="officialName" column="official_name"/>
  53. <result property="classStartTime" column="class_start_time"/>
  54. <result property="classEndTime" column="class_end_time"/>
  55. <result property="officialStatusNum" column="official_status_num"/>
  56. <result property="periodTime" column="period_time"/>
  57. <result property="periodWaitTime" column="period_wait_time"/>
  58. <result property="periodStatus" column="period_status"/>
  59. <result property="periodStatusNum" column="period_status_num"/>
  60. <result property="periodIngTime" column="period_ing_time"/>
  61. <result property="finishStatus" column="finish_status"/>
  62. <result property="learnStatus" column="learn_status"/>
  63. <result property="reason" column="reason"/>
  64. <result property="interfaceAccountId" column="interface_account_id"/>
  65. <result property="noInterfaceAccountId" column="no_interface_account_id"/>
  66. <result property="toOldStatus" column="to_old_status"/>
  67. <result property="toOldResult" column="to_old_result"/>
  68. <result property="toOldTime" column="to_old_time"/>
  69. <result property="orderGoodsId" column="order_goods_id"/>
  70. <result property="sex" column="sex"/>
  71. <result property="eduLevel" column="edu_level"/>
  72. <result property="companyName" column="company_name"/>
  73. <result property="sevenPushCheck" column="seven_push_check"/>
  74. <result property="sevenPushReason" column="seven_push_reason"/>
  75. </resultMap>
  76. <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo" id="ClassGradeUserGoodsVoResult">
  77. <result property="id" column="id"/>
  78. <result property="userId" column="user_id"/>
  79. <result property="gradeId" column="grade_id"/>
  80. <result property="status" column="status"/>
  81. <result property="goodsCode" column="goods_code"/>
  82. <result property="goodsName" column="goods_name"/>
  83. <result property="gradeStatus" column="grade_status"/>
  84. <result property="gradeCode" column="grade_code"/>
  85. <result property="gradeName" column="grade_name"/>
  86. <result property="year" column="year"/>
  87. <result property="educationName" column="education_name"/>
  88. <result property="projectName" column="project_name"/>
  89. <result property="businessName" column="business_name"/>
  90. <result property="schoolName" column="school_name"/>
  91. <result property="createTime" column="create_time"/>
  92. <result property="createBy" column="create_by"/>
  93. <result property="goodsId" column="goods_id"/>
  94. <result property="classStartTime" column="class_start_time"/>
  95. <result property="classEndTime" column="class_end_time"/>
  96. <result property="orderGoodsId" column="order_goods_id"/>
  97. </resultMap>
  98. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodStudentVo" id="ClassPeriodStudentVo">
  99. <result property="userId" column="user_id"/>
  100. <result property="gradeId" column="grade_id"/>
  101. <result property="studentCode" column="user_account"/>
  102. <result property="realName" column="realname"/>
  103. <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  104. <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  105. <result property="status" column="status"/>
  106. <result property="classHours" column="class_hours"/>
  107. <result property="periodStatus" column="period_status"/>
  108. <result property="secAllNum" column="sec_all_num"/>
  109. <result property="examNum" column="exam_num"/>
  110. <result property="recordNum" column="record_num"/>
  111. <result property="periodPlush" column="period_plush"/>
  112. <result property="startTime" column="start_time"/>
  113. <result property="endTime" column="end_time"/>
  114. <result property="studyStartTime" column="study_start_time"/>
  115. <result property="studyEndTime" column="study_end_time"/>
  116. <result property="rebuildNum" column="rebuild_num"/>
  117. <result property="profileStatus" column="profile_status"/>
  118. <result property="className" column="class_name"/>
  119. <result property="goodsName" column="goods_name"/>
  120. <result property="standPrice" column="stand_price"/>
  121. <result property="goodsCode" column="goods_code"/>
  122. <result property="keyValue" column="key_value"/>
  123. <result property="classStartTime" column="class_start_time"/>
  124. <result property="classEndTime" column="class_end_time"/>
  125. <result property="periodStatusNum" column="period_status_num"/>
  126. <result property="serviceStartTime" column="service_start_time"/>
  127. <result property="serviceEndTime" column="service_end_time"/>
  128. <result property="oneInchPhotos" column="one_inch_photos"/>
  129. <result property="periodTime" column="period_time"/>
  130. <result property="sectionName" column="section_name"/>
  131. <result property="companyName" column="company_name"/>
  132. <result property="durationTime" column="duration_time"/>
  133. <result property="recordStartTime" column="record_start_time"/>
  134. <result property="recordEndTime" column="record_end_time"/>
  135. <result property="onLineTime" column="on_line_time"/>
  136. <result property="orderGoodsId" column="order_goods_id"/>
  137. <result property="sevenYear" column="seven_year"/>
  138. <result property="businessName" column="business_name"/>
  139. <result property="projectName" column="project_name"/>
  140. <result property="educationName" column="education_name"/>
  141. <result property="categoryName" column="category_name"/>
  142. <result property="goodsYear" column="goods_year"/>
  143. <result property="createTime" column="create_time"/>
  144. <result property="profileStatus" column="profile_status"/>
  145. <result property="orderSn" column="order_sn"/>
  146. <result property="majorId" column="major_id"/>
  147. </resultMap>
  148. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodUserVo" id="ClassPeriodUserVo">
  149. <result property="userId" column="user_id"/>
  150. <result property="studentCode" column="user_account"/>
  151. <result property="realName" column="realname"/>
  152. <result property="oneInchPhotos" column="one_inch_photos"/>
  153. <result property="idCardImg1" column="id_card_img1"/>
  154. <result property="idCardImg2" column="id_card_img2"/>
  155. <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  156. <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  157. <result property="secAllNum" column="sec_all_num"/>
  158. <result property="examNum" column="exam_num"/>
  159. <result property="recordNum" column="record_num"/>
  160. <result property="pass" column="pass"/>
  161. <result property="cheat" column="cheat"/>
  162. <result property="pending" column="pending"/>
  163. <result property="examPass" column="exam_pass"/>
  164. <result property="examPending" column="exam_pending"/>
  165. <result property="examCheat" column="exam_cheat"/>
  166. <result property="keyValue" column="key_value"/>
  167. <result property="periodStatus" column="period_status"/>
  168. <result property="studyStartTime" column="study_start_time"/>
  169. <result property="studyEndTime" column="study_end_time"/>
  170. <result property="goodsName" column="goods_name"/>
  171. <result property="className" column="class_name"/>
  172. <result property="classHours" column="class_hours"/>
  173. <result property="orderGoodsId" column="order_goods_id"/>
  174. <result property="classStartTime" column="class_start_time"/>
  175. <result property="classEndTime" column="class_end_time"/>
  176. <result property="officialName" column="official_name"/>
  177. <result property="sevenYear" column="seven_year"/>
  178. <result property="gradeStatus" column="grade_status"/>
  179. <result property="sex" column="sex"/>
  180. </resultMap>
  181. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
  182. <result property="userId" column="user_id"/>
  183. <result property="id" column="id"/>
  184. <result property="typeName" column="type_name"/>
  185. <result property="realName" column="realname"/>
  186. <result property="classHours" column="class_hours"/>
  187. <result property="studyStartTime" column="study_start_time"/>
  188. <result property="status" column="status"/>
  189. <result property="auditTime" column="audit_time"/>
  190. <result property="type" column="type"/>
  191. <result property="sort" column="sort"/>
  192. <result property="courseId" column="course_id"/>
  193. <result property="studyEndTime" column="study_end_time"/>
  194. <result property="durationTime" column="duration_time"/>
  195. <result property="courseSort" column="course_sort"/>
  196. <result property="sectionType" column="section_type"/>
  197. <result property="realLiveStartTime" column="real_live_start_time"/>
  198. <result property="realLiveEndTime" column="real_live_end_time"/>
  199. <result property="realDuration" column="real_duration"/>
  200. <result property="commonSign" column="common_sign"/>
  201. </resultMap>
  202. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodChapterVo" id="ClassPeriodChapterVo">
  203. <result property="userId" column="user_id"/>
  204. <result property="id" column="id"/>
  205. <result property="courseId" column="course_id"/>
  206. <result property="typeName" column="type_name"/>
  207. <result property="realName" column="realname"/>
  208. <result property="classHours" column="class_hours"/>
  209. <result property="studyStartTime" column="study_start_time"/>
  210. <result property="status" column="status"/>
  211. <result property="auditTime" column="audit_time"/>
  212. <result property="type" column="type"/>
  213. <result property="studyEndTime" column="study_end_time"/>
  214. <result property="performance" column="performance"/>
  215. <result property="sort" column="sort"/>
  216. <result property="doType" column="do_type"/>
  217. <result property="moduleId" column="module_id"/>
  218. <result property="commonSign" column="common_sign"/>
  219. </resultMap>
  220. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodSectionVo" id="ClassPeriodSectionVo">
  221. <result property="userId" column="user_id"/>
  222. <result property="id" column="id"/>
  223. <result property="typeName" column="type_name"/>
  224. <result property="realName" column="realname"/>
  225. <result property="classHours" column="class_hours"/>
  226. <result property="durationTime" column="duration_time"/>
  227. <result property="studyStartTime" column="study_start_time"/>
  228. <result property="status" column="status"/>
  229. <result property="auditTime" column="audit_time"/>
  230. <result property="type" column="type"/>
  231. <result property="studyEndTime" column="study_end_time"/>
  232. <result property="auditNum" column="audit_num"/>
  233. <result property="sort" column="sort"/>
  234. <result property="sectionType" column="section_type"/>
  235. <result property="realLiveStartTime" column="real_live_start_time"/>
  236. <result property="realLiveEndTime" column="real_live_end_time"/>
  237. <result property="realDuration" column="real_duration"/>
  238. <result property="recordingUrl" column="recording_url"/>
  239. <result property="doType" column="do_type"/>
  240. <result property="chapterId" column="chapter_id"/>
  241. <result property="moduleId" column="module_id"/>
  242. </resultMap>
  243. <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterVo" id="CourseChapterResultVo">
  244. <result property="chapterId" column="chapter_id"/>
  245. <result property="name" column="name"/>
  246. <result property="commonSign" column="common_sign"/>
  247. <result property="sectionNum" column="section_num"/>
  248. </resultMap>
  249. <select id="selectUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  250. resultMap="ClassGradeUserVoResult">
  251. SELECT
  252. g.*,
  253. u.user_account,
  254. u.realname,
  255. u.id_card,
  256. u.telphone,
  257. u.sex,
  258. u.edu_level,
  259. u.company_name,
  260. cg.class_name,
  261. cg.official_name,
  262. cg.class_status,
  263. cg.interface_push_id,
  264. cg.class_start_time,
  265. cg.class_end_time,
  266. g.official_status_num,
  267. g.period_time,
  268. g.period_wait_time,
  269. g.period_status
  270. FROM
  271. class_grade_user g
  272. LEFT JOIN `user` u ON g.user_id = u.user_id
  273. LEFT JOIN class_grade cg ON cg.grade_id = g.grade_id
  274. WHERE
  275. 1 = 1
  276. AND g.change_grade = 0
  277. AND g.grade_id = #{gradeId}
  278. AND g.user_id = #{userId}
  279. AND g.order_goods_id = #{orderGoodsId}
  280. </select>
  281. <select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  282. resultMap="ClassGradeUserVoResult">
  283. SELECT
  284. g.*,
  285. u.user_account,
  286. u.realname,
  287. u.id_card,
  288. u.telphone
  289. FROM
  290. class_grade_user g
  291. LEFT JOIN `user` u ON g.user_id = u.user_id
  292. WHERE
  293. 1 = 1
  294. <if test="status != null and status.size()!=0 ">
  295. AND g.status in
  296. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  297. #{item}
  298. </foreach>
  299. </if>
  300. <if test="gradeId != null and gradeId != ''">
  301. AND g.grade_id = #{gradeId}
  302. </if>
  303. <if test="userId != null and userId != ''">
  304. AND g.user_id = #{userId}
  305. </if>
  306. <if test="classStartTime != null or classEndTime != null ">
  307. AND #{classStartTime} BETWEEN g.class_start_time
  308. </if>
  309. order by g.update_time desc
  310. </select>
  311. <select id="listUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  312. resultMap="ClassGradeUserGoodsVoResult">
  313. SELECT
  314. * ,
  315. g.code as goods_code,
  316. g.`year`,
  317. g.goods_name,
  318. (select b.business_name FROM course_business b where b.id = g.business_id) as business_name,
  319. (select b.project_name FROM course_project_type b where b.id = g.project_id) as project_name,
  320. (select b.school_name FROM school b where b.id = g.school_id) as school_name,
  321. (select b.education_name FROM course_education_type b where b.id = g.education_type_id) as education_name,
  322. (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
  323. (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
  324. (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
  325. FROM
  326. class_grade_user u
  327. LEFT JOIN order_goods og on og.order_goods_id = u.order_goods_id
  328. LEFT JOIN goods g on g.goods_id = og.goods_id
  329. where 1=1
  330. <if test="status != null and status.size()!=0 ">
  331. AND u.status in
  332. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  333. #{item}
  334. </foreach>
  335. </if>
  336. <if test="userId != null and userId != ''">
  337. and u.user_id= #{userId}
  338. </if>
  339. order by u.create_time desc
  340. </select>
  341. <select id="listUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  342. resultMap="ClassGradeUserGoodsVoResult">
  343. SELECT
  344. * ,
  345. g.code as goods_code,
  346. g.`year`,
  347. g.goods_name,
  348. (select b.business_name FROM course_business b where b.id = g.business_id) as business_name,
  349. (select b.project_name FROM course_project_type b where b.id = g.project_id) as project_name,
  350. (select b.school_name FROM school b where b.id = g.school_id) as school_name,
  351. (select b.education_name FROM course_education_type b where b.id = g.education_type_id) as education_name,
  352. (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
  353. (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
  354. (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
  355. FROM
  356. class_grade_user u
  357. LEFT JOIN order_goods og on og.order_goods_id = u.order_goods_id
  358. LEFT JOIN goods g on g.goods_id = og.goods_id
  359. where 1=1
  360. <if test="status != null and status.size()!=0 ">
  361. AND u.status in
  362. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  363. #{item}
  364. </foreach>
  365. </if>
  366. <if test="userId != null and userId != ''">
  367. and u.user_id= #{userId}
  368. </if>
  369. order by u.create_time desc
  370. </select>
  371. <select id="listUserVideoRecord" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  372. resultMap="ClassPeriodStudentVo">
  373. SELECT
  374. up.* ,cg.class_name,cs.duration_time,u.id_card,u.realname,u.one_inch_photos,u.company_name,cs.`name` as section_name,ups.record_start_time,ups.record_end_time,ups.update_time as on_line_time
  375. FROM
  376. user_period up
  377. LEFT JOIN user_period_status ups ON up.id = ups.period_id
  378. LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
  379. LEFT JOIN goods g ON up.goods_id = g.goods_id
  380. LEFT JOIN course_section cs ON up.section_id = cs.section_id
  381. LEFT JOIN `user` u ON up.user_id = u.user_id
  382. WHERE
  383. up.grade_id > 0 and up.type = 1
  384. <if test="businessId != null and businessId != ''">
  385. AND g.business_id = #{businessId}
  386. </if>
  387. <if test="educationTypeId != null and educationTypeId != ''">
  388. AND g.education_type_id = #{educationTypeId}
  389. </if>
  390. <if test="projectId != null and projectId != ''">
  391. AND g.project_id = #{projectId}
  392. </if>
  393. <if test="realname != null and realname != ''">
  394. AND u.realname like concat('%', #{realname}, '%')
  395. </if>
  396. <if test="telphone != null and telphone != ''">
  397. AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
  398. </if>
  399. <if test="idCard != null and idCard != ''">
  400. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  401. </if>
  402. <if test="companyName != null and companyName != ''">
  403. AND u.company_name like concat('%', #{companyName}, '%')
  404. </if>
  405. order by up.create_time desc
  406. </select>
  407. <select id="listUserVideoRecordNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  408. resultMap="ClassPeriodStudentVo">
  409. SELECT
  410. up.* ,cg.class_name,cs.duration_time,u.id_card,u.realname,u.one_inch_photos,u.company_name,cs.`name` as section_name,ups.record_start_time,ups.record_end_time,ups.update_time as on_line_time
  411. FROM
  412. user_period up
  413. LEFT JOIN user_period_status ups ON up.id = ups.period_id
  414. LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
  415. LEFT JOIN goods g ON up.goods_id = g.goods_id
  416. LEFT JOIN course_section cs ON up.section_id = cs.section_id
  417. LEFT JOIN `user` u ON up.user_id = u.user_id
  418. WHERE
  419. up.grade_id > 0 and up.type = 1
  420. <if test="businessId != null and businessId != ''">
  421. AND g.business_id = #{businessId}
  422. </if>
  423. <if test="projectIds != null and projectIds.size()!=0 ">
  424. AND g.project_id in
  425. <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
  426. #{item}
  427. </foreach>
  428. </if>
  429. <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
  430. AND g.education_type_id in
  431. <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
  432. #{item}
  433. </foreach>
  434. </if>
  435. <if test="realname != null and realname != ''">
  436. AND u.realname like concat('%', #{realname}, '%')
  437. </if>
  438. <if test="telphone != null and telphone != ''">
  439. AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
  440. </if>
  441. <if test="idCard != null and idCard != ''">
  442. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  443. </if>
  444. <if test="companyName != null and companyName != ''">
  445. AND u.company_name like concat('%', #{companyName}, '%')
  446. </if>
  447. <if test="tenantIds != null and tenantIds.size()!=0 ">
  448. AND up.tenant_id in
  449. <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
  450. #{item}
  451. </foreach>
  452. </if>
  453. order by up.create_time desc
  454. </select>
  455. <select id="listUserVideoRecordNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  456. resultType="java.lang.Long">
  457. SELECT
  458. count(up.id)
  459. FROM
  460. user_period up
  461. LEFT JOIN user_period_status ups ON up.id = ups.period_id
  462. LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
  463. LEFT JOIN goods g ON up.goods_id = g.goods_id
  464. LEFT JOIN course_section cs ON up.section_id = cs.section_id
  465. LEFT JOIN `user` u ON up.user_id = u.user_id
  466. WHERE
  467. up.grade_id > 0 and up.type = 1
  468. <if test="businessId != null and businessId != ''">
  469. AND g.business_id = #{businessId}
  470. </if>
  471. <if test="projectIds != null and projectIds.size()!=0 ">
  472. AND g.project_id in
  473. <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
  474. #{item}
  475. </foreach>
  476. </if>
  477. <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
  478. AND g.education_type_id in
  479. <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
  480. #{item}
  481. </foreach>
  482. </if>
  483. <if test="realname != null and realname != ''">
  484. AND u.realname like concat('%', #{realname}, '%')
  485. </if>
  486. <if test="telphone != null and telphone != ''">
  487. AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
  488. </if>
  489. <if test="idCard != null and idCard != ''">
  490. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  491. </if>
  492. <if test="companyName != null and companyName != ''">
  493. AND u.company_name like concat('%', #{companyName}, '%')
  494. </if>
  495. <if test="tenantIds != null and tenantIds.size()!=0 ">
  496. AND up.tenant_id in
  497. <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
  498. #{item}
  499. </foreach>
  500. </if>
  501. order by up.create_time desc
  502. </select>
  503. <select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  504. resultMap="ClassPeriodStudentVo">
  505. SELECT
  506. u.user_account,
  507. u.user_id,
  508. cgu.`status`,
  509. u.realname,
  510. og.goods_id,
  511. u.id_card,
  512. cgu.grade_id,
  513. u.telphone,
  514. u.one_inch_photos,
  515. u.company_name,
  516. up.`status` as profile_status,
  517. g.class_hours as class_hours,
  518. g.study_start_time as study_start_time,
  519. g.study_end_time as study_end_time,
  520. g.goods_name,
  521. g.code as goods_code,
  522. g.stand_price,
  523. cgu.period_status,
  524. cg.class_start_time,
  525. cg.class_end_time,
  526. cg.class_name,
  527. cgu.period_plush,
  528. cgu.period_status_num,
  529. cgu.period_time,
  530. cgu.order_goods_id,
  531. og.order_sn,
  532. g.major_id,
  533. /* IFNULL(ge.exam_num,0) as exam_num, */
  534. <if test="userPhoto != null and userPhoto == 1">
  535. up.key_value,
  536. </if>
  537. cgu.period_wait_time as end_time,
  538. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  539. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  540. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  541. (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.`type` in (1,3) and ubr.report_status=1 and ubr.order_goods_id = cgu.order_goods_id and ubr.grade_id = cgu.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num
  542. <if test="userPhoto == null">
  543. /* ,(select COUNT(up.id) from user_period up LEFT JOIN user_period_status ups on up.id=ups.period_id where up.goods_id = og.goods_id and up.grade_id = cgu.grade_id and up.order_goods_id = cgu.order_goods_id and up.user_id = u.user_id
  544. and ups.period_status=0 and ups.`status`=0 and (SELECT COUNT(upss.id) from user_period_status upss where upss.id = ups.id and upss.period_status = 1 and upss.`status` = 2) > 0 ) as rebuild_num */
  545. </if>
  546. FROM
  547. class_grade_user cgu
  548. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  549. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  550. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  551. LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  552. LEFT JOIN goods g on og.goods_id = g.goods_id
  553. LEFT JOIN course_business cb ON g.business_id = cb.id
  554. /* LEFT JOIN (SELECT
  555. COUNT( m.id ) AS exam_num,
  556. c.goods_id
  557. FROM
  558. course_menu_exam m
  559. LEFT JOIN goods_course c ON m.course_id = c.course_id
  560. where
  561. m.type in (1,3)
  562. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id */
  563. where 1=1
  564. and cgu.`status` =1
  565. and cb.`period_check_sign` = 1
  566. <if test="periodPlush != null and periodPlush != ''">
  567. AND cgu.period_plush = #{periodPlush}
  568. </if>
  569. <if test="officialStatus != null and officialStatus != ''">
  570. AND cgu.official_status = #{officialStatus}
  571. </if>
  572. <if test="changeGrade != null and changeGrade != ''">
  573. AND cgu.change_grade = #{changeGrade}
  574. </if>
  575. <if test="profileStatus != null and profileStatus != ''">
  576. AND up.status = #{profileStatus}
  577. </if>
  578. <if test="gradeId != null and gradeId !='' ">
  579. and cgu.grade_id = #{gradeId}
  580. </if>
  581. <if test="businessId != null and businessId != ''">
  582. AND g.business_id = #{businessId}
  583. </if>
  584. <if test="projectId != null and projectId != ''">
  585. AND g.project_id = #{projectId}
  586. </if>
  587. <if test="educationTypeId != null and educationTypeId != ''">
  588. AND g.education_type_id = #{educationTypeId}
  589. </if>
  590. <if test="schoolId != null and schoolId != ''">
  591. AND g.school_id = #{schoolId}
  592. </if>
  593. <if test="majorId != null and majorId != ''">
  594. AND g.major_id = #{majorId}
  595. </if>
  596. <if test="periodStatus != null ">
  597. and cgu.period_status = #{periodStatus}
  598. </if>
  599. <if test="classStartTime != null and classStartTime != '' ">
  600. AND cg.class_start_time >= #{classStartTime}
  601. </if>
  602. <if test="classEndTime != null and classEndTime != '' ">
  603. AND #{classEndTime} >= cg.class_end_time
  604. </if>
  605. <if test="studyStatus != null and studyStatus == 1 ">
  606. and cgu.period_status = -1
  607. </if>
  608. <if test="studyStatus != null and studyStatus == 2 ">
  609. and cgu.period_status != -1
  610. </if>
  611. <if test="className != null and className !='' ">
  612. and cg.class_name like concat('%', #{className}, '%')
  613. </if>
  614. <if test="searchKey != null and searchKey != '' ">
  615. and (u.realname like concat('%', #{searchKey}, '%')
  616. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  617. or g.goods_name like concat('%', #{searchKey}, '%')
  618. or cg.class_name like concat('%', #{searchKey}, '%')
  619. or u.company_name like concat('%', #{searchKey}, '%'))
  620. </if>
  621. <if test="inputOrderSn != null and inputOrderSn != '' ">
  622. and (select count(*) from `order` o where o.order_sn =og.order_sn and o.input_order_sn = #{inputOrderSn})>0
  623. </if>
  624. <if test="companyName != null and companyName != '' ">
  625. and u.company_name like concat('%', #{companyName}, '%')
  626. </if>
  627. <if test="idCard != null and idCard !='' ">
  628. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  629. </if>
  630. <if test="telphone != null and telphone !='' ">
  631. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  632. </if>
  633. <if test="searchStartTime != null and searchStartTime !='' ">
  634. AND cgu.create_time >=#{searchStartTime}
  635. </if>
  636. <if test="searchEndTime != null and searchEndTime !='' ">
  637. AND #{searchEndTime} >= cgu.create_time
  638. </if>
  639. <if test="periodStartTime != null and periodStartTime !='' ">
  640. AND cgu.period_time >=#{periodStartTime}
  641. </if>
  642. <if test="periodEndTime != null and periodEndTime !='' ">
  643. AND #{periodEndTime} >= cgu.period_time
  644. </if>
  645. <if test="periodStatus != 2 and periodStatus != 3">
  646. order by cgu.update_time desc
  647. </if>
  648. <if test="periodStatus == 2 ">
  649. order by cgu.period_wait_time,cgu.create_time
  650. </if>
  651. <if test="periodStatus == 3 ">
  652. order by cgu.period_ing_time,cgu.create_time
  653. </if>
  654. </select>
  655. <select id="listUserPeriodNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  656. resultType="java.lang.Long">
  657. SELECT
  658. count(cgu.id)
  659. FROM
  660. class_grade_user cgu
  661. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  662. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  663. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  664. LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  665. LEFT JOIN goods g on og.goods_id = g.goods_id
  666. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  667. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  668. LEFT JOIN course_business cb ON g.business_id = cb.id
  669. where 1=1
  670. and cgu.`status` =1
  671. and cb.`period_check_sign` = 1
  672. <if test="projectIds != null and projectIds.size()!=0 ">
  673. AND g.project_id in
  674. <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
  675. #{item}
  676. </foreach>
  677. </if>
  678. <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
  679. AND g.education_type_id in
  680. <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
  681. #{item}
  682. </foreach>
  683. </if>
  684. <if test="periodStatus != null ">
  685. and cgu.period_status = #{periodStatus}
  686. </if>
  687. <if test="searchKey != null and searchKey != '' ">
  688. and u.realname like concat('%', #{searchKey}, '%')
  689. </if>
  690. <if test="idCard != null and idCard !='' ">
  691. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  692. </if>
  693. <if test="tenantIds != null and tenantIds.size()!=0 ">
  694. AND cgu.tenant_id in
  695. <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
  696. #{item}
  697. </foreach>
  698. </if>
  699. order by cgu.update_time desc
  700. </select>
  701. <select id="listUserPeriodNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  702. resultType="com.zhongzheng.modules.grade.vo.ClassPeriodStudentNewVo">
  703. SELECT
  704. u.user_id,
  705. u.realname,
  706. og.goods_id,
  707. u.id_card,
  708. cgu.grade_id,
  709. u.telphone,
  710. up.`status` as profile_status,
  711. g.goods_name,
  712. cg.class_name,
  713. cgu.order_goods_id,
  714. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  715. cgu.period_wait_time as end_time,
  716. cgu.tenant_id,
  717. CONCAT(cet.education_name,cpt.project_name,cb.business_name) AS fullName
  718. FROM
  719. class_grade_user cgu
  720. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  721. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  722. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  723. LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  724. LEFT JOIN goods g on og.goods_id = g.goods_id
  725. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  726. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  727. LEFT JOIN course_business cb ON g.business_id = cb.id
  728. where 1=1
  729. and cgu.`status` =1
  730. and cb.`period_check_sign` = 1
  731. <if test="projectIds != null and projectIds.size()!=0 ">
  732. AND g.project_id in
  733. <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
  734. #{item}
  735. </foreach>
  736. </if>
  737. <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
  738. AND g.education_type_id in
  739. <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
  740. #{item}
  741. </foreach>
  742. </if>
  743. <if test="periodStatus != null ">
  744. and cgu.period_status = #{periodStatus}
  745. </if>
  746. <if test="searchKey != null and searchKey != '' ">
  747. and u.realname like concat('%', #{searchKey}, '%')
  748. </if>
  749. <if test="idCard != null and idCard !='' ">
  750. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  751. </if>
  752. <if test="tenantIds != null and tenantIds.size()!=0 ">
  753. AND cgu.tenant_id in
  754. <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
  755. #{item}
  756. </foreach>
  757. </if>
  758. order by cgu.update_time desc
  759. </select>
  760. <select id="getEduIdByTenant" parameterType="map" resultType="java.lang.Long">
  761. SELECT id FROM course_education_type WHERE tenant_id = #{tenantId} AND education_name = #{eduName} AND `status` = 1 LIMIT 1
  762. </select>
  763. <select id="getProIdByTenant" parameterType="map" resultType="java.lang.Long">
  764. SELECT id FROM course_project_type WHERE tenant_id = #{tenantId} AND project_name = #{proName} AND education_id = #{eduId} AND `status` = 1 LIMIT 1
  765. </select>
  766. <select id="exportUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  767. resultMap="ClassPeriodStudentVo">
  768. SELECT
  769. u.user_account,
  770. u.user_id,
  771. cgu.`status`,
  772. u.realname,
  773. og.goods_id,
  774. u.id_card,
  775. cgu.grade_id,
  776. u.telphone,
  777. u.one_inch_photos,
  778. u.company_name,
  779. up.`status` as profile_status,
  780. g.class_hours as class_hours,
  781. g.study_start_time as study_start_time,
  782. g.study_end_time as study_end_time,
  783. g.goods_name,
  784. g.code as goods_code,
  785. g.stand_price,
  786. cgu.period_status,
  787. cg.class_start_time,
  788. cg.class_end_time,
  789. cg.class_name,
  790. cgu.period_plush,
  791. cgu.period_status_num,
  792. cgu.period_time,
  793. cgu.order_goods_id,
  794. og.order_sn,
  795. g.major_id,
  796. IFNULL(ge.exam_num,0) as exam_num,
  797. <if test="userPhoto != null and userPhoto == 1">
  798. up.key_value,
  799. </if>
  800. cgu.period_wait_time as end_time,
  801. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  802. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  803. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  804. (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.`type` in (1,3) and ubr.report_status=1 and ubr.order_goods_id = cgu.order_goods_id and ubr.grade_id = cgu.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num
  805. <if test="userPhoto == null">
  806. /* ,(select COUNT(up.id) from user_period up LEFT JOIN user_period_status ups on up.id=ups.period_id where up.goods_id = og.goods_id and up.grade_id = cgu.grade_id and up.order_goods_id = cgu.order_goods_id and up.user_id = u.user_id
  807. and ups.period_status=0 and ups.`status`=0 and (SELECT COUNT(upss.id) from user_period_status upss where upss.id = ups.id and upss.period_status = 1 and upss.`status` = 2) > 0 ) as rebuild_num */
  808. </if>
  809. FROM
  810. class_grade_user cgu
  811. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  812. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  813. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  814. LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  815. LEFT JOIN goods g on og.goods_id = g.goods_id
  816. LEFT JOIN course_business cb ON g.business_id = cb.id
  817. LEFT JOIN (SELECT
  818. COUNT( m.id ) AS exam_num,
  819. c.goods_id
  820. FROM
  821. course_menu_exam m
  822. LEFT JOIN goods_course c ON m.course_id = c.course_id
  823. where
  824. m.type in (1,3)
  825. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  826. where 1=1
  827. and cgu.`status` =1
  828. and cb.`period_check_sign` = 1
  829. <if test="periodPlush != null and periodPlush != ''">
  830. AND cgu.period_plush = #{periodPlush}
  831. </if>
  832. <if test="officialStatus != null and officialStatus != ''">
  833. AND cgu.official_status = #{officialStatus}
  834. </if>
  835. <if test="changeGrade != null and changeGrade != ''">
  836. AND cgu.change_grade = #{changeGrade}
  837. </if>
  838. <if test="profileStatus != null and profileStatus != ''">
  839. AND up.status = #{profileStatus}
  840. </if>
  841. <if test="gradeId != null and gradeId !='' ">
  842. and cgu.grade_id = #{gradeId}
  843. </if>
  844. <if test="businessId != null and businessId != ''">
  845. AND g.business_id = #{businessId}
  846. </if>
  847. <if test="projectId != null and projectId != ''">
  848. AND g.project_id = #{projectId}
  849. </if>
  850. <if test="educationTypeId != null and educationTypeId != ''">
  851. AND g.education_type_id = #{educationTypeId}
  852. </if>
  853. <if test="schoolId != null and schoolId != ''">
  854. AND g.school_id = #{schoolId}
  855. </if>
  856. <if test="majorId != null and majorId != ''">
  857. AND g.major_id = #{majorId}
  858. </if>
  859. <if test="periodStatus != null ">
  860. and cgu.period_status = #{periodStatus}
  861. </if>
  862. <if test="classStartTime != null and classStartTime != '' ">
  863. AND cg.class_start_time >= #{classStartTime}
  864. </if>
  865. <if test="classEndTime != null and classEndTime != '' ">
  866. AND #{classEndTime} >= cg.class_end_time
  867. </if>
  868. <if test="studyStatus != null and studyStatus == 1 ">
  869. and cgu.period_status = -1
  870. </if>
  871. <if test="studyStatus != null and studyStatus == 2 ">
  872. and cgu.period_status != -1
  873. </if>
  874. <if test="className != null and className !='' ">
  875. and cg.class_name like concat('%', #{className}, '%')
  876. </if>
  877. <if test="searchKey != null and searchKey != '' ">
  878. and (u.realname like concat('%', #{searchKey}, '%')
  879. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  880. or g.goods_name like concat('%', #{searchKey}, '%')
  881. or cg.class_name like concat('%', #{searchKey}, '%')
  882. or u.company_name like concat('%', #{searchKey}, '%'))
  883. </if>
  884. <if test="inputOrderSn != null and inputOrderSn != '' ">
  885. and (select count(*) from `order` o where o.order_sn =og.order_sn and o.input_order_sn = #{inputOrderSn})>0
  886. </if>
  887. <if test="companyName != null and companyName != '' ">
  888. and u.company_name like concat('%', #{companyName}, '%')
  889. </if>
  890. <if test="idCard != null and idCard !='' ">
  891. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  892. </if>
  893. <if test="telphone != null and telphone !='' ">
  894. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  895. </if>
  896. <if test="searchStartTime != null and searchStartTime !='' ">
  897. AND cgu.create_time >=#{searchStartTime}
  898. </if>
  899. <if test="searchEndTime != null and searchEndTime !='' ">
  900. AND #{searchEndTime} >= cgu.create_time
  901. </if>
  902. <if test="periodStartTime != null and periodStartTime !='' ">
  903. AND cgu.period_time >=#{periodStartTime}
  904. </if>
  905. <if test="periodEndTime != null and periodEndTime !='' ">
  906. AND #{periodEndTime} >= cgu.period_time
  907. </if>
  908. <if test="periodStatus != 2 and periodStatus != 3">
  909. order by cgu.update_time desc
  910. </if>
  911. <if test="periodStatus == 2 ">
  912. order by cgu.period_wait_time,cgu.create_time
  913. </if>
  914. <if test="periodStatus == 3 ">
  915. order by cgu.period_ing_time,cgu.create_time
  916. </if>
  917. </select>
  918. <select id="listUserPeriodTotal" parameterType="java.lang.Integer" resultType="java.lang.Long">
  919. SELECT
  920. COUNT( cgu.id )
  921. FROM
  922. class_grade_user cgu
  923. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  924. LEFT JOIN goods g ON og.goods_id = g.goods_id
  925. LEFT JOIN course_business cb ON g.business_id = cb.id
  926. WHERE
  927. cgu.`status` = 1
  928. AND cb.period_check_sign = 1
  929. AND cgu.period_status = #{periodStatus}
  930. </select>
  931. <select id="listUserWeekStudyTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  932. resultType="Long">
  933. SELECT
  934. IFNULL( SUM( cs.duration_time ), 0 )
  935. FROM
  936. (
  937. SELECT
  938. section_id
  939. FROM
  940. user_study_record
  941. WHERE
  942. user_id = #{userId}
  943. AND grade_id = #{gradeId}
  944. AND order_goods_id = #{orderGoodsId}
  945. AND current_status = 1
  946. AND `status` = 1
  947. <if test="searchWeekStartTime != null and searchWeekStartTime != '' ">
  948. AND update_time >= #{searchWeekStartTime}
  949. </if>
  950. <if test="searchWeekEndTime != null and searchWeekEndTime != '' ">
  951. AND #{searchWeekEndTime} >= update_time
  952. </if>
  953. GROUP BY
  954. course_id,
  955. module_id,
  956. chapter_id,
  957. section_id
  958. ) usr
  959. LEFT JOIN course_section cs ON usr.section_id = cs.section_id
  960. </select>
  961. <select id="listUserWeekPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  962. resultMap="ClassPeriodStudentVo">
  963. SELECT
  964. u.user_account,
  965. u.user_id,
  966. cgu.`status`,
  967. u.realname,
  968. og.goods_id,
  969. u.id_card,
  970. cgu.grade_id,
  971. u.telphone,
  972. u.one_inch_photos,
  973. up.`status` as profile_status,
  974. g.class_hours as class_hours,
  975. g.study_start_time as study_start_time,
  976. g.study_end_time as study_end_time,
  977. g.goods_name,
  978. g.code as goods_code,
  979. g.stand_price,
  980. cgu.period_status,
  981. cg.class_start_time,
  982. cg.class_end_time,
  983. cg.class_name,
  984. cgu.period_plush,
  985. cgu.period_status_num,
  986. cgu.period_time,
  987. cgu.order_goods_id,
  988. <if test="userPhoto != null and userPhoto == 1">
  989. up.key_value,
  990. </if>
  991. cgu.period_wait_time as end_time
  992. <if test="userPhoto == null">
  993. ,(select COUNT(up.id) from user_period up LEFT JOIN user_period_status ups on up.id=ups.period_id where up.goods_id = og.goods_id and up.grade_id = cgu.grade_id and up.user_id = u.user_id
  994. and ups.period_status=0 and ups.`status`=0 and (SELECT COUNT(upss.id) from user_period_status upss where upss.id = ups.id and upss.period_status = 1 and upss.`status` = 2) > 0 ) as rebuild_num
  995. </if>
  996. FROM
  997. class_grade_user cgu
  998. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  999. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1000. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1001. LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = og.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  1002. LEFT JOIN goods g on og.goods_id = g.goods_id
  1003. LEFT JOIN course_business cb ON g.business_id = cb.id
  1004. where 1=1
  1005. and cgu.`status` =1
  1006. <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
  1007. AND (SELECT count(*) from user_study_record usr where usr.user_id = cgu.user_id AND usr.grade_id = cgu.grade_id AND usr.current_status = 1 AND #{searchWeekEndTime} >= usr.update_time AND usr.update_time >=#{searchWeekStartTime}) >0
  1008. </if>
  1009. <if test="periodPlush != null and periodPlush != ''">
  1010. AND cgu.period_plush = #{periodPlush}
  1011. </if>
  1012. <if test="officialStatus != null and officialStatus != ''">
  1013. AND cgu.official_status = #{officialStatus}
  1014. </if>
  1015. <if test="changeGrade != null and changeGrade != ''">
  1016. AND cgu.change_grade = #{changeGrade}
  1017. </if>
  1018. <if test="profileStatus != null and profileStatus != ''">
  1019. AND up.status = #{profileStatus}
  1020. </if>
  1021. <if test="gradeId != null and gradeId !='' ">
  1022. and cgu.grade_id = #{gradeId}
  1023. </if>
  1024. <if test="businessId != null and businessId != ''">
  1025. AND g.business_id = #{businessId}
  1026. </if>
  1027. <if test="educationTypeId != null and educationTypeId != ''">
  1028. AND g.education_type_id = #{educationTypeId}
  1029. </if>
  1030. <if test="schoolId != null and schoolId != ''">
  1031. AND g.school_id = #{schoolId}
  1032. </if>
  1033. <if test="majorId != null and majorId != ''">
  1034. AND g.major_id = #{majorId}
  1035. </if>
  1036. <if test="periodStatus != null ">
  1037. and cgu.period_status = #{periodStatus}
  1038. </if>
  1039. <if test="classStartTime != null and classStartTime != '' ">
  1040. AND cg.class_start_time >= #{classStartTime}
  1041. </if>
  1042. <if test="classEndTime != null and classEndTime != '' ">
  1043. AND #{classEndTime} >= cg.class_end_time
  1044. </if>
  1045. <if test="studyStatus != null and studyStatus == 1 ">
  1046. and cgu.period_status = -1
  1047. </if>
  1048. <if test="studyStatus != null and studyStatus == 2 ">
  1049. and cgu.period_status != -1
  1050. </if>
  1051. <if test="className != null and className !='' ">
  1052. and cg.class_name like concat('%', #{className}, '%')
  1053. </if>
  1054. <if test="searchKey != null and searchKey != '' ">
  1055. and (u.realname like concat('%', #{searchKey}, '%') or g.goods_name like concat('%', #{searchKey}, '%') or cg.class_name like concat('%', #{searchKey}, '%'))
  1056. </if>
  1057. <if test="idCard != null and idCard !='' ">
  1058. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1059. </if>
  1060. <if test="telphone != null and telphone !='' ">
  1061. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1062. </if>
  1063. <if test="searchStartTime != null and searchStartTime !='' ">
  1064. AND cgu.create_time >=#{searchStartTime}
  1065. </if>
  1066. <if test="searchEndTime != null and searchEndTime !='' ">
  1067. AND #{searchEndTime} >= cgu.create_time
  1068. </if>
  1069. <if test="periodStartTime != null and periodStartTime !='' ">
  1070. AND cgu.period_time >=#{periodStartTime}
  1071. </if>
  1072. <if test="periodEndTime != null and periodEndTime !='' ">
  1073. AND #{periodEndTime} >= cgu.period_time
  1074. </if>
  1075. <!-- 数据范围过滤 -->
  1076. ${params.dataScope}
  1077. <if test="periodStatus != 2 and periodStatus != 3">
  1078. order by cgu.update_time desc
  1079. </if>
  1080. <if test="periodStatus == 2 ">
  1081. order by cgu.period_wait_time,cgu.create_time
  1082. </if>
  1083. <if test="periodStatus == 3 ">
  1084. order by cgu.period_ing_time,cgu.create_time
  1085. </if>
  1086. </select>
  1087. <select id="listUserPeriodExport" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1088. resultMap="ClassPeriodStudentVo">
  1089. SELECT
  1090. u.user_account,
  1091. u.user_id,
  1092. cgu.`status`,
  1093. u.realname,
  1094. og.goods_id,
  1095. u.id_card,
  1096. cgu.grade_id,
  1097. u.telphone,
  1098. g.class_hours as class_hours,
  1099. g.study_start_time as study_start_time,
  1100. g.study_end_time as study_end_time,
  1101. g.goods_name,
  1102. g.code as goods_code,
  1103. g.stand_price,
  1104. cgu.period_status,
  1105. cg.class_start_time,
  1106. cg.class_end_time,
  1107. cg.class_name,
  1108. cgu.period_plush,
  1109. cgu.period_status_num,
  1110. cgu.order_goods_id,
  1111. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  1112. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  1113. <if test="userPhoto != null and userPhoto == 1">
  1114. up.key_value,
  1115. </if>
  1116. cgu.period_time as end_time
  1117. FROM
  1118. class_grade_user cgu
  1119. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1120. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1121. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1122. LEFT JOIN goods g on og.goods_id = g.goods_id
  1123. LEFT JOIN course_business cb ON g.business_id = cb.id
  1124. LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = g.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  1125. where 1=1
  1126. <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
  1127. AND (SELECT count(*) from user_study_record usr where usr.user_id = cgu.user_id AND usr.grade_id = cgu.grade_id AND usr.current_status = 1 AND #{searchWeekEndTime} >= usr.update_time AND usr.update_time >=#{searchWeekStartTime}) >0
  1128. </if>
  1129. and cgu.`status` =1
  1130. <if test="periodPlush != null and periodPlush != ''">
  1131. AND cgu.period_plush = #{periodPlush}
  1132. </if>
  1133. <if test="officialStatus != null and officialStatus != ''">
  1134. AND cgu.official_status = #{officialStatus}
  1135. </if>
  1136. <if test="changeGrade != null and changeGrade != ''">
  1137. AND cgu.change_grade = #{changeGrade}
  1138. </if>
  1139. <if test="profileStatus != null and profileStatus != ''">
  1140. AND up.status = #{profileStatus}
  1141. </if>
  1142. <if test="gradeId != null and gradeId !='' ">
  1143. and cgu.grade_id = #{gradeId}
  1144. </if>
  1145. <if test="businessId != null and businessId != ''">
  1146. AND g.business_id = #{businessId}
  1147. </if>
  1148. <if test="educationTypeId != null and educationTypeId != ''">
  1149. AND g.education_type_id = #{educationTypeId}
  1150. </if>
  1151. <if test="schoolId != null and schoolId != ''">
  1152. AND g.school_id = #{schoolId}
  1153. </if>
  1154. <if test="majorId != null and majorId != ''">
  1155. AND g.major_id = #{majorId}
  1156. </if>
  1157. <if test="periodStatus != null ">
  1158. and cgu.period_status = #{periodStatus}
  1159. </if>
  1160. <if test="classStartTime != null and classStartTime != '' ">
  1161. AND cg.class_start_time >= #{classStartTime}
  1162. </if>
  1163. <if test="classEndTime != null and classEndTime != '' ">
  1164. AND #{classEndTime} >= cg.class_end_time
  1165. </if>
  1166. <if test="studyStatus != null and studyStatus == 1 ">
  1167. and cgu.period_status = -1
  1168. </if>
  1169. <if test="studyStatus != null and studyStatus == 2 ">
  1170. and cgu.period_status != -1
  1171. </if>
  1172. <if test="searchKey != null and searchKey != '' ">
  1173. and (
  1174. u.realname like concat('%', #{searchKey}, '%')
  1175. or u.id_card like concat('%', #{searchKey}, '%')
  1176. or g.goods_name like concat('%', #{searchKey}, '%')
  1177. or cg.class_name like concat('%', #{searchKey}, '%')
  1178. or u.company_name like concat('%', #{searchKey}, '%'))
  1179. </if>
  1180. <if test="searchStartTime != null and searchStartTime !='' ">
  1181. AND cgu.create_time >=#{searchStartTime}
  1182. </if>
  1183. <if test="searchEndTime != null and searchEndTime !='' ">
  1184. AND #{searchEndTime} >= cgu.create_time
  1185. </if>
  1186. <!-- 数据范围过滤 -->
  1187. ${params.dataScope}
  1188. <if test="periodStatus != 2 and periodStatus != 3">
  1189. order by cgu.update_time desc
  1190. </if>
  1191. <if test="periodStatus == 2 ">
  1192. order by cgu.period_wait_time,cgu.create_time
  1193. </if>
  1194. <if test="periodStatus == 3 ">
  1195. order by cgu.period_ing_time,cgu.create_time
  1196. </if>
  1197. </select>
  1198. <select id="userPeriodStatus" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1199. resultMap="ClassPeriodStudentVo">
  1200. SELECT
  1201. IFNULL(ge.exam_num,0) as exam_num,
  1202. cg.class_start_time,
  1203. cg.class_end_time,
  1204. g.study_start_time,
  1205. g.study_end_time,
  1206. (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.report_status=1 and ubr.`type` in (1,3) and ubr.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
  1207. cgu.user_id,
  1208. og.goods_id
  1209. FROM
  1210. class_grade_user cgu
  1211. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1212. LEFT JOIN order_goods og on og.order_goods_id=cgu.order_goods_id
  1213. LEFT JOIN goods g on g.goods_id=og.goods_id
  1214. LEFT JOIN (SELECT
  1215. COUNT( m.id ) AS exam_num,
  1216. c.goods_id
  1217. FROM
  1218. course_menu_exam m
  1219. LEFT JOIN goods_course c ON m.course_id = c.course_id
  1220. where
  1221. m.type in (1,3)
  1222. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  1223. where 1=1
  1224. and cgu.`status` =1
  1225. <if test="gradeId != null and gradeId !='' ">
  1226. and cgu.grade_id = #{gradeId}
  1227. </if>
  1228. <if test="userId != null ">
  1229. and cgu.user_id = #{userId}
  1230. </if>
  1231. <if test="orderGoodsId != null ">
  1232. and cgu.order_goods_id = #{orderGoodsId}
  1233. </if>
  1234. LIMIT 1
  1235. </select>
  1236. <select id="listPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1237. resultMap="ClassPeriodUserVo">
  1238. SELECT
  1239. u.user_account,
  1240. u.realname,
  1241. u.id_card,
  1242. u.user_id,
  1243. u.telphone,
  1244. u.sex,
  1245. g.goods_id,
  1246. g.goods_name,
  1247. cg.class_name,
  1248. cg.official_name,
  1249. cg.class_start_time,
  1250. cg.class_end_time,
  1251. cg.official_name,
  1252. cg.status as grade_status,
  1253. g.class_hours,
  1254. u.one_inch_photos,
  1255. u.id_card_img1,
  1256. u.id_card_img2,
  1257. cgu.period_status,
  1258. cgu.order_goods_id,
  1259. (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
  1260. order_goods og on og.goods_id = c.goods_id where og.order_goods_id=cgu.order_goods_id and m.type in (1,3) ) as exam_num,
  1261. (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id, ubr.exam_id) FROM user_bank_record ubr where ubr.`status` = 1 and ubr.`type` in (1,3) and ubr.report_status =1 and ubr.user_id=#{userId} and ubr.grade_id=cgu.grade_id and ubr.order_goods_id=cgu.order_goods_id and ubr.current_status=1) as record_num,
  1262. (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
  1263. ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and up.grade_id = cgu.grade_id and (up.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) and up.`type` = 1) as pass,
  1264. (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
  1265. ups.`status` =2 and up.grade_id = cg.grade_id and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and (up.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) and up.user_id = #{userId} and up.`type` = 1) as pending,
  1266. (SELECT
  1267. COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.section_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
  1268. =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and (up.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) and up.user_id = #{userId} and up.`type` = 1) as cheat,
  1269. (SELECT COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.exam_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
  1270. ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and (up.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) and up.grade_id = cg.grade_id and up.`type` in (2,3)) as exam_pass,
  1271. (SELECT
  1272. COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.exam_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
  1273. =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and (up.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) and up.user_id = #{userId} and up.`type` in (2,3)) as exam_cheat,
  1274. (SELECT
  1275. COUNT(DISTINCT up.course_id,up.module_id,up.chapter_id,up.exam_id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
  1276. =2 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and (up.order_goods_id=cgu.order_goods_id or up.order_goods_id is null) and up.user_id = #{userId} and up.`type` in (2,3)) as exam_pending,
  1277. (SELECT up.key_value FROM user_profile up where up.goods_id = #{goodsId} and up.user_id =#{userId} and up.order_goods_id = cgu.order_goods_id and up.current_status = 1 and up.`status` = 1 and up.type_status =1 LIMIT 1) as key_value,
  1278. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year
  1279. <if test="userId != null and userId !='' ">
  1280. ,(SELECT MIN(first_start_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId} and order_goods_id=#{orderGoodsId}) as study_start_time,
  1281. (SELECT MAX(end_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId} and order_goods_id=#{orderGoodsId}) as study_end_time
  1282. </if>
  1283. FROM
  1284. class_grade_user cgu
  1285. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1286. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1287. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1288. LEFT JOIN goods g ON g.goods_id = og.goods_id
  1289. where 1=1
  1290. <if test="userId != null and userId !='' ">
  1291. and u.user_id = #{userId}
  1292. </if>
  1293. <if test="gradeId != null and gradeId !='' ">
  1294. and cgu.grade_id = #{gradeId}
  1295. </if>
  1296. <if test="periodStatus != null and periodStatus !='' ">
  1297. and cgu.period_status = #{periodStatus}
  1298. </if>
  1299. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1300. and cgu.order_goods_id = #{orderGoodsId}
  1301. </if>
  1302. LIMIT 1
  1303. </select>
  1304. <select id="listPeriodAudit" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1305. resultMap="ClassPeriodVo">
  1306. SELECT
  1307. gc.sort as course_sort,
  1308. cm.sort,
  1309. cm.menu_id as id,
  1310. cm.course_id,
  1311. (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  1312. and u.user_id = #{userId}
  1313. </if>) as realname,
  1314. (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  1315. and u.user_id = #{userId}
  1316. </if>) as user_id,
  1317. (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
  1318. 0 as common_sign,
  1319. (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on
  1320. cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
  1321. 1 as type,
  1322. NULL as study_start_time,
  1323. NULL as study_end_time
  1324. FROM
  1325. course_menu cm
  1326. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  1327. where 1=1
  1328. <if test="goodsId != null and goodsId !='' ">
  1329. and gc.goods_id=#{goodsId}
  1330. </if>
  1331. <if test="courseId != null and courseId !='' ">
  1332. and gc.course_id=#{courseId}
  1333. </if>
  1334. AND cm.type=1
  1335. UNION
  1336. SELECT
  1337. gc.sort as course_sort,
  1338. cm.sort,
  1339. cm.menu_id as id,
  1340. cm.course_id,
  1341. (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  1342. and u.user_id = #{userId}
  1343. </if>) as realname,
  1344. (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  1345. and u.user_id = #{userId}
  1346. </if>) as user_id,
  1347. (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
  1348. (SELECT cc.common_sign FROM course_chapter cc where cm.menu_id = cc.chapter_id) as common_sign,
  1349. (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs where ccs.chapter_id=cm.menu_id) as class_hours,
  1350. 2 as type,
  1351. (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
  1352. ccs.section_id and ccs.chapter_id = usr.chapter_id where ccs.chapter_id = cm.menu_id AND usr.current_status = 1 AND usr.user_id=#{userId} and usr.course_id = cm.course_id and usr.goods_id = gc.goods_id and usr.grade_id = #{gradeId} and usr.order_goods_id = #{orderGoodsId} ORDER BY usr.create_time ASC
  1353. limit 1) as study_start_time,
  1354. (SELECT usr.update_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
  1355. ccs.section_id and ccs.chapter_id = usr.chapter_id where ccs.chapter_id = cm.menu_id AND usr.current_status = 1 AND usr.user_id=#{userId} and usr.course_id = cm.course_id and usr.goods_id = gc.goods_id and usr.grade_id = #{gradeId} and usr.order_goods_id = #{orderGoodsId} ORDER BY usr.create_time DESC
  1356. limit 1) as study_end_time
  1357. FROM
  1358. course_menu cm
  1359. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  1360. where 1=1
  1361. <if test="goodsId != null and goodsId !='' ">
  1362. and gc.goods_id=#{goodsId}
  1363. </if>
  1364. <if test="courseId != null and courseId !='' ">
  1365. and gc.course_id=#{courseId}
  1366. </if>
  1367. AND cm.type=2
  1368. </select>
  1369. <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1370. resultMap="ClassPeriodVo">
  1371. SELECT
  1372. gc.sort as course_sort,
  1373. cm.sort,
  1374. cm.menu_id as id,
  1375. cm.course_id,
  1376. (SELECT u.realname FROM `user` u where 1=1
  1377. <if test="userId != null and userId !='' ">
  1378. and u.user_id = #{userId}
  1379. </if>
  1380. ) as realname,
  1381. (SELECT u.user_id FROM `user` u where 1=1
  1382. <if test="userId != null and userId !='' ">
  1383. and u.user_id = #{userId}
  1384. </if>
  1385. ) as user_id,
  1386. cs.`name` as type_name,
  1387. cs.duration_time,
  1388. cs.real_live_start_time,
  1389. cs.real_live_end_time,
  1390. cs.real_duration,
  1391. cs.section_type,
  1392. null as class_hours,
  1393. 3 as type
  1394. FROM
  1395. course_menu cm
  1396. LEFT JOIN course_section cs on cm.menu_id = cs.section_id
  1397. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  1398. where 1=1
  1399. <if test="goodsId != null and goodsId !='' ">
  1400. and gc.goods_id = #{goodsId}
  1401. </if>
  1402. <if test="courseId != null ">
  1403. and gc.course_id=#{courseId}
  1404. </if>
  1405. AND cm.type=3
  1406. </select>
  1407. <select id="listPeriodAuditExam" parameterType="map" resultMap="ClassPeriodChapterVo">
  1408. SELECT
  1409. cme.exam_id as id,
  1410. cme.course_id,
  1411. (SELECT u.realname FROM `user` u where 1=1
  1412. <if test="userId != null and userId !='' ">
  1413. and u.user_id = #{userId}
  1414. </if>
  1415. ) as realname,
  1416. (SELECT u.user_id FROM `user` u where 1=1
  1417. <if test="userId != null and userId !='' ">
  1418. and u.user_id = #{userId}
  1419. </if>
  1420. ) as user_id,
  1421. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1422. null as class_hours,
  1423. 4 as type,
  1424. (
  1425. SELECT
  1426. ups.record_start_time
  1427. FROM
  1428. user_period_status ups
  1429. LEFT JOIN user_period up ON up.id = ups.period_id
  1430. WHERE
  1431. period_status = 1
  1432. AND up.course_id = gc.course_id
  1433. <if test="goodsId != null and goodsId !='' ">
  1434. AND up.goods_id = #{goodsId}
  1435. </if>
  1436. and cme.section_id =up.section_id
  1437. AND up.exam_id = cme.exam_id
  1438. ) AS study_start_time,
  1439. (
  1440. SELECT
  1441. ups.record_end_time
  1442. FROM
  1443. user_period_status ups
  1444. LEFT JOIN user_period up ON up.id = ups.period_id
  1445. WHERE
  1446. period_status = 1
  1447. AND up.course_id = gc.course_id
  1448. <if test="goodsId != null and goodsId !='' ">
  1449. AND up.goods_id = #{goodsId}
  1450. </if>
  1451. AND up.exam_id = cme.exam_id
  1452. ) AS study_end_time,
  1453. (
  1454. SELECT
  1455. ups.`status`
  1456. FROM
  1457. user_period_status ups
  1458. LEFT JOIN user_period up ON up.id = ups.period_id
  1459. WHERE
  1460. period_status = 1
  1461. AND up.course_id = gc.course_id
  1462. <if test="goodsId != null and goodsId !='' ">
  1463. AND up.goods_id = #{goodsId}
  1464. </if>
  1465. and cme.section_id =up.section_id
  1466. AND up.exam_id = cme.exam_id
  1467. ) AS STATUS,
  1468. (
  1469. SELECT
  1470. ups.create_time
  1471. FROM
  1472. user_period_status ups
  1473. LEFT JOIN user_period up ON up.id = ups.period_id
  1474. WHERE
  1475. period_status = 1
  1476. AND up.course_id = gc.course_id
  1477. <if test="goodsId != null and goodsId !='' ">
  1478. AND up.goods_id = #{goodsId}
  1479. </if>
  1480. and cme.section_id =up.section_id
  1481. AND up.exam_id = cme.exam_id
  1482. ) AS audit_time,
  1483. (
  1484. SELECT
  1485. COUNT( ups.id )
  1486. FROM
  1487. user_period_status ups
  1488. LEFT JOIN user_period up ON up.id = ups.period_id
  1489. WHERE
  1490. period_status = 1
  1491. AND up.course_id = gc.course_id
  1492. <if test="goodsId != null and goodsId !='' ">
  1493. AND up.goods_id = #{goodsId}
  1494. </if>
  1495. and cme.section_id =up.section_id
  1496. AND up.exam_id = cme.exam_id
  1497. ) AS audit_num
  1498. FROM
  1499. course_menu_exam cme
  1500. LEFT JOIN goods_course gc on gc.course_id = cme.course_id
  1501. LEFT JOIN course_menu cm on cme.section_id = cm.menu_id
  1502. where 1=1
  1503. <if test="goodsId != null and goodsId !='' ">
  1504. and gc.goods_id= #{goodsId}
  1505. </if>
  1506. AND cm.type=3 and cme.chapter_id=0 and cme.module_id=0 and cme.type=1 and cm.type=3
  1507. </select>
  1508. <select id="listperiodChapter" parameterType="map" resultMap="ClassPeriodChapterVo">
  1509. SELECT
  1510. cmc.sort,
  1511. cc.chapter_id as id,
  1512. cc.common_sign,
  1513. cm.course_id,
  1514. ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
  1515. and u.user_id = #{userId}
  1516. </if> LIMIT 1) AS realname,
  1517. ( SELECT u.user_id FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
  1518. and u.user_id = #{userId}
  1519. </if> LIMIT 1) AS user_id,
  1520. cc.`name` as type_name,
  1521. ( SELECT COUNT( ccs.section_id ) FROM course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id ) AS
  1522. class_hours,
  1523. 2 AS type,
  1524. (
  1525. SELECT
  1526. usr.create_time
  1527. FROM
  1528. user_study_record usr
  1529. LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
  1530. WHERE
  1531. ccs.chapter_id = cc.chapter_id
  1532. AND usr.current_status = 1
  1533. <if test="courseId != null ">
  1534. AND usr.course_id=#{courseId}
  1535. </if>
  1536. <if test="moduleId != null">
  1537. AND usr.module_id=#{moduleId}
  1538. </if>
  1539. <if test="goodsId != null and goodsId !='' ">
  1540. AND usr.goods_id=#{goodsId}
  1541. </if>
  1542. <if test="gradeId != null and gradeId !='' ">
  1543. AND usr.grade_id=#{gradeId}
  1544. </if>
  1545. <if test="userId != null and userId !='' ">
  1546. AND usr.user_id=#{userId}
  1547. </if>
  1548. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1549. AND usr.order_goods_id=#{orderGoodsId}
  1550. </if>
  1551. ORDER BY
  1552. usr.create_time ASC
  1553. LIMIT 1
  1554. ) AS study_start_time,
  1555. (
  1556. SELECT
  1557. usr.update_time
  1558. FROM
  1559. user_study_record usr
  1560. LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
  1561. WHERE
  1562. ccs.chapter_id = cc.chapter_id
  1563. AND usr.current_status = 1
  1564. <if test="courseId != null ">
  1565. AND usr.course_id=#{courseId}
  1566. </if>
  1567. <if test="moduleId != null">
  1568. AND usr.module_id=#{moduleId}
  1569. </if>
  1570. <if test="goodsId != null and goodsId !='' ">
  1571. AND usr.goods_id=#{goodsId}
  1572. </if>
  1573. <if test="gradeId != null and gradeId !='' ">
  1574. AND usr.grade_id=#{gradeId}
  1575. </if>
  1576. <if test="userId != null and userId !='' ">
  1577. AND usr.user_id=#{userId}
  1578. </if>
  1579. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1580. AND usr.order_goods_id=#{orderGoodsId}
  1581. </if>
  1582. ORDER BY
  1583. usr.create_time DESC
  1584. LIMIT 1
  1585. ) AS study_end_time,
  1586. (
  1587. SELECT
  1588. ubr.performance
  1589. FROM
  1590. user_bank_record ubr
  1591. LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id and cme.chapter_id = ubr.chapter_id
  1592. WHERE 1=1
  1593. AND ubr.current_status = 1
  1594. AND ubr.report_status = 1
  1595. <if test="moduleId != null ">
  1596. AND ubr.module_id=#{moduleId}
  1597. </if>
  1598. <if test="goodsId != null">
  1599. AND ubr.goods_id=#{goodsId}
  1600. </if>
  1601. <if test="moduleId != null ">
  1602. AND cme.module_id=#{moduleId}
  1603. </if>
  1604. <if test="courseId != null">
  1605. AND cme.course_id =#{courseId}
  1606. </if>
  1607. <if test="userId != null and userId !='' ">
  1608. AND ubr.user_id=#{userId}
  1609. </if>
  1610. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1611. AND ubr.order_goods_id=#{orderGoodsId}
  1612. </if>
  1613. AND cme.chapter_id = cmc.chapter_id
  1614. LIMIT 1 ) AS performance
  1615. FROM
  1616. course_menu cm
  1617. LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id and cm.type = 1
  1618. LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
  1619. WHERE
  1620. 1 = 1
  1621. <if test="moduleId != null ">
  1622. AND cmc.module_id=#{moduleId}
  1623. </if>
  1624. <if test="courseId != null">
  1625. AND cm.course_id =#{courseId}
  1626. </if>
  1627. </select>
  1628. <select id="listperiodExam" parameterType="map" resultMap="ClassPeriodSectionVo">
  1629. SELECT
  1630. cme.exam_id as id,
  1631. cme.course_id,
  1632. e.do_type,
  1633. <if test="userId != null and userId !='' ">
  1634. (SELECT u.realname FROM `user` u where 1=1
  1635. and u.user_id = #{userId}
  1636. ) as realname,
  1637. </if>
  1638. <if test="userId != null and userId !='' ">
  1639. #{userId} as user_id,
  1640. </if>
  1641. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1642. null as class_hours,
  1643. 4 as type,
  1644. cme.chapter_id,
  1645. cme.module_id
  1646. FROM
  1647. course_menu_exam cme
  1648. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1649. WHERE 1=1
  1650. AND cme.type=1
  1651. <if test="courseId != null">
  1652. AND cme.course_id=#{courseId}
  1653. </if>
  1654. <if test="chapterId != null">
  1655. AND cme.chapter_id =#{chapterId}
  1656. </if>
  1657. <if test="moduleId != null">
  1658. AND cme.module_id =#{moduleId}
  1659. </if>
  1660. </select>
  1661. <select id="listperiodModuleExam" parameterType="map" resultMap="ClassPeriodChapterVo">
  1662. SELECT
  1663. cme.exam_id as id,
  1664. cme.course_id,
  1665. e.do_type,
  1666. <if test="userId != null and userId !='' ">
  1667. (SELECT u.realname FROM `user` u where 1=1
  1668. and u.user_id = #{userId}
  1669. ) as realname,
  1670. </if>
  1671. <if test="userId != null and userId !='' ">
  1672. #{userId} as user_id,
  1673. </if>
  1674. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1675. null as class_hours,
  1676. 5 as type,
  1677. cme.module_id
  1678. FROM
  1679. course_menu_exam cme
  1680. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1681. WHERE 1=1
  1682. AND cme.type=3
  1683. <if test="courseId != null">
  1684. AND cme.course_id=#{courseId}
  1685. </if>
  1686. <if test="moduleId != null">
  1687. AND cme.module_id =#{moduleId}
  1688. </if>
  1689. </select>
  1690. <select id="listPeriodSection" parameterType="map" resultMap="ClassPeriodSectionVo">
  1691. SELECT
  1692. ccs.sort,
  1693. cs.section_id AS id,
  1694. #{courseId} AS course_id,
  1695. <if test="userId != null and userId !='' ">
  1696. (SELECT u.realname FROM `user` u where 1=1
  1697. and u.user_id = #{userId}
  1698. ) as realname,
  1699. </if>
  1700. <if test="userId != null and userId !='' ">
  1701. #{userId} as user_id,
  1702. </if>
  1703. cs.NAME AS type_name,
  1704. cs.duration_time,
  1705. cs.section_type,
  1706. cs.real_live_start_time,
  1707. cs.real_live_end_time,
  1708. cs.real_duration,
  1709. NULL AS class_hours,
  1710. cs.recording_url,
  1711. 3 AS type
  1712. FROM
  1713. course_chapter_section ccs
  1714. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  1715. WHERE
  1716. 1 = 1
  1717. <if test="chapterId != null">
  1718. AND ccs.chapter_id = #{chapterId}
  1719. </if>
  1720. ORDER BY
  1721. ccs.sort
  1722. </select>
  1723. <select id="listPeriodSectionExam" parameterType="map" resultMap="ClassPeriodSectionVo">
  1724. SELECT
  1725. cme.exam_id as id,
  1726. cme.course_id,
  1727. (SELECT u.realname FROM `user` u where 1=1
  1728. <if test="userId != null and userId !='' ">
  1729. and u.user_id = #{userId}
  1730. </if>
  1731. ) as realname,
  1732. (SELECT u.user_id FROM `user` u where 1=1
  1733. <if test="userId != null and userId !='' ">
  1734. and u.user_id = #{userId}
  1735. </if>
  1736. ) as user_id,
  1737. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1738. null as class_hours,
  1739. 4 as type
  1740. FROM
  1741. course_menu_exam cme
  1742. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1743. WHERE 1=1
  1744. and cme.module_id =0
  1745. and cme.type =1
  1746. <if test="courseId != null">
  1747. AND cme.course_id=#{courseId}
  1748. </if>
  1749. <if test="chapterId != null ">
  1750. AND cme.chapter_id = #{chapterId}
  1751. </if>
  1752. </select>
  1753. <select id="selectStart" parameterType="map" resultType="long">
  1754. SELECT
  1755. rp.create_time
  1756. FROM
  1757. user_study_record_photo rp
  1758. LEFT JOIN user_period_status ups ON rp.period_id = ups.id
  1759. LEFT JOIN user_period up ON up.id = ups.period_id
  1760. WHERE
  1761. 1=1
  1762. <if test="orderGoodsId != null ">
  1763. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1764. </if>
  1765. AND ups.period_status = 1
  1766. AND up.grade_id = #{gradeId}
  1767. AND up.user_id = #{userId}
  1768. ORDER BY
  1769. rp.create_time ASC
  1770. </select>
  1771. <select id="selectStartNew" parameterType="map" resultType="long">
  1772. SELECT
  1773. rp.create_time
  1774. FROM
  1775. user_study_record_photo rp
  1776. LEFT JOIN user_period_status ups ON rp.period_id = ups.id
  1777. LEFT JOIN user_period up ON up.id = ups.period_id
  1778. WHERE
  1779. 1=1
  1780. <if test="orderGoodsId != null ">
  1781. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1782. </if>
  1783. AND ups.period_status = 1
  1784. AND up.grade_id = #{gradeId}
  1785. AND up.user_id = #{userId}
  1786. ORDER BY
  1787. rp.create_time ASC
  1788. </select>
  1789. <select id="selectStartNoPhoto" parameterType="map" resultType="long">
  1790. SELECT
  1791. ups.record_start_time
  1792. FROM
  1793. user_period_status ups
  1794. LEFT JOIN user_period up ON up.id = ups.period_id
  1795. WHERE
  1796. 1=1
  1797. <if test="orderGoodsId != null ">
  1798. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1799. </if>
  1800. AND ups.period_status = 1
  1801. AND up.grade_id = #{gradeId}
  1802. AND up.user_id = #{userId}
  1803. ORDER BY
  1804. ups.record_start_time ASC
  1805. limit 1
  1806. </select>
  1807. <select id="selectStartNoPhotoNew" parameterType="map" resultType="long">
  1808. SELECT
  1809. ups.record_start_time
  1810. FROM
  1811. user_period_status ups
  1812. LEFT JOIN user_period up ON up.id = ups.period_id
  1813. WHERE
  1814. 1=1
  1815. <if test="orderGoodsId != null ">
  1816. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1817. </if>
  1818. AND ups.period_status = 1
  1819. AND up.grade_id = #{gradeId}
  1820. AND up.user_id = #{userId}
  1821. ORDER BY
  1822. ups.record_start_time ASC
  1823. limit 1
  1824. </select>
  1825. <select id="selectEnd" parameterType="map" resultType="long">
  1826. SELECT
  1827. usr.end_time
  1828. FROM
  1829. user_study_record usr
  1830. WHERE
  1831. usr.goods_id = #{goodsId}
  1832. AND usr.grade_id = #{gradeId}
  1833. AND usr.user_id = #{userId} UNION
  1834. SELECT
  1835. ubr.update_time as end_time
  1836. FROM
  1837. user_bank_record ubr
  1838. WHERE
  1839. ubr.goods_id =#{goodsId}
  1840. AND ubr.grade_id = #{gradeId}
  1841. AND ubr.user_id = #{userId}
  1842. ORDER BY end_time DESC
  1843. </select>
  1844. <select id="sendClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1845. SELECT
  1846. cgu.user_id,
  1847. cgu.order_goods_id,
  1848. cg.class_start_time,
  1849. cg.class_end_time,
  1850. og.goods_id,
  1851. cg.grade_id
  1852. FROM
  1853. class_grade_user cgu
  1854. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1855. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1856. LEFT JOIN goods g on og.goods_id = g.goods_id
  1857. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1858. where 1=1
  1859. and irb.remind_id =5
  1860. and cgu.status = 1
  1861. AND unix_timestamp(now()) BETWEEN cg.class_end_time-1728000 and cg.class_end_time-1641600
  1862. </select>
  1863. <select id="checkSendClassGradeUser" parameterType="map" resultType="long">
  1864. SELECT COUNT(1) FROM inform_user iu where 1=1 and iu.remind_id = #{remindId} and #{userId} = iu.user_id and #{gradeId} = iu.grade_id and iu.system_status=3
  1865. </select>
  1866. <select id="sendTenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1867. SELECT
  1868. cgu.user_id,
  1869. cgu.order_goods_id,
  1870. cg.class_start_time,
  1871. cg.class_end_time,
  1872. og.goods_id,
  1873. cg.grade_id
  1874. FROM
  1875. class_grade_user cgu
  1876. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1877. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1878. LEFT JOIN goods g on og.goods_id = g.goods_id
  1879. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1880. where 1=1
  1881. and irb.remind_id =6
  1882. and cgu.status = 1
  1883. AND unix_timestamp(now()) BETWEEN cg.class_end_time-864000 and cg.class_end_time-777600
  1884. </select>
  1885. <select id="sendTenAndFifteenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1886. SELECT
  1887. cgu.user_id,
  1888. cgu.order_goods_id,
  1889. cg.class_start_time,
  1890. cg.class_end_time,
  1891. og.goods_id,
  1892. cg.grade_id
  1893. FROM
  1894. class_grade_user cgu
  1895. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1896. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1897. where 1=1
  1898. and cgu.status = 1
  1899. AND (unix_timestamp(now()) BETWEEN cg.class_end_time-950400 and cg.class_end_time-864000 or
  1900. unix_timestamp(now()) BETWEEN cg.class_end_time-1382400 and cg.class_end_time-1296000)
  1901. </select>
  1902. <select id="checkTenClassGradeUser" parameterType="map" resultMap="ClassGradeUserGoodsVoResult">
  1903. SELECT
  1904. cgu.user_id,
  1905. cgu.order_goods_id,
  1906. cg.class_end_time,
  1907. og.goods_id,
  1908. g.goods_name,
  1909. cg.class_name as grade_name
  1910. FROM
  1911. class_grade_user cgu
  1912. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1913. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1914. LEFT JOIN goods g ON g.goods_id = og.goods_id
  1915. where 1=1
  1916. and cg.status = 1
  1917. and cgu.status = 1
  1918. and cgu.user_id = #{userId}
  1919. and (cgu.period_status = -1 or cgu.period_status = 0)
  1920. AND unix_timestamp(now()) BETWEEN cg.class_end_time-#{startTime} and cg.class_end_time-#{endTime}
  1921. </select>
  1922. <select id="sendFiveClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1923. SELECT
  1924. cgu.user_id,
  1925. cgu.order_goods_id,
  1926. cg.class_start_time,
  1927. cg.class_end_time,
  1928. og.goods_id,
  1929. cg.grade_id
  1930. FROM
  1931. class_grade_user cgu
  1932. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1933. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1934. LEFT JOIN goods g on og.goods_id = g.goods_id
  1935. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1936. where 1=1
  1937. and irb.remind_id =7
  1938. and cgu.status = 1
  1939. AND unix_timestamp(now()) BETWEEN cg.class_end_time-432000 and cg.class_end_time-345600
  1940. </select>
  1941. <select id="selectUserCount" parameterType="com.zhongzheng.modules.user.domain.User" resultType="long">
  1942. SELECT
  1943. COUNT( 1 )
  1944. FROM
  1945. `user`
  1946. WHERE
  1947. id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler} and user_id != #{userId} and `status` = 1
  1948. </select>
  1949. <select id="selectUserCertificate" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1950. resultMap="ClassGradeUserVoResult">
  1951. </select>
  1952. <select id="findChapterList" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="CourseChapterResultVo">
  1953. SELECT ui.* from (SELECT
  1954. cc.chapter_id,
  1955. cc.`name`,
  1956. m.sort,
  1957. cm.common_sign,
  1958. (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
  1959. FROM
  1960. course_module_chapter p
  1961. LEFT JOIN course_chapter cc ON p.chapter_id = cc.chapter_id
  1962. LEFT JOIN course_menu m ON m.menu_id = p.module_id
  1963. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  1964. LEFT JOIN course_module cm ON p.module_id = cm.module_id
  1965. WHERE
  1966. gc.goods_id = #{goodsId}
  1967. <if test="moduleId != null and moreCertificateStatus == 2 ">
  1968. AND p.module_id = #{moduleId}
  1969. </if>
  1970. AND m.type = 1 UNION ALL
  1971. SELECT
  1972. cc.chapter_id,
  1973. cc.`name`,
  1974. m.sort,
  1975. 0 as common_sign,
  1976. (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
  1977. FROM
  1978. course_menu m
  1979. LEFT JOIN course_chapter cc ON m.menu_id = cc.chapter_id
  1980. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  1981. WHERE
  1982. gc.goods_id = #{goodsId}
  1983. <if test="moduleId != null and moreCertificateStatus == 2 ">
  1984. AND 1 = 0
  1985. </if>
  1986. AND m.type = 2)ui
  1987. ORDER BY ui.sort
  1988. </select>
  1989. <select id="selectOfficialInfoCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1990. SELECT
  1991. count(*)
  1992. FROM
  1993. class_grade_user cgu
  1994. WHERE
  1995. cgu.grade_id = #{gradeId}
  1996. AND cgu.official_status = 1
  1997. </select>
  1998. <select id="selectLearnStatusCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1999. SELECT
  2000. count(*)
  2001. FROM
  2002. class_grade_user cgu
  2003. WHERE
  2004. cgu.grade_id = #{gradeId}
  2005. AND cgu.learn_status = 1
  2006. </select>
  2007. <select id="selectOfficialPeriodCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  2008. SELECT
  2009. count(*)
  2010. FROM
  2011. class_grade_user cgu
  2012. WHERE
  2013. cgu.grade_id = #{gradeId}
  2014. AND cgu.period_plush = 1
  2015. </select>
  2016. <select id="selectOfficialNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  2017. SELECT
  2018. gu.*
  2019. FROM
  2020. class_grade g
  2021. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  2022. WHERE
  2023. g.interface_push_id > 0
  2024. AND g.official_name IS NOT NULL
  2025. AND g.`status` = 1
  2026. AND gu.`status` = 1
  2027. AND gu.change_grade = 0
  2028. AND IFNULL(gu.official_status,0) != 1
  2029. </select>
  2030. <select id="selectPeriodNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  2031. SELECT
  2032. gu.*
  2033. FROM
  2034. class_grade g
  2035. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  2036. WHERE
  2037. g.interface_period_id > 0
  2038. AND g.`status` = 1
  2039. AND gu.`status` = 1
  2040. AND gu.change_grade = 0
  2041. AND IFNULL( gu.period_plush, 0 ) != 1
  2042. AND gu.period_status = 1
  2043. AND gu.official_status = 1
  2044. </select>
  2045. <select id="selectGoodsGradeList" parameterType="Long" resultMap="ClassGradeUserGoodsVoResult">
  2046. SELECT
  2047. cgg.goods_id,
  2048. cgg.grade_id,
  2049. cgu.user_id,
  2050. cgu.order_goods_id
  2051. FROM
  2052. class_grade_goods cgg
  2053. LEFT JOIN class_grade_user cgu ON cgg.grade_id = cgu.grade_id
  2054. WHERE
  2055. cgg.goods_id = #{goodsId}
  2056. AND cgu.user_id IS NOT NULL
  2057. </select>
  2058. <select id="queryCountList" parameterType="java.lang.Integer" resultMap="ClassGradeUserVoResult">
  2059. SELECT
  2060. cgu.*,
  2061. cg.interface_account_id,
  2062. cg.no_interface_account_id
  2063. FROM
  2064. class_grade_user cgu
  2065. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  2066. LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
  2067. LEFT JOIN goods g on og.goods_id = g.goods_id
  2068. WHERE
  2069. cgu.`status` = 1
  2070. and g.project_id = #{projectId}
  2071. and g.business_id = #{businessId}
  2072. <if test="all != null and all == 0">
  2073. and (cg.interface_account_id is not null or cg.no_interface_account_id is not null)
  2074. </if>
  2075. </select>
  2076. <select id="checkFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2077. SELECT
  2078. IFNULL(count(*),0)
  2079. FROM
  2080. class_grade_user cgu
  2081. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2082. LEFT JOIN goods g on og.goods_id = g.goods_id
  2083. LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
  2084. WHERE
  2085. cgu.user_id = #{userId}
  2086. AND cgu.period_status = -1
  2087. AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
  2088. and g.business_id = #{businessId}
  2089. and g.goods_id != #{goodsId}
  2090. AND (
  2091. SELECT
  2092. IFNULL( count(*), 0 )
  2093. FROM
  2094. user_period up
  2095. WHERE
  2096. 1 = 1
  2097. AND up.user_id = cgu.user_id
  2098. AND up.grade_id = cgu.grade_id
  2099. )>0
  2100. </select>
  2101. <select id="getFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2102. SELECT
  2103. g.goods_id
  2104. FROM
  2105. class_grade_user cgu
  2106. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2107. LEFT JOIN goods g on og.goods_id = g.goods_id
  2108. LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
  2109. WHERE
  2110. cgu.user_id = #{userId}
  2111. AND cgu.period_status = -1
  2112. AND cgu.period_wait_time is null
  2113. AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
  2114. and g.business_id = #{businessId}
  2115. and g.goods_id != #{goodsId}
  2116. and cgu.`status` = 1
  2117. AND (
  2118. SELECT
  2119. IFNULL( count(*), 0 )
  2120. FROM
  2121. user_period up
  2122. WHERE
  2123. 1 = 1
  2124. AND up.order_goods_id = cgu.order_goods_id
  2125. )>0
  2126. </select>
  2127. <select id="getOrderGoods" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.order.domain.OrderGoods">
  2128. SELECT
  2129. og.*
  2130. FROM
  2131. order_goods og
  2132. LEFT JOIN `order` o ON og.order_sn = o.order_sn
  2133. WHERE
  2134. o.user_id = #{userId}
  2135. AND og.goods_id = #{goodsId}
  2136. AND og.refund_status != 2
  2137. AND og.pay_status != 1
  2138. AND og.`status` = 1
  2139. AND o.`status` = 1
  2140. </select>
  2141. <select id="getSevenPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2142. SELECT
  2143. p.create_time
  2144. FROM
  2145. user_study_record usr
  2146. LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
  2147. LEFT JOIN course_module cm ON usr.module_id = cm.module_id
  2148. WHERE
  2149. usr.current_status = 1
  2150. AND usr.user_id = #{userId}
  2151. AND usr.grade_id = #{gradeId}
  2152. AND cm.common_sign = 0
  2153. <if test="orderGoodsId != null and orderGoodsId !='' ">
  2154. AND usr.order_goods_id = #{orderGoodsId}
  2155. </if>
  2156. AND P.create_time IS NOT NULL
  2157. ORDER BY
  2158. P.create_time
  2159. LIMIT 1
  2160. </select>
  2161. <select id="getPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2162. SELECT
  2163. p.create_time
  2164. FROM
  2165. user_study_record usr
  2166. LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
  2167. WHERE
  2168. usr.current_status = 1
  2169. AND usr.user_id = #{userId}
  2170. AND usr.grade_id = #{gradeId}
  2171. <if test="orderGoodsId != null and orderGoodsId !='' ">
  2172. AND usr.order_goods_id = #{orderGoodsId}
  2173. </if>
  2174. AND P.create_time IS NOT NULL
  2175. ORDER BY
  2176. P.create_time
  2177. LIMIT 1
  2178. </select>
  2179. <select id="getPeriodEndTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2180. SELECT
  2181. ups.record_end_time
  2182. FROM
  2183. user_period_status ups
  2184. LEFT JOIN user_period up ON up.id = ups.period_id
  2185. WHERE
  2186. 1 = 1
  2187. AND up.user_id = #{userId}
  2188. AND up.grade_id = #{gradeId}
  2189. <if test="orderGoodsId != null and orderGoodsId !='' ">
  2190. AND up.order_goods_id = #{orderGoodsId}
  2191. </if>
  2192. AND ups.period_status = 1
  2193. ORDER BY
  2194. ups.record_end_time DESC
  2195. LIMIT 1
  2196. </select>
  2197. <select id="getClassInfoByUser" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
  2198. SELECT
  2199. cgu.*
  2200. FROM
  2201. class_grade_user cgu
  2202. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2203. LEFT JOIN goods g ON og.goods_id = g.goods_id
  2204. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2205. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2206. LEFT JOIN course_business cb ON g.business_id = cb.id
  2207. WHERE
  2208. cgu.`status` = 1
  2209. AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "继续教育" ) > 0
  2210. AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "施工现场专业人员" ) > 0
  2211. AND og.`status` = 1
  2212. AND og.refund_status != 2
  2213. AND og.pay_status IN ( 2, 3, 4 )
  2214. AND cgu.period_status != 1
  2215. AND cgu.finish_status = 0
  2216. AND (
  2217. SELECT
  2218. COUNT( usr.record_id )
  2219. FROM
  2220. user_study_record usr
  2221. WHERE
  2222. usr.order_goods_id = cgu.order_goods_id
  2223. AND usr.user_id = cgu.user_id
  2224. AND usr.current_status = 1
  2225. ) > 0
  2226. AND cgu.user_id = #{userId}
  2227. </select>
  2228. <select id="listVideoUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  2229. resultMap="ClassPeriodStudentVo">
  2230. SELECT
  2231. u.user_account,
  2232. u.user_id,
  2233. cgu.`status`,
  2234. u.realname,
  2235. og.goods_id,
  2236. u.id_card,
  2237. cgu.grade_id,
  2238. u.telphone,
  2239. u.one_inch_photos,
  2240. g.class_hours as class_hours,
  2241. g.study_start_time as study_start_time,
  2242. g.study_end_time as study_end_time,
  2243. g.goods_name,
  2244. g.code as goods_code,
  2245. g.stand_price,
  2246. g.goods_id,
  2247. cgu.period_status,
  2248. cg.class_start_time,
  2249. cg.class_end_time,
  2250. cg.class_name,
  2251. cgu.period_plush,
  2252. cgu.period_status_num,
  2253. cgu.period_time,
  2254. cgu.order_goods_id,
  2255. IFNULL(ge.exam_num,0) as exam_num,
  2256. cgu.period_wait_time as end_time,
  2257. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  2258. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  2259. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  2260. (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.`type` in (1,3) and ubr.report_status=1 and ubr.order_goods_id = cgu.order_goods_id and ubr.grade_id = cgu.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
  2261. cet.education_name,
  2262. cpt.project_name,
  2263. m.category_name,
  2264. cb.business_name
  2265. FROM
  2266. class_grade_user cgu
  2267. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  2268. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2269. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  2270. LEFT JOIN goods g on og.goods_id = g.goods_id
  2271. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2272. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2273. LEFT JOIN course_business cb ON g.business_id = cb.id
  2274. LEFT JOIN major m ON g.major_id = m.id
  2275. LEFT JOIN (SELECT
  2276. COUNT( m.id ) AS exam_num,
  2277. c.goods_id
  2278. FROM
  2279. course_menu_exam m
  2280. LEFT JOIN goods_course c ON m.course_id = c.course_id
  2281. where
  2282. m.type in (1,3)
  2283. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  2284. where 1=1
  2285. and cgu.`status` =1
  2286. <if test="periodPlush != null and periodPlush != ''">
  2287. AND cgu.period_plush = #{periodPlush}
  2288. </if>
  2289. <if test="officialStatus != null and officialStatus != ''">
  2290. AND cgu.official_status = #{officialStatus}
  2291. </if>
  2292. <if test="changeGrade != null and changeGrade != ''">
  2293. AND cgu.change_grade = #{changeGrade}
  2294. </if>
  2295. <if test="profileStatus != null and profileStatus != ''">
  2296. AND up.status = #{profileStatus}
  2297. </if>
  2298. <if test="gradeId != null and gradeId !='' ">
  2299. and cgu.grade_id = #{gradeId}
  2300. </if>
  2301. <if test="businessId != null and businessId != ''">
  2302. AND g.business_id = #{businessId}
  2303. </if>
  2304. <if test="projectId != null and projectId != ''">
  2305. AND g.project_id = #{projectId}
  2306. </if>
  2307. <if test="educationTypeId != null and educationTypeId != ''">
  2308. AND g.education_type_id = #{educationTypeId}
  2309. </if>
  2310. <if test="schoolId != null and schoolId != ''">
  2311. AND g.school_id = #{schoolId}
  2312. </if>
  2313. <if test="majorId != null and majorId != ''">
  2314. AND g.major_id = #{majorId}
  2315. </if>
  2316. <if test="periodStatus != null ">
  2317. and cgu.period_status = #{periodStatus}
  2318. </if>
  2319. <if test="classStartTime != null and classStartTime != '' ">
  2320. AND cg.class_start_time >= #{classStartTime}
  2321. </if>
  2322. <if test="classEndTime != null and classEndTime != '' ">
  2323. AND #{classEndTime} >= cg.class_end_time
  2324. </if>
  2325. <if test="studyStatus != null and studyStatus == 1 ">
  2326. and cgu.period_status = -1
  2327. </if>
  2328. <if test="studyStatus != null and studyStatus == 2 ">
  2329. and cgu.period_status != -1
  2330. </if>
  2331. <if test="className != null and className !='' ">
  2332. and cg.class_name like concat('%', #{className}, '%')
  2333. </if>
  2334. <if test="searchKey != null and searchKey != '' ">
  2335. and (u.realname like concat('%', #{searchKey}, '%')
  2336. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  2337. or g.goods_name like concat('%', #{searchKey}, '%')
  2338. or cg.class_name like concat('%', #{searchKey}, '%'))
  2339. </if>
  2340. <if test="userId != null and userId !='' ">
  2341. AND cgu.user_id = #{userId}
  2342. </if>
  2343. <if test="idCard != null and idCard !='' ">
  2344. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  2345. </if>
  2346. <if test="telphone != null and telphone !='' ">
  2347. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  2348. </if>
  2349. <if test="searchStartTime != null and searchStartTime != '' ">
  2350. and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND r.create_time >= #{searchStartTime} )>0
  2351. </if>
  2352. <if test="searchEndTime != null and searchEndTime != '' ">
  2353. and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND #{searchEndTime} >= r.create_time )>0
  2354. </if>
  2355. <if test="periodStartTime != null and periodStartTime !='' ">
  2356. AND cgu.period_time >=#{periodStartTime}
  2357. </if>
  2358. <if test="periodEndTime != null and periodEndTime !='' ">
  2359. AND #{periodEndTime} >= cgu.period_time
  2360. </if>
  2361. order by cgu.create_time desc
  2362. </select>
  2363. <select id="listBKUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  2364. resultMap="ClassPeriodStudentVo">
  2365. SELECT
  2366. g.goods_name,
  2367. cgu.create_time,
  2368. g.year as goods_year,
  2369. cet.education_name,
  2370. cpt.project_name,
  2371. m.category_name,
  2372. cb.business_name,
  2373. up.`status` as profile_status
  2374. FROM
  2375. class_grade_user cgu
  2376. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  2377. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2378. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  2379. LEFT JOIN goods g on og.goods_id = g.goods_id
  2380. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2381. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2382. LEFT JOIN course_business cb ON g.business_id = cb.id
  2383. LEFT JOIN major m ON g.major_id = m.id
  2384. LEFT JOIN user_profile up on cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  2385. where 1=1
  2386. and cgu.`status` =1
  2387. <if test="profileStatus != null and profileStatus != ''">
  2388. AND up.`status` = #{profileStatus}
  2389. </if>
  2390. <if test="periodPlush != null and periodPlush != ''">
  2391. AND cgu.period_plush = #{periodPlush}
  2392. </if>
  2393. <if test="officialStatus != null and officialStatus != ''">
  2394. AND cgu.official_status = #{officialStatus}
  2395. </if>
  2396. <if test="changeGrade != null and changeGrade != ''">
  2397. AND cgu.change_grade = #{changeGrade}
  2398. </if>
  2399. <if test="profileStatus != null and profileStatus != ''">
  2400. AND up.status = #{profileStatus}
  2401. </if>
  2402. <if test="gradeId != null and gradeId !='' ">
  2403. and cgu.grade_id = #{gradeId}
  2404. </if>
  2405. <if test="businessId != null and businessId != ''">
  2406. AND g.business_id = #{businessId}
  2407. </if>
  2408. <if test="projectId != null and projectId != ''">
  2409. AND g.project_id = #{projectId}
  2410. </if>
  2411. <if test="educationTypeId != null and educationTypeId != ''">
  2412. AND g.education_type_id = #{educationTypeId}
  2413. </if>
  2414. <if test="schoolId != null and schoolId != ''">
  2415. AND g.school_id = #{schoolId}
  2416. </if>
  2417. <if test="majorId != null and majorId != ''">
  2418. AND g.major_id = #{majorId}
  2419. </if>
  2420. <if test="periodStatus != null ">
  2421. and cgu.period_status = #{periodStatus}
  2422. </if>
  2423. <if test="classStartTime != null and classStartTime != '' ">
  2424. AND cg.class_start_time >= #{classStartTime}
  2425. </if>
  2426. <if test="classEndTime != null and classEndTime != '' ">
  2427. AND #{classEndTime} >= cg.class_end_time
  2428. </if>
  2429. <if test="studyStatus != null and studyStatus == 1 ">
  2430. and cgu.period_status = -1
  2431. </if>
  2432. <if test="studyStatus != null and studyStatus == 2 ">
  2433. and cgu.period_status != -1
  2434. </if>
  2435. <if test="className != null and className !='' ">
  2436. and cg.class_name like concat('%', #{className}, '%')
  2437. </if>
  2438. <if test="searchKey != null and searchKey != '' ">
  2439. and (u.realname like concat('%', #{searchKey}, '%')
  2440. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  2441. or g.goods_name like concat('%', #{searchKey}, '%')
  2442. or cg.class_name like concat('%', #{searchKey}, '%'))
  2443. </if>
  2444. <if test="userId != null and userId !='' ">
  2445. AND u.user_id = #{userId}
  2446. </if>
  2447. <if test="idCard != null and idCard !='' ">
  2448. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  2449. </if>
  2450. <if test="telphone != null and telphone !='' ">
  2451. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  2452. </if>
  2453. <if test="searchStartTime != null and searchStartTime !='' ">
  2454. AND cgu.create_time >= #{searchStartTime}
  2455. </if>
  2456. <if test="searchEndTime != null and searchEndTime !='' ">
  2457. AND #{searchEndTime} >= cgu.create_time
  2458. </if>
  2459. <if test="periodStartTime != null and periodStartTime !='' ">
  2460. AND cgu.period_time >= #{periodStartTime}
  2461. </if>
  2462. <if test="periodEndTime != null and periodEndTime !='' ">
  2463. AND #{periodEndTime} >= cgu.period_time
  2464. </if>
  2465. order by cgu.create_time desc
  2466. </select>
  2467. <select id="getListUserSubscribe" resultType="com.zhongzheng.modules.user.vo.UserUsbRecordVo" parameterType="com.zhongzheng.modules.user.bo.UserUsbRecordBo">
  2468. SELECT
  2469. us.subscribe_id,
  2470. us.create_time,
  2471. g.goods_name,
  2472. CONCAT(cet.education_name,'-',cb.business_name,cpt.project_name) AS businessName,
  2473. m.category_name AS majorName,
  2474. us.subscribe_status,
  2475. us.apply_site_exam_time AS applyTime,
  2476. us.apply_site_start_time AS applyStarTime,
  2477. us.apply_site_end_time AS applyEndTime,
  2478. us.apply_site_address AS applyAddress,
  2479. '自带文具、身份证' AS remark
  2480. FROM user_subscribe us
  2481. LEFT JOIN order_goods og ON us.order_goods_id = og.order_goods_id
  2482. LEFT JOIN goods g ON og.goods_id = g.goods_id
  2483. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2484. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2485. LEFT JOIN course_business cb ON g.business_id = cb.id
  2486. LEFT JOIN major m ON g.major_id = m.id
  2487. WHERE 1=1 AND us.exam_status = 0
  2488. <if test="userId != null and userId !='' ">
  2489. AND us.user_id = #{userId}
  2490. </if>
  2491. <if test="subStartTime != null and subStartTime !='' ">
  2492. AND us.create_time &gt;= #{subStartTime}
  2493. </if>
  2494. <if test="subEndTime != null and subStartTime !='' ">
  2495. AND us.create_time &lt;= #{subEndTime}
  2496. </if>
  2497. <if test="educationTypeId != null and educationTypeId !='' ">
  2498. AND cet.id = #{educationTypeId}
  2499. </if>
  2500. <if test="businessId != null and businessId !='' ">
  2501. AND cb.id = #{businessId}
  2502. </if>
  2503. <if test="majorId != null and majorId !='' ">
  2504. AND m.id = #{majorId}
  2505. </if>
  2506. <if test="goodsName != null and goodsName !='' ">
  2507. AND g.goods_name like concat('%', #{goodsName}, '%')
  2508. </if>
  2509. <if test="subscribeStatus != null and subscribeStatus == 1">
  2510. AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) &gt; UNIX_TIMESTAMP()
  2511. </if>
  2512. <if test="subscribeStatus != null and subscribeStatus == 2">
  2513. AND us.subscribe_status = #{subscribeStatus}
  2514. </if>
  2515. <if test="subscribeStatus != null and subscribeStatus == 3">
  2516. AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) &lt; UNIX_TIMESTAMP()
  2517. </if>
  2518. <if test="applySiteExamTime != null and applySiteExamTime != '' ">
  2519. and us.apply_site_exam_time = #{applySiteExamTime}
  2520. </if>
  2521. <if test="monthStartTime != null and monthStartTime != '' ">
  2522. and us.apply_site_exam_time &gt;= #{monthStartTime}
  2523. </if>
  2524. <if test="monthEndTime != null and monthEndTime != '' ">
  2525. and us.apply_site_exam_time &lt;= #{monthEndTime}
  2526. </if>
  2527. <if test="applySiteStartTime != null and applySiteStartTime != '' ">
  2528. and us.apply_site_start_time = #{applySiteStartTime}
  2529. </if>
  2530. <if test="applySiteEndTime != null and applySiteEndTime != '' ">
  2531. and us.apply_site_end_time = #{applySiteEndTime}
  2532. </if>
  2533. order by us.create_time DESC
  2534. </select>
  2535. <update id="updateGradeUser" parameterType="com.zhongzheng.modules.grade.domain.ClassGradeUser" >
  2536. update class_grade_user
  2537. <set>
  2538. <if test="sevenPushCheck != null">
  2539. seven_push_check = #{sevenPushCheck},
  2540. </if>
  2541. <if test="sevenPushReason != null ">
  2542. seven_push_reason=#{sevenPushReason},
  2543. </if>
  2544. <if test="updateTime != null ">
  2545. update_time=#{updateTime},
  2546. </if>
  2547. </set>
  2548. where id = #{id}
  2549. </update>
  2550. <select id="selectUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  2551. resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
  2552. SELECT
  2553. g.*
  2554. FROM
  2555. class_grade_user g
  2556. WHERE
  2557. 1 = 1
  2558. <if test="id != null ">
  2559. AND g.id = #{id}
  2560. </if>
  2561. <if test="sevenPushReason != null ">
  2562. AND g.seven_push_reason = #{sevenPushReason}
  2563. </if>
  2564. </select>
  2565. <update id="updateListUserNoTenant" parameterType="map" >
  2566. UPDATE class_grade_user SET seven_push_check = 0 WHERE seven_push_check > 2 and
  2567. seven_push_reason = #{sevenPushReason}
  2568. </update>
  2569. </mapper>