ClassGradeUserMapper.xml 116 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720
  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 and ascSort == 0">
  646. order by cgu.update_time desc
  647. </if>
  648. <if test="periodStatus == 2 and ascSort == 0">
  649. order by cgu.period_wait_time,cgu.create_time
  650. </if>
  651. <if test="periodStatus == 3 and ascSort == 0">
  652. order by cgu.period_ing_time,cgu.create_time
  653. </if>
  654. <if test="ascSort == 1 ">
  655. order by cgu.update_time desc
  656. </if>
  657. </select>
  658. <select id="listUserPeriodNew_COUNT" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  659. resultType="java.lang.Long">
  660. SELECT
  661. count(cgu.id)
  662. FROM
  663. class_grade_user cgu
  664. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  665. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  666. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  667. 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
  668. LEFT JOIN goods g on og.goods_id = g.goods_id
  669. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  670. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  671. LEFT JOIN course_business cb ON g.business_id = cb.id
  672. where 1=1
  673. and cgu.`status` =1
  674. and cb.`period_check_sign` = 1
  675. <if test="projectIds != null and projectIds.size()!=0 ">
  676. AND g.project_id in
  677. <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
  678. #{item}
  679. </foreach>
  680. </if>
  681. <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
  682. AND g.education_type_id in
  683. <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
  684. #{item}
  685. </foreach>
  686. </if>
  687. <if test="periodStatus != null ">
  688. and cgu.period_status = #{periodStatus}
  689. </if>
  690. <if test="searchKey != null and searchKey != '' ">
  691. and u.realname like concat('%', #{searchKey}, '%')
  692. </if>
  693. <if test="idCard != null and idCard !='' ">
  694. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  695. </if>
  696. <if test="tenantIds != null and tenantIds.size()!=0 ">
  697. AND cgu.tenant_id in
  698. <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
  699. #{item}
  700. </foreach>
  701. </if>
  702. order by cgu.update_time desc
  703. </select>
  704. <select id="listUserPeriodNew" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  705. resultType="com.zhongzheng.modules.grade.vo.ClassPeriodStudentNewVo">
  706. SELECT
  707. u.user_id,
  708. u.realname,
  709. og.goods_id,
  710. u.id_card,
  711. cgu.grade_id,
  712. u.telphone,
  713. up.`status` as profile_status,
  714. g.goods_name,
  715. cg.class_name,
  716. cgu.order_goods_id,
  717. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  718. cgu.period_wait_time as end_time,
  719. cgu.tenant_id,
  720. CONCAT(cet.education_name,cpt.project_name,cb.business_name) AS fullName
  721. FROM
  722. class_grade_user cgu
  723. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  724. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  725. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  726. 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
  727. LEFT JOIN goods g on og.goods_id = g.goods_id
  728. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  729. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  730. LEFT JOIN course_business cb ON g.business_id = cb.id
  731. where 1=1
  732. and cgu.`status` =1
  733. and cb.`period_check_sign` = 1
  734. <if test="projectIds != null and projectIds.size()!=0 ">
  735. AND g.project_id in
  736. <foreach collection="projectIds" item="item" index="index" open="(" close=")" separator=",">
  737. #{item}
  738. </foreach>
  739. </if>
  740. <if test="educationTypeIds != null and educationTypeIds.size()!=0 ">
  741. AND g.education_type_id in
  742. <foreach collection="educationTypeIds" item="item" index="index" open="(" close=")" separator=",">
  743. #{item}
  744. </foreach>
  745. </if>
  746. <if test="periodStatus != null ">
  747. and cgu.period_status = #{periodStatus}
  748. </if>
  749. <if test="searchKey != null and searchKey != '' ">
  750. and u.realname like concat('%', #{searchKey}, '%')
  751. </if>
  752. <if test="idCard != null and idCard !='' ">
  753. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  754. </if>
  755. <if test="tenantIds != null and tenantIds.size()!=0 ">
  756. AND cgu.tenant_id in
  757. <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
  758. #{item}
  759. </foreach>
  760. </if>
  761. order by cgu.update_time desc
  762. </select>
  763. <select id="getEduIdByTenant" parameterType="map" resultType="java.lang.Long">
  764. SELECT id FROM course_education_type WHERE tenant_id = #{tenantId} AND education_name = #{eduName} AND `status` = 1 LIMIT 1
  765. </select>
  766. <select id="getProIdByTenant" parameterType="map" resultType="java.lang.Long">
  767. SELECT id FROM course_project_type WHERE tenant_id = #{tenantId} AND project_name = #{proName} AND education_id = #{eduId} AND `status` = 1 LIMIT 1
  768. </select>
  769. <select id="exportUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  770. resultMap="ClassPeriodStudentVo">
  771. SELECT
  772. u.user_account,
  773. u.user_id,
  774. cgu.`status`,
  775. u.realname,
  776. og.goods_id,
  777. u.id_card,
  778. cgu.grade_id,
  779. u.telphone,
  780. u.one_inch_photos,
  781. u.company_name,
  782. up.`status` as profile_status,
  783. g.class_hours as class_hours,
  784. g.study_start_time as study_start_time,
  785. g.study_end_time as study_end_time,
  786. g.goods_name,
  787. g.code as goods_code,
  788. g.stand_price,
  789. cgu.period_status,
  790. cg.class_start_time,
  791. cg.class_end_time,
  792. cg.class_name,
  793. cgu.period_plush,
  794. cgu.period_status_num,
  795. cgu.period_time,
  796. cgu.order_goods_id,
  797. og.order_sn,
  798. g.major_id,
  799. IFNULL(ge.exam_num,0) as exam_num,
  800. <if test="userPhoto != null and userPhoto == 1">
  801. up.key_value,
  802. </if>
  803. cgu.period_wait_time as end_time,
  804. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  805. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  806. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  807. (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
  808. <if test="userPhoto == null">
  809. /* ,(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
  810. 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 */
  811. </if>
  812. FROM
  813. class_grade_user cgu
  814. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  815. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  816. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  817. 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
  818. LEFT JOIN goods g on og.goods_id = g.goods_id
  819. LEFT JOIN course_business cb ON g.business_id = cb.id
  820. LEFT JOIN (SELECT
  821. COUNT( m.id ) AS exam_num,
  822. c.goods_id
  823. FROM
  824. course_menu_exam m
  825. LEFT JOIN goods_course c ON m.course_id = c.course_id
  826. where
  827. m.type in (1,3)
  828. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  829. where 1=1
  830. and cgu.`status` =1
  831. and cb.`period_check_sign` = 1
  832. <if test="periodPlush != null and periodPlush != ''">
  833. AND cgu.period_plush = #{periodPlush}
  834. </if>
  835. <if test="officialStatus != null and officialStatus != ''">
  836. AND cgu.official_status = #{officialStatus}
  837. </if>
  838. <if test="changeGrade != null and changeGrade != ''">
  839. AND cgu.change_grade = #{changeGrade}
  840. </if>
  841. <if test="profileStatus != null and profileStatus != ''">
  842. AND up.status = #{profileStatus}
  843. </if>
  844. <if test="gradeId != null and gradeId !='' ">
  845. and cgu.grade_id = #{gradeId}
  846. </if>
  847. <if test="businessId != null and businessId != ''">
  848. AND g.business_id = #{businessId}
  849. </if>
  850. <if test="projectId != null and projectId != ''">
  851. AND g.project_id = #{projectId}
  852. </if>
  853. <if test="educationTypeId != null and educationTypeId != ''">
  854. AND g.education_type_id = #{educationTypeId}
  855. </if>
  856. <if test="schoolId != null and schoolId != ''">
  857. AND g.school_id = #{schoolId}
  858. </if>
  859. <if test="majorId != null and majorId != ''">
  860. AND g.major_id = #{majorId}
  861. </if>
  862. <if test="periodStatus != null ">
  863. and cgu.period_status = #{periodStatus}
  864. </if>
  865. <if test="classStartTime != null and classStartTime != '' ">
  866. AND cg.class_start_time >= #{classStartTime}
  867. </if>
  868. <if test="classEndTime != null and classEndTime != '' ">
  869. AND #{classEndTime} >= cg.class_end_time
  870. </if>
  871. <if test="studyStatus != null and studyStatus == 1 ">
  872. and cgu.period_status = -1
  873. </if>
  874. <if test="studyStatus != null and studyStatus == 2 ">
  875. and cgu.period_status != -1
  876. </if>
  877. <if test="className != null and className !='' ">
  878. and cg.class_name like concat('%', #{className}, '%')
  879. </if>
  880. <if test="searchKey != null and searchKey != '' ">
  881. and (u.realname like concat('%', #{searchKey}, '%')
  882. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  883. or g.goods_name like concat('%', #{searchKey}, '%')
  884. or cg.class_name like concat('%', #{searchKey}, '%')
  885. or u.company_name like concat('%', #{searchKey}, '%'))
  886. </if>
  887. <if test="inputOrderSn != null and inputOrderSn != '' ">
  888. and (select count(*) from `order` o where o.order_sn =og.order_sn and o.input_order_sn = #{inputOrderSn})>0
  889. </if>
  890. <if test="companyName != null and companyName != '' ">
  891. and u.company_name like concat('%', #{companyName}, '%')
  892. </if>
  893. <if test="idCard != null and idCard !='' ">
  894. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  895. </if>
  896. <if test="telphone != null and telphone !='' ">
  897. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  898. </if>
  899. <if test="searchStartTime != null and searchStartTime !='' ">
  900. AND cgu.create_time >=#{searchStartTime}
  901. </if>
  902. <if test="searchEndTime != null and searchEndTime !='' ">
  903. AND #{searchEndTime} >= cgu.create_time
  904. </if>
  905. <if test="periodStartTime != null and periodStartTime !='' ">
  906. AND cgu.period_time >=#{periodStartTime}
  907. </if>
  908. <if test="periodEndTime != null and periodEndTime !='' ">
  909. AND #{periodEndTime} >= cgu.period_time
  910. </if>
  911. <if test="periodStatus != 2 and periodStatus != 3">
  912. order by cgu.update_time desc
  913. </if>
  914. <if test="periodStatus == 2 ">
  915. order by cgu.period_wait_time,cgu.create_time
  916. </if>
  917. <if test="periodStatus == 3 ">
  918. order by cgu.period_ing_time,cgu.create_time
  919. </if>
  920. </select>
  921. <select id="listUserPeriodTotal" parameterType="java.lang.Integer" resultType="java.lang.Long">
  922. SELECT
  923. COUNT( cgu.id )
  924. FROM
  925. class_grade_user cgu
  926. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  927. LEFT JOIN goods g ON og.goods_id = g.goods_id
  928. LEFT JOIN course_business cb ON g.business_id = cb.id
  929. WHERE
  930. cgu.`status` = 1
  931. AND cb.period_check_sign = 1
  932. AND cgu.period_status = #{periodStatus}
  933. </select>
  934. <select id="exportNoPassRecord" resultType="com.zhongzheng.modules.grade.vo.ClassNoPassExportVo">
  935. SELECT
  936. u.realname AS realName,
  937. AES_DECRYPT( UNHEX( u.id_card ), 'base20230213zzkj' ) AS idCard,
  938. AES_DECRYPT( UNHEX( u.telphone ), 'base20230213zzkj' ) AS telPhone,
  939. u.company_name AS companyName,
  940. m.category_name AS categoryName,
  941. g.goods_name AS goodsName,
  942. (SELECT FROM_UNIXTIME( ups.audit_time, '%Y-%m-%d %H:%i:%s' ) FROM user_period up
  943. LEFT JOIN user_period_status ups ON up.id = ups.period_id WHERE up.order_goods_id = cgu.order_goods_id LIMIT 1 ) AS noPassTime,
  944. '否' AS restart,
  945. '' AS restartTime
  946. FROM
  947. class_grade_user cgu
  948. LEFT JOIN `user` u ON cgu.user_id = u.user_id
  949. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  950. LEFT JOIN goods g ON og.goods_id = g.goods_id
  951. LEFT JOIN major m ON g.major_id = m.id
  952. WHERE
  953. cgu.`status` = 1
  954. AND cgu.period_status = 0
  955. </select>
  956. <select id="exportRestartRecord" resultType="com.zhongzheng.modules.grade.vo.ClassNoPassExportVo">
  957. SELECT
  958. u.realname AS realName,
  959. AES_DECRYPT( UNHEX( u.id_card ), 'base20230213zzkj' ) AS idCard,
  960. AES_DECRYPT( UNHEX( u.telphone ), 'base20230213zzkj' ) AS telPhone,
  961. u.company_name AS companyName,
  962. m.category_name AS categoryName,
  963. g.goods_name AS goodsName,
  964. (SELECT FROM_UNIXTIME( ups.audit_time, '%Y-%m-%d %H:%i:%s' ) FROM user_period up
  965. LEFT JOIN user_period_status ups ON up.id = ups.period_id WHERE up.order_goods_id = cgu.order_goods_id LIMIT 1 ) AS noPassTime,
  966. '是' AS restart,
  967. (SELECT FROM_UNIXTIME( ups.record_start_time , '%Y-%m-%d %H:%i:%s' ) FROM user_period up LEFT JOIN user_period_status ups ON up.id = ups.period_id WHERE up.order_goods_id = cgu.order_goods_id AND ups.`status` = 2
  968. AND ups.record_start_time IS NOT NULL ORDER BY ups.record_start_time LIMIT 1) AS restartTime
  969. FROM
  970. class_grade_user cgu
  971. LEFT JOIN `user` u ON cgu.user_id = u.user_id
  972. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  973. LEFT JOIN goods g ON og.goods_id = g.goods_id
  974. LEFT JOIN major m ON g.major_id = m.id
  975. WHERE
  976. cgu.`status` = 1
  977. AND cgu.period_status = -1
  978. AND (SELECT COUNT(*) FROM user_period up LEFT JOIN user_period_status ups ON up.id = ups.period_id WHERE up.order_goods_id = cgu.order_goods_id AND ups.`status` = 3 ) > 0
  979. </select>
  980. <select id="listUserWeekStudyTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  981. resultType="Long">
  982. SELECT
  983. IFNULL( SUM( cs.duration_time ), 0 )
  984. FROM
  985. (
  986. SELECT
  987. section_id
  988. FROM
  989. user_study_record
  990. WHERE
  991. user_id = #{userId}
  992. AND grade_id = #{gradeId}
  993. AND order_goods_id = #{orderGoodsId}
  994. AND current_status = 1
  995. AND `status` = 1
  996. <if test="searchWeekStartTime != null and searchWeekStartTime != '' ">
  997. AND update_time >= #{searchWeekStartTime}
  998. </if>
  999. <if test="searchWeekEndTime != null and searchWeekEndTime != '' ">
  1000. AND #{searchWeekEndTime} >= update_time
  1001. </if>
  1002. GROUP BY
  1003. course_id,
  1004. module_id,
  1005. chapter_id,
  1006. section_id
  1007. ) usr
  1008. LEFT JOIN course_section cs ON usr.section_id = cs.section_id
  1009. </select>
  1010. <select id="listUserWeekPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1011. resultMap="ClassPeriodStudentVo">
  1012. SELECT
  1013. u.user_account,
  1014. u.user_id,
  1015. cgu.`status`,
  1016. u.realname,
  1017. og.goods_id,
  1018. u.id_card,
  1019. cgu.grade_id,
  1020. u.telphone,
  1021. u.one_inch_photos,
  1022. up.`status` as profile_status,
  1023. g.class_hours as class_hours,
  1024. g.study_start_time as study_start_time,
  1025. g.study_end_time as study_end_time,
  1026. g.goods_name,
  1027. g.code as goods_code,
  1028. g.stand_price,
  1029. cgu.period_status,
  1030. cg.class_start_time,
  1031. cg.class_end_time,
  1032. cg.class_name,
  1033. cgu.period_plush,
  1034. cgu.period_status_num,
  1035. cgu.period_time,
  1036. cgu.order_goods_id,
  1037. <if test="userPhoto != null and userPhoto == 1">
  1038. up.key_value,
  1039. </if>
  1040. cgu.period_wait_time as end_time
  1041. <if test="userPhoto == null">
  1042. ,(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
  1043. 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
  1044. </if>
  1045. FROM
  1046. class_grade_user cgu
  1047. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1048. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1049. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1050. 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
  1051. LEFT JOIN goods g on og.goods_id = g.goods_id
  1052. LEFT JOIN course_business cb ON g.business_id = cb.id
  1053. where 1=1
  1054. and cgu.`status` =1
  1055. <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
  1056. 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
  1057. </if>
  1058. <if test="periodPlush != null and periodPlush != ''">
  1059. AND cgu.period_plush = #{periodPlush}
  1060. </if>
  1061. <if test="officialStatus != null and officialStatus != ''">
  1062. AND cgu.official_status = #{officialStatus}
  1063. </if>
  1064. <if test="changeGrade != null and changeGrade != ''">
  1065. AND cgu.change_grade = #{changeGrade}
  1066. </if>
  1067. <if test="profileStatus != null and profileStatus != ''">
  1068. AND up.status = #{profileStatus}
  1069. </if>
  1070. <if test="gradeId != null and gradeId !='' ">
  1071. and cgu.grade_id = #{gradeId}
  1072. </if>
  1073. <if test="businessId != null and businessId != ''">
  1074. AND g.business_id = #{businessId}
  1075. </if>
  1076. <if test="educationTypeId != null and educationTypeId != ''">
  1077. AND g.education_type_id = #{educationTypeId}
  1078. </if>
  1079. <if test="schoolId != null and schoolId != ''">
  1080. AND g.school_id = #{schoolId}
  1081. </if>
  1082. <if test="majorId != null and majorId != ''">
  1083. AND g.major_id = #{majorId}
  1084. </if>
  1085. <if test="periodStatus != null ">
  1086. and cgu.period_status = #{periodStatus}
  1087. </if>
  1088. <if test="classStartTime != null and classStartTime != '' ">
  1089. AND cg.class_start_time >= #{classStartTime}
  1090. </if>
  1091. <if test="classEndTime != null and classEndTime != '' ">
  1092. AND #{classEndTime} >= cg.class_end_time
  1093. </if>
  1094. <if test="studyStatus != null and studyStatus == 1 ">
  1095. and cgu.period_status = -1
  1096. </if>
  1097. <if test="studyStatus != null and studyStatus == 2 ">
  1098. and cgu.period_status != -1
  1099. </if>
  1100. <if test="className != null and className !='' ">
  1101. and cg.class_name like concat('%', #{className}, '%')
  1102. </if>
  1103. <if test="searchKey != null and searchKey != '' ">
  1104. and (u.realname like concat('%', #{searchKey}, '%') or g.goods_name like concat('%', #{searchKey}, '%') or cg.class_name like concat('%', #{searchKey}, '%'))
  1105. </if>
  1106. <if test="idCard != null and idCard !='' ">
  1107. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1108. </if>
  1109. <if test="telphone != null and telphone !='' ">
  1110. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1111. </if>
  1112. <if test="searchStartTime != null and searchStartTime !='' ">
  1113. AND cgu.create_time >=#{searchStartTime}
  1114. </if>
  1115. <if test="searchEndTime != null and searchEndTime !='' ">
  1116. AND #{searchEndTime} >= cgu.create_time
  1117. </if>
  1118. <if test="periodStartTime != null and periodStartTime !='' ">
  1119. AND cgu.period_time >=#{periodStartTime}
  1120. </if>
  1121. <if test="periodEndTime != null and periodEndTime !='' ">
  1122. AND #{periodEndTime} >= cgu.period_time
  1123. </if>
  1124. <!-- 数据范围过滤 -->
  1125. ${params.dataScope}
  1126. <if test="periodStatus != 2 and periodStatus != 3">
  1127. order by cgu.update_time desc
  1128. </if>
  1129. <if test="periodStatus == 2 ">
  1130. order by cgu.period_wait_time,cgu.create_time
  1131. </if>
  1132. <if test="periodStatus == 3 ">
  1133. order by cgu.period_ing_time,cgu.create_time
  1134. </if>
  1135. </select>
  1136. <select id="listUserPeriodExport" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1137. resultMap="ClassPeriodStudentVo">
  1138. SELECT
  1139. u.user_account,
  1140. u.user_id,
  1141. cgu.`status`,
  1142. u.realname,
  1143. og.goods_id,
  1144. u.id_card,
  1145. cgu.grade_id,
  1146. u.telphone,
  1147. g.class_hours as class_hours,
  1148. g.study_start_time as study_start_time,
  1149. g.study_end_time as study_end_time,
  1150. g.goods_name,
  1151. g.code as goods_code,
  1152. g.stand_price,
  1153. cgu.period_status,
  1154. cg.class_start_time,
  1155. cg.class_end_time,
  1156. cg.class_name,
  1157. cgu.period_plush,
  1158. cgu.period_status_num,
  1159. cgu.order_goods_id,
  1160. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  1161. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  1162. <if test="userPhoto != null and userPhoto == 1">
  1163. up.key_value,
  1164. </if>
  1165. cgu.period_time as end_time
  1166. FROM
  1167. class_grade_user cgu
  1168. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1169. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1170. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1171. LEFT JOIN goods g on og.goods_id = g.goods_id
  1172. LEFT JOIN course_business cb ON g.business_id = cb.id
  1173. 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
  1174. where 1=1
  1175. <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
  1176. 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
  1177. </if>
  1178. and cgu.`status` =1
  1179. <if test="periodPlush != null and periodPlush != ''">
  1180. AND cgu.period_plush = #{periodPlush}
  1181. </if>
  1182. <if test="officialStatus != null and officialStatus != ''">
  1183. AND cgu.official_status = #{officialStatus}
  1184. </if>
  1185. <if test="changeGrade != null and changeGrade != ''">
  1186. AND cgu.change_grade = #{changeGrade}
  1187. </if>
  1188. <if test="profileStatus != null and profileStatus != ''">
  1189. AND up.status = #{profileStatus}
  1190. </if>
  1191. <if test="gradeId != null and gradeId !='' ">
  1192. and cgu.grade_id = #{gradeId}
  1193. </if>
  1194. <if test="businessId != null and businessId != ''">
  1195. AND g.business_id = #{businessId}
  1196. </if>
  1197. <if test="educationTypeId != null and educationTypeId != ''">
  1198. AND g.education_type_id = #{educationTypeId}
  1199. </if>
  1200. <if test="schoolId != null and schoolId != ''">
  1201. AND g.school_id = #{schoolId}
  1202. </if>
  1203. <if test="majorId != null and majorId != ''">
  1204. AND g.major_id = #{majorId}
  1205. </if>
  1206. <if test="periodStatus != null ">
  1207. and cgu.period_status = #{periodStatus}
  1208. </if>
  1209. <if test="classStartTime != null and classStartTime != '' ">
  1210. AND cg.class_start_time >= #{classStartTime}
  1211. </if>
  1212. <if test="classEndTime != null and classEndTime != '' ">
  1213. AND #{classEndTime} >= cg.class_end_time
  1214. </if>
  1215. <if test="studyStatus != null and studyStatus == 1 ">
  1216. and cgu.period_status = -1
  1217. </if>
  1218. <if test="studyStatus != null and studyStatus == 2 ">
  1219. and cgu.period_status != -1
  1220. </if>
  1221. <if test="searchKey != null and searchKey != '' ">
  1222. and (
  1223. u.realname like concat('%', #{searchKey}, '%')
  1224. or u.id_card like concat('%', #{searchKey}, '%')
  1225. or g.goods_name like concat('%', #{searchKey}, '%')
  1226. or cg.class_name like concat('%', #{searchKey}, '%')
  1227. or u.company_name like concat('%', #{searchKey}, '%'))
  1228. </if>
  1229. <if test="searchStartTime != null and searchStartTime !='' ">
  1230. AND cgu.create_time >=#{searchStartTime}
  1231. </if>
  1232. <if test="searchEndTime != null and searchEndTime !='' ">
  1233. AND #{searchEndTime} >= cgu.create_time
  1234. </if>
  1235. <!-- 数据范围过滤 -->
  1236. ${params.dataScope}
  1237. <if test="periodStatus != 2 and periodStatus != 3">
  1238. order by cgu.update_time desc
  1239. </if>
  1240. <if test="periodStatus == 2 ">
  1241. order by cgu.period_wait_time,cgu.create_time
  1242. </if>
  1243. <if test="periodStatus == 3 ">
  1244. order by cgu.period_ing_time,cgu.create_time
  1245. </if>
  1246. </select>
  1247. <select id="userPeriodStatus" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1248. resultMap="ClassPeriodStudentVo">
  1249. SELECT
  1250. IFNULL(ge.exam_num,0) as exam_num,
  1251. cg.class_start_time,
  1252. cg.class_end_time,
  1253. g.study_start_time,
  1254. g.study_end_time,
  1255. (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,
  1256. cgu.user_id,
  1257. og.goods_id
  1258. FROM
  1259. class_grade_user cgu
  1260. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1261. LEFT JOIN order_goods og on og.order_goods_id=cgu.order_goods_id
  1262. LEFT JOIN goods g on g.goods_id=og.goods_id
  1263. LEFT JOIN (SELECT
  1264. COUNT( m.id ) AS exam_num,
  1265. c.goods_id
  1266. FROM
  1267. course_menu_exam m
  1268. LEFT JOIN goods_course c ON m.course_id = c.course_id
  1269. where
  1270. m.type in (1,3)
  1271. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  1272. where 1=1
  1273. and cgu.`status` =1
  1274. <if test="gradeId != null and gradeId !='' ">
  1275. and cgu.grade_id = #{gradeId}
  1276. </if>
  1277. <if test="userId != null ">
  1278. and cgu.user_id = #{userId}
  1279. </if>
  1280. <if test="orderGoodsId != null ">
  1281. and cgu.order_goods_id = #{orderGoodsId}
  1282. </if>
  1283. LIMIT 1
  1284. </select>
  1285. <select id="listPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1286. resultMap="ClassPeriodUserVo">
  1287. SELECT
  1288. u.user_account,
  1289. u.realname,
  1290. u.id_card,
  1291. u.user_id,
  1292. u.telphone,
  1293. u.sex,
  1294. g.goods_id,
  1295. g.goods_name,
  1296. cg.class_name,
  1297. cg.official_name,
  1298. cg.class_start_time,
  1299. cg.class_end_time,
  1300. cg.official_name,
  1301. cg.status as grade_status,
  1302. g.class_hours,
  1303. u.one_inch_photos,
  1304. u.id_card_img1,
  1305. u.id_card_img2,
  1306. cgu.period_status,
  1307. cgu.order_goods_id,
  1308. (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
  1309. 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,
  1310. (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,
  1311. (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
  1312. 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,
  1313. (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
  1314. 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,
  1315. (SELECT
  1316. 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`
  1317. =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,
  1318. (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
  1319. 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,
  1320. (SELECT
  1321. 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`
  1322. =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,
  1323. (SELECT
  1324. 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`
  1325. =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,
  1326. (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,
  1327. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year
  1328. <if test="userId != null and userId !='' ">
  1329. ,(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,
  1330. (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
  1331. </if>
  1332. FROM
  1333. class_grade_user cgu
  1334. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1335. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1336. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1337. LEFT JOIN goods g ON g.goods_id = og.goods_id
  1338. where 1=1
  1339. <if test="userId != null and userId !='' ">
  1340. and u.user_id = #{userId}
  1341. </if>
  1342. <if test="gradeId != null and gradeId !='' ">
  1343. and cgu.grade_id = #{gradeId}
  1344. </if>
  1345. <if test="periodStatus != null and periodStatus !='' ">
  1346. and cgu.period_status = #{periodStatus}
  1347. </if>
  1348. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1349. and cgu.order_goods_id = #{orderGoodsId}
  1350. </if>
  1351. LIMIT 1
  1352. </select>
  1353. <select id="listPeriodAudit" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1354. resultMap="ClassPeriodVo">
  1355. SELECT
  1356. gc.sort as course_sort,
  1357. cm.sort,
  1358. cm.menu_id as id,
  1359. cm.course_id,
  1360. (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  1361. and u.user_id = #{userId}
  1362. </if>) as realname,
  1363. (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  1364. and u.user_id = #{userId}
  1365. </if>) as user_id,
  1366. (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
  1367. 0 as common_sign,
  1368. (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on
  1369. cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
  1370. 1 as type,
  1371. NULL as study_start_time,
  1372. NULL as study_end_time
  1373. FROM
  1374. course_menu cm
  1375. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  1376. where 1=1
  1377. <if test="goodsId != null and goodsId !='' ">
  1378. and gc.goods_id=#{goodsId}
  1379. </if>
  1380. <if test="courseId != null and courseId !='' ">
  1381. and gc.course_id=#{courseId}
  1382. </if>
  1383. AND cm.type=1
  1384. UNION
  1385. SELECT
  1386. gc.sort as course_sort,
  1387. cm.sort,
  1388. cm.menu_id as id,
  1389. cm.course_id,
  1390. (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  1391. and u.user_id = #{userId}
  1392. </if>) as realname,
  1393. (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  1394. and u.user_id = #{userId}
  1395. </if>) as user_id,
  1396. (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
  1397. (SELECT cc.common_sign FROM course_chapter cc where cm.menu_id = cc.chapter_id) as common_sign,
  1398. (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs where ccs.chapter_id=cm.menu_id) as class_hours,
  1399. 2 as type,
  1400. (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
  1401. 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
  1402. limit 1) as study_start_time,
  1403. (SELECT usr.update_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
  1404. 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
  1405. limit 1) as study_end_time
  1406. FROM
  1407. course_menu cm
  1408. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  1409. where 1=1
  1410. <if test="goodsId != null and goodsId !='' ">
  1411. and gc.goods_id=#{goodsId}
  1412. </if>
  1413. <if test="courseId != null and courseId !='' ">
  1414. and gc.course_id=#{courseId}
  1415. </if>
  1416. AND cm.type=2
  1417. </select>
  1418. <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1419. resultMap="ClassPeriodVo">
  1420. SELECT
  1421. gc.sort as course_sort,
  1422. cm.sort,
  1423. cm.menu_id as id,
  1424. cm.course_id,
  1425. (SELECT u.realname FROM `user` u where 1=1
  1426. <if test="userId != null and userId !='' ">
  1427. and u.user_id = #{userId}
  1428. </if>
  1429. ) as realname,
  1430. (SELECT u.user_id FROM `user` u where 1=1
  1431. <if test="userId != null and userId !='' ">
  1432. and u.user_id = #{userId}
  1433. </if>
  1434. ) as user_id,
  1435. cs.`name` as type_name,
  1436. cs.duration_time,
  1437. cs.real_live_start_time,
  1438. cs.real_live_end_time,
  1439. cs.real_duration,
  1440. cs.section_type,
  1441. null as class_hours,
  1442. 3 as type
  1443. FROM
  1444. course_menu cm
  1445. LEFT JOIN course_section cs on cm.menu_id = cs.section_id
  1446. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  1447. where 1=1
  1448. <if test="goodsId != null and goodsId !='' ">
  1449. and gc.goods_id = #{goodsId}
  1450. </if>
  1451. <if test="courseId != null ">
  1452. and gc.course_id=#{courseId}
  1453. </if>
  1454. AND cm.type=3
  1455. </select>
  1456. <select id="listPeriodAuditExam" parameterType="map" resultMap="ClassPeriodChapterVo">
  1457. SELECT
  1458. cme.exam_id as id,
  1459. cme.course_id,
  1460. (SELECT u.realname FROM `user` u where 1=1
  1461. <if test="userId != null and userId !='' ">
  1462. and u.user_id = #{userId}
  1463. </if>
  1464. ) as realname,
  1465. (SELECT u.user_id FROM `user` u where 1=1
  1466. <if test="userId != null and userId !='' ">
  1467. and u.user_id = #{userId}
  1468. </if>
  1469. ) as user_id,
  1470. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1471. null as class_hours,
  1472. 4 as type,
  1473. (
  1474. SELECT
  1475. ups.record_start_time
  1476. FROM
  1477. user_period_status ups
  1478. LEFT JOIN user_period up ON up.id = ups.period_id
  1479. WHERE
  1480. period_status = 1
  1481. AND up.course_id = gc.course_id
  1482. <if test="goodsId != null and goodsId !='' ">
  1483. AND up.goods_id = #{goodsId}
  1484. </if>
  1485. and cme.section_id =up.section_id
  1486. AND up.exam_id = cme.exam_id
  1487. ) AS study_start_time,
  1488. (
  1489. SELECT
  1490. ups.record_end_time
  1491. FROM
  1492. user_period_status ups
  1493. LEFT JOIN user_period up ON up.id = ups.period_id
  1494. WHERE
  1495. period_status = 1
  1496. AND up.course_id = gc.course_id
  1497. <if test="goodsId != null and goodsId !='' ">
  1498. AND up.goods_id = #{goodsId}
  1499. </if>
  1500. AND up.exam_id = cme.exam_id
  1501. ) AS study_end_time,
  1502. (
  1503. SELECT
  1504. ups.`status`
  1505. FROM
  1506. user_period_status ups
  1507. LEFT JOIN user_period up ON up.id = ups.period_id
  1508. WHERE
  1509. period_status = 1
  1510. AND up.course_id = gc.course_id
  1511. <if test="goodsId != null and goodsId !='' ">
  1512. AND up.goods_id = #{goodsId}
  1513. </if>
  1514. and cme.section_id =up.section_id
  1515. AND up.exam_id = cme.exam_id
  1516. ) AS STATUS,
  1517. (
  1518. SELECT
  1519. ups.create_time
  1520. FROM
  1521. user_period_status ups
  1522. LEFT JOIN user_period up ON up.id = ups.period_id
  1523. WHERE
  1524. period_status = 1
  1525. AND up.course_id = gc.course_id
  1526. <if test="goodsId != null and goodsId !='' ">
  1527. AND up.goods_id = #{goodsId}
  1528. </if>
  1529. and cme.section_id =up.section_id
  1530. AND up.exam_id = cme.exam_id
  1531. ) AS audit_time,
  1532. (
  1533. SELECT
  1534. COUNT( ups.id )
  1535. FROM
  1536. user_period_status ups
  1537. LEFT JOIN user_period up ON up.id = ups.period_id
  1538. WHERE
  1539. period_status = 1
  1540. AND up.course_id = gc.course_id
  1541. <if test="goodsId != null and goodsId !='' ">
  1542. AND up.goods_id = #{goodsId}
  1543. </if>
  1544. and cme.section_id =up.section_id
  1545. AND up.exam_id = cme.exam_id
  1546. ) AS audit_num
  1547. FROM
  1548. course_menu_exam cme
  1549. LEFT JOIN goods_course gc on gc.course_id = cme.course_id
  1550. LEFT JOIN course_menu cm on cme.section_id = cm.menu_id
  1551. where 1=1
  1552. <if test="goodsId != null and goodsId !='' ">
  1553. and gc.goods_id= #{goodsId}
  1554. </if>
  1555. AND cm.type=3 and cme.chapter_id=0 and cme.module_id=0 and cme.type=1 and cm.type=3
  1556. </select>
  1557. <select id="listperiodChapter" parameterType="map" resultMap="ClassPeriodChapterVo">
  1558. SELECT
  1559. cmc.sort,
  1560. cc.chapter_id as id,
  1561. cc.common_sign,
  1562. cm.course_id,
  1563. ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
  1564. and u.user_id = #{userId}
  1565. </if> LIMIT 1) AS realname,
  1566. ( SELECT u.user_id FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
  1567. and u.user_id = #{userId}
  1568. </if> LIMIT 1) AS user_id,
  1569. cc.`name` as type_name,
  1570. ( SELECT COUNT( ccs.section_id ) FROM course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id ) AS
  1571. class_hours,
  1572. 2 AS type,
  1573. (
  1574. SELECT
  1575. usr.create_time
  1576. FROM
  1577. user_study_record usr
  1578. LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
  1579. WHERE
  1580. ccs.chapter_id = cc.chapter_id
  1581. AND usr.current_status = 1
  1582. <if test="courseId != null ">
  1583. AND usr.course_id=#{courseId}
  1584. </if>
  1585. <if test="moduleId != null">
  1586. AND usr.module_id=#{moduleId}
  1587. </if>
  1588. <if test="goodsId != null and goodsId !='' ">
  1589. AND usr.goods_id=#{goodsId}
  1590. </if>
  1591. <if test="gradeId != null and gradeId !='' ">
  1592. AND usr.grade_id=#{gradeId}
  1593. </if>
  1594. <if test="userId != null and userId !='' ">
  1595. AND usr.user_id=#{userId}
  1596. </if>
  1597. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1598. AND usr.order_goods_id=#{orderGoodsId}
  1599. </if>
  1600. ORDER BY
  1601. usr.create_time ASC
  1602. LIMIT 1
  1603. ) AS study_start_time,
  1604. (
  1605. SELECT
  1606. usr.update_time
  1607. FROM
  1608. user_study_record usr
  1609. LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
  1610. WHERE
  1611. ccs.chapter_id = cc.chapter_id
  1612. AND usr.current_status = 1
  1613. <if test="courseId != null ">
  1614. AND usr.course_id=#{courseId}
  1615. </if>
  1616. <if test="moduleId != null">
  1617. AND usr.module_id=#{moduleId}
  1618. </if>
  1619. <if test="goodsId != null and goodsId !='' ">
  1620. AND usr.goods_id=#{goodsId}
  1621. </if>
  1622. <if test="gradeId != null and gradeId !='' ">
  1623. AND usr.grade_id=#{gradeId}
  1624. </if>
  1625. <if test="userId != null and userId !='' ">
  1626. AND usr.user_id=#{userId}
  1627. </if>
  1628. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1629. AND usr.order_goods_id=#{orderGoodsId}
  1630. </if>
  1631. ORDER BY
  1632. usr.create_time DESC
  1633. LIMIT 1
  1634. ) AS study_end_time,
  1635. (
  1636. SELECT
  1637. ubr.performance
  1638. FROM
  1639. user_bank_record ubr
  1640. LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id and cme.chapter_id = ubr.chapter_id
  1641. WHERE 1=1
  1642. AND ubr.current_status = 1
  1643. AND ubr.report_status = 1
  1644. <if test="moduleId != null ">
  1645. AND ubr.module_id=#{moduleId}
  1646. </if>
  1647. <if test="goodsId != null">
  1648. AND ubr.goods_id=#{goodsId}
  1649. </if>
  1650. <if test="moduleId != null ">
  1651. AND cme.module_id=#{moduleId}
  1652. </if>
  1653. <if test="courseId != null">
  1654. AND cme.course_id =#{courseId}
  1655. </if>
  1656. <if test="userId != null and userId !='' ">
  1657. AND ubr.user_id=#{userId}
  1658. </if>
  1659. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1660. AND ubr.order_goods_id=#{orderGoodsId}
  1661. </if>
  1662. AND cme.chapter_id = cmc.chapter_id
  1663. LIMIT 1 ) AS performance
  1664. FROM
  1665. course_menu cm
  1666. LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id and cm.type = 1
  1667. LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
  1668. WHERE
  1669. 1 = 1
  1670. <if test="moduleId != null ">
  1671. AND cmc.module_id=#{moduleId}
  1672. </if>
  1673. <if test="courseId != null">
  1674. AND cm.course_id =#{courseId}
  1675. </if>
  1676. </select>
  1677. <select id="listperiodExam" parameterType="map" resultMap="ClassPeriodSectionVo">
  1678. SELECT
  1679. cme.exam_id as id,
  1680. cme.course_id,
  1681. e.do_type,
  1682. <if test="userId != null and userId !='' ">
  1683. (SELECT u.realname FROM `user` u where 1=1
  1684. and u.user_id = #{userId}
  1685. ) as realname,
  1686. </if>
  1687. <if test="userId != null and userId !='' ">
  1688. #{userId} as user_id,
  1689. </if>
  1690. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1691. null as class_hours,
  1692. 4 as type,
  1693. cme.chapter_id,
  1694. cme.module_id
  1695. FROM
  1696. course_menu_exam cme
  1697. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1698. WHERE 1=1
  1699. AND cme.type=1
  1700. <if test="courseId != null">
  1701. AND cme.course_id=#{courseId}
  1702. </if>
  1703. <if test="chapterId != null">
  1704. AND cme.chapter_id =#{chapterId}
  1705. </if>
  1706. <if test="moduleId != null">
  1707. AND cme.module_id =#{moduleId}
  1708. </if>
  1709. </select>
  1710. <select id="listperiodModuleExam" parameterType="map" resultMap="ClassPeriodChapterVo">
  1711. SELECT
  1712. cme.exam_id as id,
  1713. cme.course_id,
  1714. e.do_type,
  1715. <if test="userId != null and userId !='' ">
  1716. (SELECT u.realname FROM `user` u where 1=1
  1717. and u.user_id = #{userId}
  1718. ) as realname,
  1719. </if>
  1720. <if test="userId != null and userId !='' ">
  1721. #{userId} as user_id,
  1722. </if>
  1723. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1724. null as class_hours,
  1725. 5 as type,
  1726. cme.module_id
  1727. FROM
  1728. course_menu_exam cme
  1729. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1730. WHERE 1=1
  1731. AND cme.type=3
  1732. <if test="courseId != null">
  1733. AND cme.course_id=#{courseId}
  1734. </if>
  1735. <if test="moduleId != null">
  1736. AND cme.module_id =#{moduleId}
  1737. </if>
  1738. </select>
  1739. <select id="listPeriodSection" parameterType="map" resultMap="ClassPeriodSectionVo">
  1740. SELECT
  1741. ccs.sort,
  1742. cs.section_id AS id,
  1743. #{courseId} AS course_id,
  1744. <if test="userId != null and userId !='' ">
  1745. (SELECT u.realname FROM `user` u where 1=1
  1746. and u.user_id = #{userId}
  1747. ) as realname,
  1748. </if>
  1749. <if test="userId != null and userId !='' ">
  1750. #{userId} as user_id,
  1751. </if>
  1752. cs.NAME AS type_name,
  1753. cs.duration_time,
  1754. cs.section_type,
  1755. cs.real_live_start_time,
  1756. cs.real_live_end_time,
  1757. cs.real_duration,
  1758. NULL AS class_hours,
  1759. cs.recording_url,
  1760. 3 AS type
  1761. FROM
  1762. course_chapter_section ccs
  1763. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  1764. WHERE
  1765. 1 = 1
  1766. <if test="chapterId != null">
  1767. AND ccs.chapter_id = #{chapterId}
  1768. </if>
  1769. ORDER BY
  1770. ccs.sort
  1771. </select>
  1772. <select id="listPeriodSectionExam" parameterType="map" resultMap="ClassPeriodSectionVo">
  1773. SELECT
  1774. cme.exam_id as id,
  1775. cme.course_id,
  1776. (SELECT u.realname FROM `user` u where 1=1
  1777. <if test="userId != null and userId !='' ">
  1778. and u.user_id = #{userId}
  1779. </if>
  1780. ) as realname,
  1781. (SELECT u.user_id FROM `user` u where 1=1
  1782. <if test="userId != null and userId !='' ">
  1783. and u.user_id = #{userId}
  1784. </if>
  1785. ) as user_id,
  1786. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1787. null as class_hours,
  1788. 4 as type
  1789. FROM
  1790. course_menu_exam cme
  1791. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1792. WHERE 1=1
  1793. and cme.module_id =0
  1794. and cme.type =1
  1795. <if test="courseId != null">
  1796. AND cme.course_id=#{courseId}
  1797. </if>
  1798. <if test="chapterId != null ">
  1799. AND cme.chapter_id = #{chapterId}
  1800. </if>
  1801. </select>
  1802. <select id="selectStart" parameterType="map" resultType="long">
  1803. SELECT
  1804. rp.create_time
  1805. FROM
  1806. user_study_record_photo rp
  1807. LEFT JOIN user_period_status ups ON rp.period_id = ups.id
  1808. LEFT JOIN user_period up ON up.id = ups.period_id
  1809. WHERE
  1810. 1=1
  1811. <if test="orderGoodsId != null ">
  1812. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1813. </if>
  1814. AND ups.period_status = 1
  1815. AND up.grade_id = #{gradeId}
  1816. AND up.user_id = #{userId}
  1817. ORDER BY
  1818. rp.create_time ASC
  1819. </select>
  1820. <select id="selectStartNew" parameterType="map" resultType="long">
  1821. SELECT
  1822. rp.create_time
  1823. FROM
  1824. user_study_record_photo rp
  1825. LEFT JOIN user_period_status ups ON rp.period_id = ups.id
  1826. LEFT JOIN user_period up ON up.id = ups.period_id
  1827. WHERE
  1828. 1=1
  1829. <if test="orderGoodsId != null ">
  1830. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1831. </if>
  1832. AND ups.period_status = 1
  1833. AND up.grade_id = #{gradeId}
  1834. AND up.user_id = #{userId}
  1835. ORDER BY
  1836. rp.create_time ASC
  1837. </select>
  1838. <select id="selectStartNoPhoto" parameterType="map" resultType="long">
  1839. SELECT
  1840. ups.record_start_time
  1841. FROM
  1842. user_period_status ups
  1843. LEFT JOIN user_period up ON up.id = ups.period_id
  1844. WHERE
  1845. 1=1
  1846. <if test="orderGoodsId != null ">
  1847. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1848. </if>
  1849. AND ups.period_status = 1
  1850. AND up.grade_id = #{gradeId}
  1851. AND up.user_id = #{userId}
  1852. ORDER BY
  1853. ups.record_start_time ASC
  1854. limit 1
  1855. </select>
  1856. <select id="selectStartNoPhotoNew" parameterType="map" resultType="long">
  1857. SELECT
  1858. ups.record_start_time
  1859. FROM
  1860. user_period_status ups
  1861. LEFT JOIN user_period up ON up.id = ups.period_id
  1862. WHERE
  1863. 1=1
  1864. <if test="orderGoodsId != null ">
  1865. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1866. </if>
  1867. AND ups.period_status = 1
  1868. AND up.grade_id = #{gradeId}
  1869. AND up.user_id = #{userId}
  1870. ORDER BY
  1871. ups.record_start_time ASC
  1872. limit 1
  1873. </select>
  1874. <select id="selectEnd" parameterType="map" resultType="long">
  1875. SELECT
  1876. usr.end_time
  1877. FROM
  1878. user_study_record usr
  1879. WHERE
  1880. usr.goods_id = #{goodsId}
  1881. AND usr.grade_id = #{gradeId}
  1882. AND usr.user_id = #{userId} UNION
  1883. SELECT
  1884. ubr.update_time as end_time
  1885. FROM
  1886. user_bank_record ubr
  1887. WHERE
  1888. ubr.goods_id =#{goodsId}
  1889. AND ubr.grade_id = #{gradeId}
  1890. AND ubr.user_id = #{userId}
  1891. ORDER BY end_time DESC
  1892. </select>
  1893. <select id="sendClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1894. SELECT
  1895. cgu.user_id,
  1896. cgu.order_goods_id,
  1897. cg.class_start_time,
  1898. cg.class_end_time,
  1899. og.goods_id,
  1900. cg.grade_id
  1901. FROM
  1902. class_grade_user cgu
  1903. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1904. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1905. LEFT JOIN goods g on og.goods_id = g.goods_id
  1906. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1907. where 1=1
  1908. and irb.remind_id =5
  1909. and cgu.status = 1
  1910. AND unix_timestamp(now()) BETWEEN cg.class_end_time-1728000 and cg.class_end_time-1641600
  1911. </select>
  1912. <select id="checkSendClassGradeUser" parameterType="map" resultType="long">
  1913. 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
  1914. </select>
  1915. <select id="sendTenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1916. SELECT
  1917. cgu.user_id,
  1918. cgu.order_goods_id,
  1919. cg.class_start_time,
  1920. cg.class_end_time,
  1921. og.goods_id,
  1922. cg.grade_id
  1923. FROM
  1924. class_grade_user cgu
  1925. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1926. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1927. LEFT JOIN goods g on og.goods_id = g.goods_id
  1928. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1929. where 1=1
  1930. and irb.remind_id =6
  1931. and cgu.status = 1
  1932. AND unix_timestamp(now()) BETWEEN cg.class_end_time-864000 and cg.class_end_time-777600
  1933. </select>
  1934. <select id="sendTenAndFifteenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1935. SELECT
  1936. cgu.user_id,
  1937. cgu.order_goods_id,
  1938. cg.class_start_time,
  1939. cg.class_end_time,
  1940. og.goods_id,
  1941. cg.grade_id
  1942. FROM
  1943. class_grade_user cgu
  1944. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1945. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1946. where 1=1
  1947. and cgu.status = 1
  1948. AND (unix_timestamp(now()) BETWEEN cg.class_end_time-950400 and cg.class_end_time-864000 or
  1949. unix_timestamp(now()) BETWEEN cg.class_end_time-1382400 and cg.class_end_time-1296000)
  1950. </select>
  1951. <select id="checkTenClassGradeUser" parameterType="map" resultMap="ClassGradeUserGoodsVoResult">
  1952. SELECT
  1953. cgu.user_id,
  1954. cgu.order_goods_id,
  1955. cg.class_end_time,
  1956. og.goods_id,
  1957. g.goods_name,
  1958. cg.class_name as grade_name
  1959. FROM
  1960. class_grade_user cgu
  1961. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1962. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1963. LEFT JOIN goods g ON g.goods_id = og.goods_id
  1964. where 1=1
  1965. and cg.status = 1
  1966. and cgu.status = 1
  1967. and cgu.user_id = #{userId}
  1968. and (cgu.period_status = -1 or cgu.period_status = 0)
  1969. AND unix_timestamp(now()) BETWEEN cg.class_end_time-#{startTime} and cg.class_end_time-#{endTime}
  1970. </select>
  1971. <select id="sendFiveClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1972. SELECT
  1973. cgu.user_id,
  1974. cgu.order_goods_id,
  1975. cg.class_start_time,
  1976. cg.class_end_time,
  1977. og.goods_id,
  1978. cg.grade_id
  1979. FROM
  1980. class_grade_user cgu
  1981. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1982. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1983. LEFT JOIN goods g on og.goods_id = g.goods_id
  1984. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1985. where 1=1
  1986. and irb.remind_id =7
  1987. and cgu.status = 1
  1988. AND unix_timestamp(now()) BETWEEN cg.class_end_time-432000 and cg.class_end_time-345600
  1989. </select>
  1990. <select id="selectUserCount" parameterType="com.zhongzheng.modules.user.domain.User" resultType="long">
  1991. SELECT
  1992. COUNT( 1 )
  1993. FROM
  1994. `user`
  1995. WHERE
  1996. id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler} and user_id != #{userId} and `status` = 1
  1997. </select>
  1998. <select id="selectUserCertificate" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1999. resultMap="ClassGradeUserVoResult">
  2000. </select>
  2001. <select id="findChapterList" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="CourseChapterResultVo">
  2002. SELECT ui.* from (SELECT
  2003. cc.chapter_id,
  2004. cc.`name`,
  2005. m.sort,
  2006. cm.common_sign,
  2007. (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
  2008. FROM
  2009. course_module_chapter p
  2010. LEFT JOIN course_chapter cc ON p.chapter_id = cc.chapter_id
  2011. LEFT JOIN course_menu m ON m.menu_id = p.module_id
  2012. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  2013. LEFT JOIN course_module cm ON p.module_id = cm.module_id
  2014. WHERE
  2015. gc.goods_id = #{goodsId}
  2016. <if test="moduleId != null and moreCertificateStatus == 2 ">
  2017. AND p.module_id = #{moduleId}
  2018. </if>
  2019. AND m.type = 1 UNION ALL
  2020. SELECT
  2021. cc.chapter_id,
  2022. cc.`name`,
  2023. m.sort,
  2024. 0 as common_sign,
  2025. (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
  2026. FROM
  2027. course_menu m
  2028. LEFT JOIN course_chapter cc ON m.menu_id = cc.chapter_id
  2029. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  2030. WHERE
  2031. gc.goods_id = #{goodsId}
  2032. <if test="moduleId != null and moreCertificateStatus == 2 ">
  2033. AND 1 = 0
  2034. </if>
  2035. AND m.type = 2)ui
  2036. ORDER BY ui.sort
  2037. </select>
  2038. <select id="selectOfficialInfoCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  2039. SELECT
  2040. count(*)
  2041. FROM
  2042. class_grade_user cgu
  2043. WHERE
  2044. cgu.grade_id = #{gradeId}
  2045. AND cgu.official_status = 1
  2046. </select>
  2047. <select id="selectLearnStatusCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  2048. SELECT
  2049. count(*)
  2050. FROM
  2051. class_grade_user cgu
  2052. WHERE
  2053. cgu.grade_id = #{gradeId}
  2054. AND cgu.learn_status = 1
  2055. </select>
  2056. <select id="selectOfficialPeriodCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  2057. SELECT
  2058. count(*)
  2059. FROM
  2060. class_grade_user cgu
  2061. WHERE
  2062. cgu.grade_id = #{gradeId}
  2063. AND cgu.period_plush = 1
  2064. </select>
  2065. <select id="selectOfficialNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  2066. SELECT
  2067. gu.*
  2068. FROM
  2069. class_grade g
  2070. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  2071. WHERE
  2072. g.interface_push_id > 0
  2073. AND g.official_name IS NOT NULL
  2074. AND g.`status` = 1
  2075. AND gu.`status` = 1
  2076. AND gu.change_grade = 0
  2077. AND IFNULL(gu.official_status,0) != 1
  2078. </select>
  2079. <select id="selectPeriodNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  2080. SELECT
  2081. gu.*
  2082. FROM
  2083. class_grade g
  2084. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  2085. WHERE
  2086. g.interface_period_id > 0
  2087. AND g.`status` = 1
  2088. AND gu.`status` = 1
  2089. AND gu.change_grade = 0
  2090. AND IFNULL( gu.period_plush, 0 ) != 1
  2091. AND gu.period_status = 1
  2092. AND gu.official_status = 1
  2093. <if test="gradeId != null and gradeId != ''">
  2094. AND gu.grade_id = #{gradeId}
  2095. </if>
  2096. </select>
  2097. <select id="selectGoodsGradeList" parameterType="Long" resultMap="ClassGradeUserGoodsVoResult">
  2098. SELECT
  2099. cgg.goods_id,
  2100. cgg.grade_id,
  2101. cgu.user_id,
  2102. cgu.order_goods_id
  2103. FROM
  2104. class_grade_goods cgg
  2105. LEFT JOIN class_grade_user cgu ON cgg.grade_id = cgu.grade_id
  2106. WHERE
  2107. cgg.goods_id = #{goodsId}
  2108. AND cgu.user_id IS NOT NULL
  2109. </select>
  2110. <select id="queryCountList" parameterType="java.lang.Integer" resultMap="ClassGradeUserVoResult">
  2111. SELECT
  2112. cgu.*,
  2113. cg.interface_account_id,
  2114. cg.no_interface_account_id
  2115. FROM
  2116. class_grade_user cgu
  2117. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  2118. LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
  2119. LEFT JOIN goods g on og.goods_id = g.goods_id
  2120. WHERE
  2121. cgu.`status` = 1
  2122. and g.project_id = #{projectId}
  2123. and g.business_id = #{businessId}
  2124. <if test="all != null and all == 0">
  2125. and (cg.interface_account_id is not null or cg.no_interface_account_id is not null)
  2126. </if>
  2127. </select>
  2128. <select id="checkFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2129. SELECT
  2130. IFNULL(count(*),0)
  2131. FROM
  2132. class_grade_user cgu
  2133. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2134. LEFT JOIN goods g on og.goods_id = g.goods_id
  2135. LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
  2136. WHERE
  2137. cgu.user_id = #{userId}
  2138. AND cgu.period_status = -1
  2139. AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
  2140. and g.business_id = #{businessId}
  2141. and g.goods_id != #{goodsId}
  2142. AND (
  2143. SELECT
  2144. IFNULL( count(*), 0 )
  2145. FROM
  2146. user_period up
  2147. WHERE
  2148. 1 = 1
  2149. AND up.user_id = cgu.user_id
  2150. AND up.grade_id = cgu.grade_id
  2151. )>0
  2152. </select>
  2153. <select id="getFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2154. SELECT
  2155. g.goods_id
  2156. FROM
  2157. class_grade_user cgu
  2158. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2159. LEFT JOIN goods g on og.goods_id = g.goods_id
  2160. LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
  2161. WHERE
  2162. cgu.user_id = #{userId}
  2163. AND cgu.period_status = -1
  2164. AND cgu.period_wait_time is null
  2165. AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
  2166. and g.business_id = #{businessId}
  2167. and g.goods_id != #{goodsId}
  2168. and cgu.`status` = 1
  2169. AND (
  2170. SELECT
  2171. IFNULL( count(*), 0 )
  2172. FROM
  2173. user_period up
  2174. WHERE
  2175. 1 = 1
  2176. AND up.order_goods_id = cgu.order_goods_id
  2177. )>0
  2178. </select>
  2179. <select id="getOrderGoods" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.order.domain.OrderGoods">
  2180. SELECT
  2181. og.*
  2182. FROM
  2183. order_goods og
  2184. LEFT JOIN `order` o ON og.order_sn = o.order_sn
  2185. WHERE
  2186. o.user_id = #{userId}
  2187. AND og.goods_id = #{goodsId}
  2188. AND og.refund_status != 2
  2189. AND og.pay_status != 1
  2190. AND og.`status` = 1
  2191. AND o.`status` = 1
  2192. </select>
  2193. <select id="getSevenPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2194. SELECT
  2195. p.create_time
  2196. FROM
  2197. user_study_record usr
  2198. LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
  2199. LEFT JOIN course_module cm ON usr.module_id = cm.module_id
  2200. WHERE
  2201. usr.current_status = 1
  2202. AND usr.user_id = #{userId}
  2203. AND usr.grade_id = #{gradeId}
  2204. AND cm.common_sign = 0
  2205. <if test="orderGoodsId != null and orderGoodsId !='' ">
  2206. AND usr.order_goods_id = #{orderGoodsId}
  2207. </if>
  2208. AND P.create_time IS NOT NULL
  2209. ORDER BY
  2210. P.create_time
  2211. LIMIT 1
  2212. </select>
  2213. <select id="getPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2214. SELECT
  2215. p.create_time
  2216. FROM
  2217. user_study_record usr
  2218. LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
  2219. WHERE
  2220. usr.current_status = 1
  2221. AND usr.user_id = #{userId}
  2222. AND usr.grade_id = #{gradeId}
  2223. <if test="orderGoodsId != null and orderGoodsId !='' ">
  2224. AND usr.order_goods_id = #{orderGoodsId}
  2225. </if>
  2226. AND P.create_time IS NOT NULL
  2227. ORDER BY
  2228. P.create_time
  2229. LIMIT 1
  2230. </select>
  2231. <select id="getPeriodEndTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  2232. SELECT
  2233. ups.record_end_time
  2234. FROM
  2235. user_period_status ups
  2236. LEFT JOIN user_period up ON up.id = ups.period_id
  2237. WHERE
  2238. 1 = 1
  2239. AND up.user_id = #{userId}
  2240. AND up.grade_id = #{gradeId}
  2241. <if test="orderGoodsId != null and orderGoodsId !='' ">
  2242. AND up.order_goods_id = #{orderGoodsId}
  2243. </if>
  2244. AND ups.period_status = 1
  2245. ORDER BY
  2246. ups.record_end_time DESC
  2247. LIMIT 1
  2248. </select>
  2249. <select id="getClassInfoByUser" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
  2250. SELECT
  2251. cgu.*
  2252. FROM
  2253. class_grade_user cgu
  2254. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2255. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  2256. LEFT JOIN goods g ON og.goods_id = g.goods_id
  2257. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2258. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2259. LEFT JOIN course_business cb ON g.business_id = cb.id
  2260. WHERE
  2261. cgu.`status` = 1
  2262. AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "继续教育" ) > 0
  2263. AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "施工现场专业人员" ) > 0
  2264. AND og.`status` = 1
  2265. AND og.refund_status != 2
  2266. AND og.pay_status IN ( 2, 3, 4 )
  2267. AND cgu.period_status != 1
  2268. AND cgu.finish_status = 0
  2269. AND cg.class_start_time &lt;= UNIX_TIMESTAMP(NOW())
  2270. AND cg.class_end_time &gt;= UNIX_TIMESTAMP(NOW())
  2271. AND (
  2272. SELECT
  2273. COUNT( usr.record_id )
  2274. FROM
  2275. user_study_record usr
  2276. WHERE
  2277. usr.order_goods_id = cgu.order_goods_id
  2278. AND usr.user_id = cgu.user_id
  2279. AND usr.current_status = 1
  2280. ) > 0
  2281. AND cgu.user_id = #{userId}
  2282. </select>
  2283. <select id="listVideoUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  2284. resultMap="ClassPeriodStudentVo">
  2285. SELECT
  2286. u.user_account,
  2287. u.user_id,
  2288. cgu.`status`,
  2289. u.realname,
  2290. og.goods_id,
  2291. u.id_card,
  2292. cgu.grade_id,
  2293. u.telphone,
  2294. u.one_inch_photos,
  2295. g.class_hours as class_hours,
  2296. g.study_start_time as study_start_time,
  2297. g.study_end_time as study_end_time,
  2298. g.goods_name,
  2299. g.code as goods_code,
  2300. g.stand_price,
  2301. g.goods_id,
  2302. cgu.period_status,
  2303. cg.class_start_time,
  2304. cg.class_end_time,
  2305. cg.class_name,
  2306. cgu.period_plush,
  2307. cgu.period_status_num,
  2308. cgu.period_time,
  2309. cgu.order_goods_id,
  2310. IFNULL(ge.exam_num,0) as exam_num,
  2311. cgu.period_wait_time as end_time,
  2312. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  2313. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  2314. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  2315. (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,
  2316. cet.education_name,
  2317. cpt.project_name,
  2318. m.category_name,
  2319. cb.business_name
  2320. FROM
  2321. class_grade_user cgu
  2322. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  2323. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2324. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  2325. LEFT JOIN goods g on og.goods_id = g.goods_id
  2326. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2327. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2328. LEFT JOIN course_business cb ON g.business_id = cb.id
  2329. LEFT JOIN major m ON g.major_id = m.id
  2330. LEFT JOIN (SELECT
  2331. COUNT( m.id ) AS exam_num,
  2332. c.goods_id
  2333. FROM
  2334. course_menu_exam m
  2335. LEFT JOIN goods_course c ON m.course_id = c.course_id
  2336. where
  2337. m.type in (1,3)
  2338. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  2339. where 1=1
  2340. and cgu.`status` =1
  2341. <if test="periodPlush != null and periodPlush != ''">
  2342. AND cgu.period_plush = #{periodPlush}
  2343. </if>
  2344. <if test="officialStatus != null and officialStatus != ''">
  2345. AND cgu.official_status = #{officialStatus}
  2346. </if>
  2347. <if test="changeGrade != null and changeGrade != ''">
  2348. AND cgu.change_grade = #{changeGrade}
  2349. </if>
  2350. <if test="profileStatus != null and profileStatus != ''">
  2351. AND up.status = #{profileStatus}
  2352. </if>
  2353. <if test="gradeId != null and gradeId !='' ">
  2354. and cgu.grade_id = #{gradeId}
  2355. </if>
  2356. <if test="businessId != null and businessId != ''">
  2357. AND g.business_id = #{businessId}
  2358. </if>
  2359. <if test="projectId != null and projectId != ''">
  2360. AND g.project_id = #{projectId}
  2361. </if>
  2362. <if test="educationTypeId != null and educationTypeId != ''">
  2363. AND g.education_type_id = #{educationTypeId}
  2364. </if>
  2365. <if test="schoolId != null and schoolId != ''">
  2366. AND g.school_id = #{schoolId}
  2367. </if>
  2368. <if test="majorId != null and majorId != ''">
  2369. AND g.major_id = #{majorId}
  2370. </if>
  2371. <if test="periodStatus != null ">
  2372. and cgu.period_status = #{periodStatus}
  2373. </if>
  2374. <if test="classStartTime != null and classStartTime != '' ">
  2375. AND cg.class_start_time >= #{classStartTime}
  2376. </if>
  2377. <if test="classEndTime != null and classEndTime != '' ">
  2378. AND #{classEndTime} >= cg.class_end_time
  2379. </if>
  2380. <if test="studyStatus != null and studyStatus == 1 ">
  2381. and cgu.period_status = -1
  2382. </if>
  2383. <if test="studyStatus != null and studyStatus == 2 ">
  2384. and cgu.period_status != -1
  2385. </if>
  2386. <if test="className != null and className !='' ">
  2387. and cg.class_name like concat('%', #{className}, '%')
  2388. </if>
  2389. <if test="searchKey != null and searchKey != '' ">
  2390. and (u.realname like concat('%', #{searchKey}, '%')
  2391. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  2392. or g.goods_name like concat('%', #{searchKey}, '%')
  2393. or cg.class_name like concat('%', #{searchKey}, '%'))
  2394. </if>
  2395. <if test="userId != null and userId !='' ">
  2396. AND cgu.user_id = #{userId}
  2397. </if>
  2398. <if test="idCard != null and idCard !='' ">
  2399. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  2400. </if>
  2401. <if test="telphone != null and telphone !='' ">
  2402. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  2403. </if>
  2404. <if test="searchStartTime != null and searchStartTime != '' ">
  2405. and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND r.create_time >= #{searchStartTime} )>0
  2406. </if>
  2407. <if test="searchEndTime != null and searchEndTime != '' ">
  2408. and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND #{searchEndTime} >= r.create_time )>0
  2409. </if>
  2410. <if test="periodStartTime != null and periodStartTime !='' ">
  2411. AND cgu.period_time >=#{periodStartTime}
  2412. </if>
  2413. <if test="periodEndTime != null and periodEndTime !='' ">
  2414. AND #{periodEndTime} >= cgu.period_time
  2415. </if>
  2416. order by cgu.create_time desc
  2417. </select>
  2418. <select id="listBKUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  2419. resultMap="ClassPeriodStudentVo">
  2420. SELECT
  2421. g.goods_name,
  2422. cgu.create_time,
  2423. g.year as goods_year,
  2424. cet.education_name,
  2425. cpt.project_name,
  2426. m.category_name,
  2427. cb.business_name,
  2428. up.`status` as profile_status
  2429. FROM
  2430. class_grade_user cgu
  2431. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  2432. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  2433. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  2434. LEFT JOIN goods g on og.goods_id = g.goods_id
  2435. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2436. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2437. LEFT JOIN course_business cb ON g.business_id = cb.id
  2438. LEFT JOIN major m ON g.major_id = m.id
  2439. LEFT JOIN user_profile up on cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  2440. where 1=1
  2441. and cgu.`status` =1
  2442. <if test="profileStatus != null and profileStatus != ''">
  2443. AND up.`status` = #{profileStatus}
  2444. </if>
  2445. <if test="periodPlush != null and periodPlush != ''">
  2446. AND cgu.period_plush = #{periodPlush}
  2447. </if>
  2448. <if test="officialStatus != null and officialStatus != ''">
  2449. AND cgu.official_status = #{officialStatus}
  2450. </if>
  2451. <if test="changeGrade != null and changeGrade != ''">
  2452. AND cgu.change_grade = #{changeGrade}
  2453. </if>
  2454. <if test="profileStatus != null and profileStatus != ''">
  2455. AND up.status = #{profileStatus}
  2456. </if>
  2457. <if test="gradeId != null and gradeId !='' ">
  2458. and cgu.grade_id = #{gradeId}
  2459. </if>
  2460. <if test="businessId != null and businessId != ''">
  2461. AND g.business_id = #{businessId}
  2462. </if>
  2463. <if test="projectId != null and projectId != ''">
  2464. AND g.project_id = #{projectId}
  2465. </if>
  2466. <if test="educationTypeId != null and educationTypeId != ''">
  2467. AND g.education_type_id = #{educationTypeId}
  2468. </if>
  2469. <if test="schoolId != null and schoolId != ''">
  2470. AND g.school_id = #{schoolId}
  2471. </if>
  2472. <if test="majorId != null and majorId != ''">
  2473. AND g.major_id = #{majorId}
  2474. </if>
  2475. <if test="periodStatus != null ">
  2476. and cgu.period_status = #{periodStatus}
  2477. </if>
  2478. <if test="classStartTime != null and classStartTime != '' ">
  2479. AND cg.class_start_time >= #{classStartTime}
  2480. </if>
  2481. <if test="classEndTime != null and classEndTime != '' ">
  2482. AND #{classEndTime} >= cg.class_end_time
  2483. </if>
  2484. <if test="studyStatus != null and studyStatus == 1 ">
  2485. and cgu.period_status = -1
  2486. </if>
  2487. <if test="studyStatus != null and studyStatus == 2 ">
  2488. and cgu.period_status != -1
  2489. </if>
  2490. <if test="className != null and className !='' ">
  2491. and cg.class_name like concat('%', #{className}, '%')
  2492. </if>
  2493. <if test="searchKey != null and searchKey != '' ">
  2494. and (u.realname like concat('%', #{searchKey}, '%')
  2495. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  2496. or g.goods_name like concat('%', #{searchKey}, '%')
  2497. or cg.class_name like concat('%', #{searchKey}, '%'))
  2498. </if>
  2499. <if test="userId != null and userId !='' ">
  2500. AND u.user_id = #{userId}
  2501. </if>
  2502. <if test="idCard != null and idCard !='' ">
  2503. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  2504. </if>
  2505. <if test="telphone != null and telphone !='' ">
  2506. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  2507. </if>
  2508. <if test="searchStartTime != null and searchStartTime !='' ">
  2509. AND cgu.create_time >= #{searchStartTime}
  2510. </if>
  2511. <if test="searchEndTime != null and searchEndTime !='' ">
  2512. AND #{searchEndTime} >= cgu.create_time
  2513. </if>
  2514. <if test="periodStartTime != null and periodStartTime !='' ">
  2515. AND cgu.period_time >= #{periodStartTime}
  2516. </if>
  2517. <if test="periodEndTime != null and periodEndTime !='' ">
  2518. AND #{periodEndTime} >= cgu.period_time
  2519. </if>
  2520. order by cgu.create_time desc
  2521. </select>
  2522. <select id="getListUserSubscribe" resultType="com.zhongzheng.modules.user.vo.UserUsbRecordVo" parameterType="com.zhongzheng.modules.user.bo.UserUsbRecordBo">
  2523. SELECT
  2524. us.subscribe_id,
  2525. us.create_time,
  2526. g.goods_name,
  2527. CONCAT(cet.education_name,'-',cb.business_name,cpt.project_name) AS businessName,
  2528. m.category_name AS majorName,
  2529. us.subscribe_status,
  2530. us.apply_site_exam_time AS applyTime,
  2531. us.apply_site_start_time AS applyStarTime,
  2532. us.apply_site_end_time AS applyEndTime,
  2533. us.apply_site_address AS applyAddress,
  2534. '自带文具、身份证' AS remark
  2535. FROM user_subscribe us
  2536. LEFT JOIN order_goods og ON us.order_goods_id = og.order_goods_id
  2537. LEFT JOIN goods g ON og.goods_id = g.goods_id
  2538. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2539. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2540. LEFT JOIN course_business cb ON g.business_id = cb.id
  2541. LEFT JOIN major m ON g.major_id = m.id
  2542. WHERE 1=1 AND us.exam_status = 0
  2543. <if test="userId != null and userId !='' ">
  2544. AND us.user_id = #{userId}
  2545. </if>
  2546. <if test="subStartTime != null and subStartTime !='' ">
  2547. AND us.create_time &gt;= #{subStartTime}
  2548. </if>
  2549. <if test="subEndTime != null and subStartTime !='' ">
  2550. AND us.create_time &lt;= #{subEndTime}
  2551. </if>
  2552. <if test="educationTypeId != null and educationTypeId !='' ">
  2553. AND cet.id = #{educationTypeId}
  2554. </if>
  2555. <if test="businessId != null and businessId !='' ">
  2556. AND cb.id = #{businessId}
  2557. </if>
  2558. <if test="majorId != null and majorId !='' ">
  2559. AND m.id = #{majorId}
  2560. </if>
  2561. <if test="goodsName != null and goodsName !='' ">
  2562. AND g.goods_name like concat('%', #{goodsName}, '%')
  2563. </if>
  2564. <if test="subscribeStatus != null and subscribeStatus == 1">
  2565. AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) &gt; UNIX_TIMESTAMP()
  2566. </if>
  2567. <if test="subscribeStatus != null and subscribeStatus == 2">
  2568. AND us.subscribe_status = #{subscribeStatus}
  2569. </if>
  2570. <if test="subscribeStatus != null and subscribeStatus == 3">
  2571. AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) &lt; UNIX_TIMESTAMP()
  2572. </if>
  2573. <if test="applySiteExamTime != null and applySiteExamTime != '' ">
  2574. and us.apply_site_exam_time = #{applySiteExamTime}
  2575. </if>
  2576. <if test="monthStartTime != null and monthStartTime != '' ">
  2577. and us.apply_site_exam_time &gt;= #{monthStartTime}
  2578. </if>
  2579. <if test="monthEndTime != null and monthEndTime != '' ">
  2580. and us.apply_site_exam_time &lt;= #{monthEndTime}
  2581. </if>
  2582. <if test="applySiteStartTime != null and applySiteStartTime != '' ">
  2583. and us.apply_site_start_time = #{applySiteStartTime}
  2584. </if>
  2585. <if test="applySiteEndTime != null and applySiteEndTime != '' ">
  2586. and us.apply_site_end_time = #{applySiteEndTime}
  2587. </if>
  2588. order by us.create_time DESC
  2589. </select>
  2590. <update id="updateGradeUser" parameterType="com.zhongzheng.modules.grade.domain.ClassGradeUser" >
  2591. update class_grade_user
  2592. <set>
  2593. <if test="sevenPushCheck != null">
  2594. seven_push_check = #{sevenPushCheck},
  2595. </if>
  2596. <if test="sevenPushReason != null ">
  2597. seven_push_reason=#{sevenPushReason},
  2598. </if>
  2599. <if test="updateTime != null ">
  2600. update_time=#{updateTime},
  2601. </if>
  2602. <if test="sevenPushDate != null ">
  2603. seven_push_date=#{sevenPushDate},
  2604. </if>
  2605. </set>
  2606. where id = #{id}
  2607. </update>
  2608. <select id="selectUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  2609. resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
  2610. SELECT
  2611. g.*
  2612. FROM
  2613. class_grade_user g
  2614. WHERE
  2615. 1 = 1
  2616. <if test="id != null ">
  2617. AND g.id = #{id}
  2618. </if>
  2619. <if test="sevenPushReason != null ">
  2620. AND g.seven_push_reason = #{sevenPushReason}
  2621. </if>
  2622. </select>
  2623. <update id="updateListUserNoTenant" parameterType="map" >
  2624. UPDATE class_grade_user SET seven_push_check = 0 WHERE seven_push_check > 2 and
  2625. seven_push_reason = #{sevenPushReason}
  2626. </update>
  2627. </mapper>