ClassGradeUserMapper.xml 90 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135
  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. </resultMap>
  146. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodUserVo" id="ClassPeriodUserVo">
  147. <result property="userId" column="user_id"/>
  148. <result property="studentCode" column="user_account"/>
  149. <result property="realName" column="realname"/>
  150. <result property="oneInchPhotos" column="one_inch_photos"/>
  151. <result property="idCardImg1" column="id_card_img1"/>
  152. <result property="idCardImg2" column="id_card_img2"/>
  153. <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  154. <result property="telPhone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
  155. <result property="secAllNum" column="sec_all_num"/>
  156. <result property="examNum" column="exam_num"/>
  157. <result property="recordNum" column="record_num"/>
  158. <result property="pass" column="pass"/>
  159. <result property="cheat" column="cheat"/>
  160. <result property="pending" column="pending"/>
  161. <result property="examPass" column="exam_pass"/>
  162. <result property="examPending" column="exam_pending"/>
  163. <result property="examCheat" column="exam_cheat"/>
  164. <result property="keyValue" column="key_value"/>
  165. <result property="periodStatus" column="period_status"/>
  166. <result property="studyStartTime" column="study_start_time"/>
  167. <result property="studyEndTime" column="study_end_time"/>
  168. <result property="goodsName" column="goods_name"/>
  169. <result property="className" column="class_name"/>
  170. <result property="classHours" column="class_hours"/>
  171. <result property="orderGoodsId" column="order_goods_id"/>
  172. <result property="classStartTime" column="class_start_time"/>
  173. <result property="classEndTime" column="class_end_time"/>
  174. <result property="officialName" column="official_name"/>
  175. <result property="sevenYear" column="seven_year"/>
  176. <result property="gradeStatus" column="grade_status"/>
  177. <result property="sex" column="sex"/>
  178. </resultMap>
  179. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
  180. <result property="userId" column="user_id"/>
  181. <result property="id" column="id"/>
  182. <result property="typeName" column="type_name"/>
  183. <result property="realName" column="realname"/>
  184. <result property="classHours" column="class_hours"/>
  185. <result property="studyStartTime" column="study_start_time"/>
  186. <result property="status" column="status"/>
  187. <result property="auditTime" column="audit_time"/>
  188. <result property="type" column="type"/>
  189. <result property="sort" column="sort"/>
  190. <result property="courseId" column="course_id"/>
  191. <result property="studyEndTime" column="study_end_time"/>
  192. <result property="durationTime" column="duration_time"/>
  193. <result property="courseSort" column="course_sort"/>
  194. <result property="sectionType" column="section_type"/>
  195. <result property="realLiveStartTime" column="real_live_start_time"/>
  196. <result property="realLiveEndTime" column="real_live_end_time"/>
  197. <result property="realDuration" column="real_duration"/>
  198. <result property="commonSign" column="common_sign"/>
  199. </resultMap>
  200. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodChapterVo" id="ClassPeriodChapterVo">
  201. <result property="userId" column="user_id"/>
  202. <result property="id" column="id"/>
  203. <result property="courseId" column="course_id"/>
  204. <result property="typeName" column="type_name"/>
  205. <result property="realName" column="realname"/>
  206. <result property="classHours" column="class_hours"/>
  207. <result property="studyStartTime" column="study_start_time"/>
  208. <result property="status" column="status"/>
  209. <result property="auditTime" column="audit_time"/>
  210. <result property="type" column="type"/>
  211. <result property="studyEndTime" column="study_end_time"/>
  212. <result property="performance" column="performance"/>
  213. <result property="sort" column="sort"/>
  214. <result property="doType" column="do_type"/>
  215. <result property="moduleId" column="module_id"/>
  216. <result property="commonSign" column="common_sign"/>
  217. </resultMap>
  218. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodSectionVo" id="ClassPeriodSectionVo">
  219. <result property="userId" column="user_id"/>
  220. <result property="id" column="id"/>
  221. <result property="typeName" column="type_name"/>
  222. <result property="realName" column="realname"/>
  223. <result property="classHours" column="class_hours"/>
  224. <result property="durationTime" column="duration_time"/>
  225. <result property="studyStartTime" column="study_start_time"/>
  226. <result property="status" column="status"/>
  227. <result property="auditTime" column="audit_time"/>
  228. <result property="type" column="type"/>
  229. <result property="studyEndTime" column="study_end_time"/>
  230. <result property="auditNum" column="audit_num"/>
  231. <result property="sort" column="sort"/>
  232. <result property="sectionType" column="section_type"/>
  233. <result property="realLiveStartTime" column="real_live_start_time"/>
  234. <result property="realLiveEndTime" column="real_live_end_time"/>
  235. <result property="realDuration" column="real_duration"/>
  236. <result property="recordingUrl" column="recording_url"/>
  237. <result property="doType" column="do_type"/>
  238. <result property="chapterId" column="chapter_id"/>
  239. <result property="moduleId" column="module_id"/>
  240. </resultMap>
  241. <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterVo" id="CourseChapterResultVo">
  242. <result property="chapterId" column="chapter_id"/>
  243. <result property="name" column="name"/>
  244. <result property="commonSign" column="common_sign"/>
  245. <result property="sectionNum" column="section_num"/>
  246. </resultMap>
  247. <select id="selectUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  248. resultMap="ClassGradeUserVoResult">
  249. SELECT
  250. g.*,
  251. u.user_account,
  252. u.realname,
  253. u.id_card,
  254. u.telphone,
  255. u.sex,
  256. u.edu_level,
  257. u.company_name,
  258. cg.class_name,
  259. cg.official_name,
  260. cg.class_status,
  261. cg.interface_push_id,
  262. cg.class_start_time,
  263. cg.class_end_time,
  264. g.official_status_num,
  265. g.period_time,
  266. g.period_wait_time,
  267. g.period_status
  268. FROM
  269. class_grade_user g
  270. LEFT JOIN `user` u ON g.user_id = u.user_id
  271. LEFT JOIN class_grade cg ON cg.grade_id = g.grade_id
  272. WHERE
  273. 1 = 1
  274. AND g.change_grade = 0
  275. AND g.grade_id = #{gradeId}
  276. AND g.user_id = #{userId}
  277. AND g.order_goods_id = #{orderGoodsId}
  278. </select>
  279. <select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  280. resultMap="ClassGradeUserVoResult">
  281. SELECT
  282. g.*,
  283. u.user_account,
  284. u.realname,
  285. u.id_card,
  286. u.telphone
  287. FROM
  288. class_grade_user g
  289. LEFT JOIN `user` u ON g.user_id = u.user_id
  290. WHERE
  291. 1 = 1
  292. <if test="status != null and status.size()!=0 ">
  293. AND g.status in
  294. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  295. #{item}
  296. </foreach>
  297. </if>
  298. <if test="gradeId != null and gradeId != ''">
  299. AND g.grade_id = #{gradeId}
  300. </if>
  301. <if test="userId != null and userId != ''">
  302. AND g.user_id = #{userId}
  303. </if>
  304. <if test="classStartTime != null or classEndTime != null ">
  305. AND #{classStartTime} BETWEEN g.class_start_time
  306. </if>
  307. order by g.update_time desc
  308. </select>
  309. <select id="listUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  310. resultMap="ClassGradeUserGoodsVoResult">
  311. SELECT
  312. * ,
  313. g.code as goods_code,
  314. g.`year`,
  315. g.goods_name,
  316. (select b.business_name FROM course_business b where b.id = g.business_id) as business_name,
  317. (select b.project_name FROM course_project_type b where b.id = g.project_id) as project_name,
  318. (select b.school_name FROM school b where b.id = g.school_id) as school_name,
  319. (select b.education_name FROM course_education_type b where b.id = g.education_type_id) as education_name,
  320. (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
  321. (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
  322. (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
  323. FROM
  324. class_grade_user u
  325. LEFT JOIN order_goods og on og.order_goods_id = u.order_goods_id
  326. LEFT JOIN goods g on g.goods_id = og.goods_id
  327. where 1=1
  328. <if test="status != null and status.size()!=0 ">
  329. AND u.status in
  330. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  331. #{item}
  332. </foreach>
  333. </if>
  334. <if test="userId != null and userId != ''">
  335. and u.user_id= #{userId}
  336. </if>
  337. order by u.create_time desc
  338. </select>
  339. <select id="listUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  340. resultMap="ClassGradeUserGoodsVoResult">
  341. SELECT
  342. * ,
  343. g.code as goods_code,
  344. g.`year`,
  345. g.goods_name,
  346. (select b.business_name FROM course_business b where b.id = g.business_id) as business_name,
  347. (select b.project_name FROM course_project_type b where b.id = g.project_id) as project_name,
  348. (select b.school_name FROM school b where b.id = g.school_id) as school_name,
  349. (select b.education_name FROM course_education_type b where b.id = g.education_type_id) as education_name,
  350. (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
  351. (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
  352. (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
  353. FROM
  354. class_grade_user u
  355. LEFT JOIN order_goods og on og.order_goods_id = u.order_goods_id
  356. LEFT JOIN goods g on g.goods_id = og.goods_id
  357. where 1=1
  358. <if test="status != null and status.size()!=0 ">
  359. AND u.status in
  360. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  361. #{item}
  362. </foreach>
  363. </if>
  364. <if test="userId != null and userId != ''">
  365. and u.user_id= #{userId}
  366. </if>
  367. order by u.create_time desc
  368. </select>
  369. <select id="listUserVideoRecord" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  370. resultMap="ClassPeriodStudentVo">
  371. SELECT
  372. 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
  373. FROM
  374. user_period up
  375. LEFT JOIN user_period_status ups ON up.id = ups.period_id
  376. LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
  377. LEFT JOIN goods g ON up.goods_id = g.goods_id
  378. LEFT JOIN course_section cs ON up.section_id = cs.section_id
  379. LEFT JOIN `user` u ON up.user_id = u.user_id
  380. WHERE
  381. up.grade_id > 0 and up.type = 1
  382. <if test="businessId != null and businessId != ''">
  383. AND g.business_id = #{businessId}
  384. </if>
  385. <if test="educationTypeId != null and educationTypeId != ''">
  386. AND g.education_type_id = #{educationTypeId}
  387. </if>
  388. <if test="projectId != null and projectId != ''">
  389. AND g.project_id = #{projectId}
  390. </if>
  391. <if test="realname != null and realname != ''">
  392. AND u.realname like concat('%', #{realname}, '%')
  393. </if>
  394. <if test="telphone != null and telphone != ''">
  395. AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
  396. </if>
  397. <if test="idCard != null and idCard != ''">
  398. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  399. </if>
  400. <if test="companyName != null and companyName != ''">
  401. AND u.company_name like concat('%', #{companyName}, '%')
  402. </if>
  403. order by up.create_time desc
  404. </select>
  405. <select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  406. resultMap="ClassPeriodStudentVo">
  407. SELECT
  408. u.user_account,
  409. u.user_id,
  410. cgu.`status`,
  411. u.realname,
  412. og.goods_id,
  413. u.id_card,
  414. cgu.grade_id,
  415. u.telphone,
  416. u.one_inch_photos,
  417. up.`status` as profile_status,
  418. g.class_hours as class_hours,
  419. g.study_start_time as study_start_time,
  420. g.study_end_time as study_end_time,
  421. g.goods_name,
  422. g.code as goods_code,
  423. g.stand_price,
  424. cgu.period_status,
  425. cg.class_start_time,
  426. cg.class_end_time,
  427. cg.class_name,
  428. cgu.period_plush,
  429. cgu.period_status_num,
  430. cgu.period_time,
  431. cgu.order_goods_id,
  432. /* IFNULL(ge.exam_num,0) as exam_num, */
  433. <if test="userPhoto != null and userPhoto == 1">
  434. up.key_value,
  435. </if>
  436. cgu.period_wait_time as end_time,
  437. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  438. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  439. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  440. (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
  441. <if test="userPhoto == null">
  442. /* ,(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
  443. 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 */
  444. </if>
  445. FROM
  446. class_grade_user cgu
  447. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  448. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  449. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  450. 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
  451. LEFT JOIN goods g on og.goods_id = g.goods_id
  452. LEFT JOIN course_business cb ON g.business_id = cb.id
  453. /* LEFT JOIN (SELECT
  454. COUNT( m.id ) AS exam_num,
  455. c.goods_id
  456. FROM
  457. course_menu_exam m
  458. LEFT JOIN goods_course c ON m.course_id = c.course_id
  459. where
  460. m.type in (1,3)
  461. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id */
  462. where 1=1
  463. and cgu.`status` =1
  464. <if test="periodPlush != null and periodPlush != ''">
  465. AND cgu.period_plush = #{periodPlush}
  466. </if>
  467. <if test="officialStatus != null and officialStatus != ''">
  468. AND cgu.official_status = #{officialStatus}
  469. </if>
  470. <if test="changeGrade != null and changeGrade != ''">
  471. AND cgu.change_grade = #{changeGrade}
  472. </if>
  473. <if test="profileStatus != null and profileStatus != ''">
  474. AND up.status = #{profileStatus}
  475. </if>
  476. <if test="gradeId != null and gradeId !='' ">
  477. and cgu.grade_id = #{gradeId}
  478. </if>
  479. <if test="businessId != null and businessId != ''">
  480. AND g.business_id = #{businessId}
  481. </if>
  482. <if test="projectId != null and projectId != ''">
  483. AND g.project_id = #{projectId}
  484. </if>
  485. <if test="educationTypeId != null and educationTypeId != ''">
  486. AND g.education_type_id = #{educationTypeId}
  487. </if>
  488. <if test="schoolId != null and schoolId != ''">
  489. AND g.school_id = #{schoolId}
  490. </if>
  491. <if test="majorId != null and majorId != ''">
  492. AND g.major_id = #{majorId}
  493. </if>
  494. <if test="periodStatus != null ">
  495. and cgu.period_status = #{periodStatus}
  496. </if>
  497. <if test="classStartTime != null and classStartTime != '' ">
  498. AND cg.class_start_time >= #{classStartTime}
  499. </if>
  500. <if test="classEndTime != null and classEndTime != '' ">
  501. AND #{classEndTime} >= cg.class_end_time
  502. </if>
  503. <if test="studyStatus != null and studyStatus == 1 ">
  504. and cgu.period_status = -1
  505. </if>
  506. <if test="studyStatus != null and studyStatus == 2 ">
  507. and cgu.period_status != -1
  508. </if>
  509. <if test="className != null and className !='' ">
  510. and cg.class_name like concat('%', #{className}, '%')
  511. </if>
  512. <if test="searchKey != null and searchKey != '' ">
  513. and (u.realname like concat('%', #{searchKey}, '%')
  514. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  515. or g.goods_name like concat('%', #{searchKey}, '%')
  516. or cg.class_name like concat('%', #{searchKey}, '%')
  517. or u.company_name like concat('%', #{searchKey}, '%'))
  518. </if>
  519. <if test="companyName != null and companyName != '' ">
  520. and u.company_name like concat('%', #{companyName}, '%')
  521. </if>
  522. <if test="idCard != null and idCard !='' ">
  523. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  524. </if>
  525. <if test="telphone != null and telphone !='' ">
  526. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  527. </if>
  528. <if test="searchStartTime != null and searchStartTime !='' ">
  529. AND cgu.create_time >=#{searchStartTime}
  530. </if>
  531. <if test="searchEndTime != null and searchEndTime !='' ">
  532. AND #{searchEndTime} >= cgu.create_time
  533. </if>
  534. <if test="periodStartTime != null and periodStartTime !='' ">
  535. AND cgu.period_time >=#{periodStartTime}
  536. </if>
  537. <if test="periodEndTime != null and periodEndTime !='' ">
  538. AND #{periodEndTime} >= cgu.period_time
  539. </if>
  540. <if test="periodStatus != 2 and periodStatus != 3">
  541. order by cgu.update_time desc
  542. </if>
  543. <if test="periodStatus == 2 ">
  544. order by cgu.period_wait_time,cgu.create_time
  545. </if>
  546. <if test="periodStatus == 3 ">
  547. order by cgu.period_ing_time,cgu.create_time
  548. </if>
  549. </select>
  550. <select id="listUserWeekStudyTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  551. resultType="Long">
  552. SELECT
  553. IFNULL( SUM( cs.duration_time ), 0 )
  554. FROM
  555. (
  556. SELECT
  557. section_id
  558. FROM
  559. user_study_record
  560. WHERE
  561. user_id = #{userId}
  562. AND grade_id = #{gradeId}
  563. AND order_goods_id = #{orderGoodsId}
  564. AND current_status = 1
  565. AND `status` = 1
  566. <if test="searchWeekStartTime != null and searchWeekStartTime != '' ">
  567. AND update_time >= #{searchWeekStartTime}
  568. </if>
  569. <if test="searchWeekEndTime != null and searchWeekEndTime != '' ">
  570. AND #{searchWeekEndTime} >= update_time
  571. </if>
  572. GROUP BY
  573. course_id,
  574. module_id,
  575. chapter_id,
  576. section_id
  577. ) usr
  578. LEFT JOIN course_section cs ON usr.section_id = cs.section_id
  579. </select>
  580. <select id="listUserWeekPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  581. resultMap="ClassPeriodStudentVo">
  582. SELECT
  583. u.user_account,
  584. u.user_id,
  585. cgu.`status`,
  586. u.realname,
  587. og.goods_id,
  588. u.id_card,
  589. cgu.grade_id,
  590. u.telphone,
  591. u.one_inch_photos,
  592. up.`status` as profile_status,
  593. g.class_hours as class_hours,
  594. g.study_start_time as study_start_time,
  595. g.study_end_time as study_end_time,
  596. g.goods_name,
  597. g.code as goods_code,
  598. g.stand_price,
  599. cgu.period_status,
  600. cg.class_start_time,
  601. cg.class_end_time,
  602. cg.class_name,
  603. cgu.period_plush,
  604. cgu.period_status_num,
  605. cgu.period_time,
  606. cgu.order_goods_id,
  607. <if test="userPhoto != null and userPhoto == 1">
  608. up.key_value,
  609. </if>
  610. cgu.period_wait_time as end_time
  611. <if test="userPhoto == null">
  612. ,(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
  613. 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
  614. </if>
  615. FROM
  616. class_grade_user cgu
  617. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  618. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  619. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  620. 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
  621. LEFT JOIN goods g on og.goods_id = g.goods_id
  622. LEFT JOIN course_business cb ON g.business_id = cb.id
  623. where 1=1
  624. and cgu.`status` =1
  625. <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
  626. 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
  627. </if>
  628. <if test="periodPlush != null and periodPlush != ''">
  629. AND cgu.period_plush = #{periodPlush}
  630. </if>
  631. <if test="officialStatus != null and officialStatus != ''">
  632. AND cgu.official_status = #{officialStatus}
  633. </if>
  634. <if test="changeGrade != null and changeGrade != ''">
  635. AND cgu.change_grade = #{changeGrade}
  636. </if>
  637. <if test="profileStatus != null and profileStatus != ''">
  638. AND up.status = #{profileStatus}
  639. </if>
  640. <if test="gradeId != null and gradeId !='' ">
  641. and cgu.grade_id = #{gradeId}
  642. </if>
  643. <if test="businessId != null and businessId != ''">
  644. AND g.business_id = #{businessId}
  645. </if>
  646. <if test="educationTypeId != null and educationTypeId != ''">
  647. AND g.education_type_id = #{educationTypeId}
  648. </if>
  649. <if test="schoolId != null and schoolId != ''">
  650. AND g.school_id = #{schoolId}
  651. </if>
  652. <if test="majorId != null and majorId != ''">
  653. AND g.major_id = #{majorId}
  654. </if>
  655. <if test="periodStatus != null ">
  656. and cgu.period_status = #{periodStatus}
  657. </if>
  658. <if test="classStartTime != null and classStartTime != '' ">
  659. AND cg.class_start_time >= #{classStartTime}
  660. </if>
  661. <if test="classEndTime != null and classEndTime != '' ">
  662. AND #{classEndTime} >= cg.class_end_time
  663. </if>
  664. <if test="studyStatus != null and studyStatus == 1 ">
  665. and cgu.period_status = -1
  666. </if>
  667. <if test="studyStatus != null and studyStatus == 2 ">
  668. and cgu.period_status != -1
  669. </if>
  670. <if test="className != null and className !='' ">
  671. and cg.class_name like concat('%', #{className}, '%')
  672. </if>
  673. <if test="searchKey != null and searchKey != '' ">
  674. and (u.realname like concat('%', #{searchKey}, '%') or g.goods_name like concat('%', #{searchKey}, '%') or cg.class_name like concat('%', #{searchKey}, '%'))
  675. </if>
  676. <if test="idCard != null and idCard !='' ">
  677. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  678. </if>
  679. <if test="telphone != null and telphone !='' ">
  680. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  681. </if>
  682. <if test="searchStartTime != null and searchStartTime !='' ">
  683. AND cgu.create_time >=#{searchStartTime}
  684. </if>
  685. <if test="searchEndTime != null and searchEndTime !='' ">
  686. AND #{searchEndTime} >= cgu.create_time
  687. </if>
  688. <if test="periodStartTime != null and periodStartTime !='' ">
  689. AND cgu.period_time >=#{periodStartTime}
  690. </if>
  691. <if test="periodEndTime != null and periodEndTime !='' ">
  692. AND #{periodEndTime} >= cgu.period_time
  693. </if>
  694. <!-- 数据范围过滤 -->
  695. ${params.dataScope}
  696. <if test="periodStatus != 2 and periodStatus != 3">
  697. order by cgu.update_time desc
  698. </if>
  699. <if test="periodStatus == 2 ">
  700. order by cgu.period_wait_time,cgu.create_time
  701. </if>
  702. <if test="periodStatus == 3 ">
  703. order by cgu.period_ing_time,cgu.create_time
  704. </if>
  705. </select>
  706. <select id="listUserPeriodExport" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  707. resultMap="ClassPeriodStudentVo">
  708. SELECT
  709. u.user_account,
  710. u.user_id,
  711. cgu.`status`,
  712. u.realname,
  713. og.goods_id,
  714. u.id_card,
  715. cgu.grade_id,
  716. u.telphone,
  717. g.class_hours as class_hours,
  718. g.study_start_time as study_start_time,
  719. g.study_end_time as study_end_time,
  720. g.goods_name,
  721. g.code as goods_code,
  722. g.stand_price,
  723. cgu.period_status,
  724. cg.class_start_time,
  725. cg.class_end_time,
  726. cg.class_name,
  727. cgu.period_plush,
  728. cgu.period_status_num,
  729. cgu.order_goods_id,
  730. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  731. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  732. <if test="userPhoto != null and userPhoto == 1">
  733. up.key_value,
  734. </if>
  735. cgu.period_time as end_time
  736. FROM
  737. class_grade_user cgu
  738. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  739. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  740. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  741. LEFT JOIN goods g on og.goods_id = g.goods_id
  742. LEFT JOIN course_business cb ON g.business_id = cb.id
  743. 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
  744. where 1=1
  745. <if test="searchWeekStartTime != null and searchWeekEndTime != '' ">
  746. 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
  747. </if>
  748. and cgu.`status` =1
  749. <if test="periodPlush != null and periodPlush != ''">
  750. AND cgu.period_plush = #{periodPlush}
  751. </if>
  752. <if test="officialStatus != null and officialStatus != ''">
  753. AND cgu.official_status = #{officialStatus}
  754. </if>
  755. <if test="changeGrade != null and changeGrade != ''">
  756. AND cgu.change_grade = #{changeGrade}
  757. </if>
  758. <if test="profileStatus != null and profileStatus != ''">
  759. AND up.status = #{profileStatus}
  760. </if>
  761. <if test="gradeId != null and gradeId !='' ">
  762. and cgu.grade_id = #{gradeId}
  763. </if>
  764. <if test="businessId != null and businessId != ''">
  765. AND g.business_id = #{businessId}
  766. </if>
  767. <if test="educationTypeId != null and educationTypeId != ''">
  768. AND g.education_type_id = #{educationTypeId}
  769. </if>
  770. <if test="schoolId != null and schoolId != ''">
  771. AND g.school_id = #{schoolId}
  772. </if>
  773. <if test="majorId != null and majorId != ''">
  774. AND g.major_id = #{majorId}
  775. </if>
  776. <if test="periodStatus != null ">
  777. and cgu.period_status = #{periodStatus}
  778. </if>
  779. <if test="classStartTime != null and classStartTime != '' ">
  780. AND cg.class_start_time >= #{classStartTime}
  781. </if>
  782. <if test="classEndTime != null and classEndTime != '' ">
  783. AND #{classEndTime} >= cg.class_end_time
  784. </if>
  785. <if test="studyStatus != null and studyStatus == 1 ">
  786. and cgu.period_status = -1
  787. </if>
  788. <if test="studyStatus != null and studyStatus == 2 ">
  789. and cgu.period_status != -1
  790. </if>
  791. <if test="searchKey != null and searchKey != '' ">
  792. and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%') or g.goods_name like concat('%', #{searchKey}, '%') or cg.class_name like concat('%', #{searchKey}, '%'))
  793. </if>
  794. <if test="searchStartTime != null and searchStartTime !='' ">
  795. AND cgu.create_time >=#{searchStartTime}
  796. </if>
  797. <if test="searchEndTime != null and searchEndTime !='' ">
  798. AND #{searchEndTime} >= cgu.create_time
  799. </if>
  800. <!-- 数据范围过滤 -->
  801. ${params.dataScope}
  802. <if test="periodStatus != 2 and periodStatus != 3">
  803. order by cgu.update_time desc
  804. </if>
  805. <if test="periodStatus == 2 ">
  806. order by cgu.period_wait_time,cgu.create_time
  807. </if>
  808. <if test="periodStatus == 3 ">
  809. order by cgu.period_ing_time,cgu.create_time
  810. </if>
  811. </select>
  812. <select id="userPeriodStatus" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  813. resultMap="ClassPeriodStudentVo">
  814. SELECT
  815. IFNULL(ge.exam_num,0) as exam_num,
  816. cg.class_start_time,
  817. cg.class_end_time,
  818. g.study_start_time,
  819. g.study_end_time,
  820. (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,
  821. cgu.user_id,
  822. og.goods_id
  823. FROM
  824. class_grade_user cgu
  825. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  826. LEFT JOIN order_goods og on og.order_goods_id=cgu.order_goods_id
  827. LEFT JOIN goods g on g.goods_id=og.goods_id
  828. LEFT JOIN (SELECT
  829. COUNT( m.id ) AS exam_num,
  830. c.goods_id
  831. FROM
  832. course_menu_exam m
  833. LEFT JOIN goods_course c ON m.course_id = c.course_id
  834. where
  835. m.type in (1,3)
  836. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  837. where 1=1
  838. and cgu.`status` =1
  839. <if test="gradeId != null and gradeId !='' ">
  840. and cgu.grade_id = #{gradeId}
  841. </if>
  842. <if test="userId != null ">
  843. and cgu.user_id = #{userId}
  844. </if>
  845. <if test="orderGoodsId != null ">
  846. and cgu.order_goods_id = #{orderGoodsId}
  847. </if>
  848. LIMIT 1
  849. </select>
  850. <select id="listPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  851. resultMap="ClassPeriodUserVo">
  852. SELECT
  853. u.user_account,
  854. u.realname,
  855. u.id_card,
  856. u.user_id,
  857. u.telphone,
  858. u.sex,
  859. g.goods_id,
  860. g.goods_name,
  861. cg.class_name,
  862. cg.official_name,
  863. cg.class_start_time,
  864. cg.class_end_time,
  865. cg.official_name,
  866. cg.status as grade_status,
  867. g.class_hours,
  868. u.one_inch_photos,
  869. u.id_card_img1,
  870. u.id_card_img2,
  871. cgu.period_status,
  872. cgu.order_goods_id,
  873. (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
  874. 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,
  875. (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,
  876. (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
  877. 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,
  878. (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
  879. 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,
  880. (SELECT
  881. 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`
  882. =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,
  883. (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
  884. 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,
  885. (SELECT
  886. 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`
  887. =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,
  888. (SELECT
  889. 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`
  890. =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,
  891. (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,
  892. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year
  893. <if test="userId != null and userId !='' ">
  894. ,(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,
  895. (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
  896. </if>
  897. FROM
  898. class_grade_user cgu
  899. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  900. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  901. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  902. LEFT JOIN goods g ON g.goods_id = og.goods_id
  903. where 1=1
  904. <if test="userId != null and userId !='' ">
  905. and u.user_id = #{userId}
  906. </if>
  907. <if test="gradeId != null and gradeId !='' ">
  908. and cgu.grade_id = #{gradeId}
  909. </if>
  910. <if test="periodStatus != null and periodStatus !='' ">
  911. and cgu.period_status = #{periodStatus}
  912. </if>
  913. <if test="orderGoodsId != null and orderGoodsId !='' ">
  914. and cgu.order_goods_id = #{orderGoodsId}
  915. </if>
  916. LIMIT 1
  917. </select>
  918. <select id="listPeriodAudit" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  919. resultMap="ClassPeriodVo">
  920. SELECT
  921. gc.sort as course_sort,
  922. cm.sort,
  923. cm.menu_id as id,
  924. cm.course_id,
  925. (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  926. and u.user_id = #{userId}
  927. </if>) as realname,
  928. (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  929. and u.user_id = #{userId}
  930. </if>) as user_id,
  931. (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
  932. 0 as common_sign,
  933. (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on
  934. cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
  935. 1 as type,
  936. NULL as study_start_time,
  937. NULL as study_end_time
  938. FROM
  939. course_menu cm
  940. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  941. where 1=1
  942. <if test="goodsId != null and goodsId !='' ">
  943. and gc.goods_id=#{goodsId}
  944. </if>
  945. <if test="courseId != null and courseId !='' ">
  946. and gc.course_id=#{courseId}
  947. </if>
  948. AND cm.type=1
  949. UNION
  950. SELECT
  951. gc.sort as course_sort,
  952. cm.sort,
  953. cm.menu_id as id,
  954. cm.course_id,
  955. (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  956. and u.user_id = #{userId}
  957. </if>) as realname,
  958. (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  959. and u.user_id = #{userId}
  960. </if>) as user_id,
  961. (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
  962. (SELECT cc.common_sign FROM course_chapter cc where cm.menu_id = cc.chapter_id) as common_sign,
  963. (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs where ccs.chapter_id=cm.menu_id) as class_hours,
  964. 2 as type,
  965. (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
  966. 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
  967. limit 1) as study_start_time,
  968. (SELECT usr.update_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
  969. 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
  970. limit 1) as study_end_time
  971. FROM
  972. course_menu cm
  973. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  974. where 1=1
  975. <if test="goodsId != null and goodsId !='' ">
  976. and gc.goods_id=#{goodsId}
  977. </if>
  978. <if test="courseId != null and courseId !='' ">
  979. and gc.course_id=#{courseId}
  980. </if>
  981. AND cm.type=2
  982. </select>
  983. <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  984. resultMap="ClassPeriodVo">
  985. SELECT
  986. gc.sort as course_sort,
  987. cm.sort,
  988. cm.menu_id as id,
  989. cm.course_id,
  990. (SELECT u.realname FROM `user` u where 1=1
  991. <if test="userId != null and userId !='' ">
  992. and u.user_id = #{userId}
  993. </if>
  994. ) as realname,
  995. (SELECT u.user_id FROM `user` u where 1=1
  996. <if test="userId != null and userId !='' ">
  997. and u.user_id = #{userId}
  998. </if>
  999. ) as user_id,
  1000. cs.`name` as type_name,
  1001. cs.duration_time,
  1002. cs.real_live_start_time,
  1003. cs.real_live_end_time,
  1004. cs.real_duration,
  1005. cs.section_type,
  1006. null as class_hours,
  1007. 3 as type
  1008. FROM
  1009. course_menu cm
  1010. LEFT JOIN course_section cs on cm.menu_id = cs.section_id
  1011. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  1012. where 1=1
  1013. <if test="goodsId != null and goodsId !='' ">
  1014. and gc.goods_id = #{goodsId}
  1015. </if>
  1016. <if test="courseId != null ">
  1017. and gc.course_id=#{courseId}
  1018. </if>
  1019. AND cm.type=3
  1020. </select>
  1021. <select id="listPeriodAuditExam" parameterType="map" resultMap="ClassPeriodChapterVo">
  1022. SELECT
  1023. cme.exam_id as id,
  1024. cme.course_id,
  1025. (SELECT u.realname FROM `user` u where 1=1
  1026. <if test="userId != null and userId !='' ">
  1027. and u.user_id = #{userId}
  1028. </if>
  1029. ) as realname,
  1030. (SELECT u.user_id FROM `user` u where 1=1
  1031. <if test="userId != null and userId !='' ">
  1032. and u.user_id = #{userId}
  1033. </if>
  1034. ) as user_id,
  1035. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1036. null as class_hours,
  1037. 4 as type,
  1038. (
  1039. SELECT
  1040. ups.record_start_time
  1041. FROM
  1042. user_period_status ups
  1043. LEFT JOIN user_period up ON up.id = ups.period_id
  1044. WHERE
  1045. period_status = 1
  1046. AND up.course_id = gc.course_id
  1047. <if test="goodsId != null and goodsId !='' ">
  1048. AND up.goods_id = #{goodsId}
  1049. </if>
  1050. and cme.section_id =up.section_id
  1051. AND up.exam_id = cme.exam_id
  1052. ) AS study_start_time,
  1053. (
  1054. SELECT
  1055. ups.record_end_time
  1056. FROM
  1057. user_period_status ups
  1058. LEFT JOIN user_period up ON up.id = ups.period_id
  1059. WHERE
  1060. period_status = 1
  1061. AND up.course_id = gc.course_id
  1062. <if test="goodsId != null and goodsId !='' ">
  1063. AND up.goods_id = #{goodsId}
  1064. </if>
  1065. AND up.exam_id = cme.exam_id
  1066. ) AS study_end_time,
  1067. (
  1068. SELECT
  1069. ups.`status`
  1070. FROM
  1071. user_period_status ups
  1072. LEFT JOIN user_period up ON up.id = ups.period_id
  1073. WHERE
  1074. period_status = 1
  1075. AND up.course_id = gc.course_id
  1076. <if test="goodsId != null and goodsId !='' ">
  1077. AND up.goods_id = #{goodsId}
  1078. </if>
  1079. and cme.section_id =up.section_id
  1080. AND up.exam_id = cme.exam_id
  1081. ) AS STATUS,
  1082. (
  1083. SELECT
  1084. ups.create_time
  1085. FROM
  1086. user_period_status ups
  1087. LEFT JOIN user_period up ON up.id = ups.period_id
  1088. WHERE
  1089. period_status = 1
  1090. AND up.course_id = gc.course_id
  1091. <if test="goodsId != null and goodsId !='' ">
  1092. AND up.goods_id = #{goodsId}
  1093. </if>
  1094. and cme.section_id =up.section_id
  1095. AND up.exam_id = cme.exam_id
  1096. ) AS audit_time,
  1097. (
  1098. SELECT
  1099. COUNT( ups.id )
  1100. FROM
  1101. user_period_status ups
  1102. LEFT JOIN user_period up ON up.id = ups.period_id
  1103. WHERE
  1104. period_status = 1
  1105. AND up.course_id = gc.course_id
  1106. <if test="goodsId != null and goodsId !='' ">
  1107. AND up.goods_id = #{goodsId}
  1108. </if>
  1109. and cme.section_id =up.section_id
  1110. AND up.exam_id = cme.exam_id
  1111. ) AS audit_num
  1112. FROM
  1113. course_menu_exam cme
  1114. LEFT JOIN goods_course gc on gc.course_id = cme.course_id
  1115. LEFT JOIN course_menu cm on cme.section_id = cm.menu_id
  1116. where 1=1
  1117. <if test="goodsId != null and goodsId !='' ">
  1118. and gc.goods_id= #{goodsId}
  1119. </if>
  1120. AND cm.type=3 and cme.chapter_id=0 and cme.module_id=0 and cme.type=1 and cm.type=3
  1121. </select>
  1122. <select id="listperiodChapter" parameterType="map" resultMap="ClassPeriodChapterVo">
  1123. SELECT
  1124. cmc.sort,
  1125. cc.chapter_id as id,
  1126. cc.common_sign,
  1127. cm.course_id,
  1128. ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
  1129. and u.user_id = #{userId}
  1130. </if> LIMIT 1) AS realname,
  1131. ( SELECT u.user_id FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
  1132. and u.user_id = #{userId}
  1133. </if> LIMIT 1) AS user_id,
  1134. cc.`name` as type_name,
  1135. ( SELECT COUNT( ccs.section_id ) FROM course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id ) AS
  1136. class_hours,
  1137. 2 AS type,
  1138. (
  1139. SELECT
  1140. usr.create_time
  1141. FROM
  1142. user_study_record usr
  1143. LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
  1144. WHERE
  1145. ccs.chapter_id = cc.chapter_id
  1146. AND usr.current_status = 1
  1147. <if test="courseId != null ">
  1148. AND usr.course_id=#{courseId}
  1149. </if>
  1150. <if test="moduleId != null">
  1151. AND usr.module_id=#{moduleId}
  1152. </if>
  1153. <if test="goodsId != null and goodsId !='' ">
  1154. AND usr.goods_id=#{goodsId}
  1155. </if>
  1156. <if test="gradeId != null and gradeId !='' ">
  1157. AND usr.grade_id=#{gradeId}
  1158. </if>
  1159. <if test="userId != null and userId !='' ">
  1160. AND usr.user_id=#{userId}
  1161. </if>
  1162. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1163. AND usr.order_goods_id=#{orderGoodsId}
  1164. </if>
  1165. ORDER BY
  1166. usr.create_time ASC
  1167. LIMIT 1
  1168. ) AS study_start_time,
  1169. (
  1170. SELECT
  1171. usr.update_time
  1172. FROM
  1173. user_study_record usr
  1174. LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
  1175. WHERE
  1176. ccs.chapter_id = cc.chapter_id
  1177. AND usr.current_status = 1
  1178. <if test="courseId != null ">
  1179. AND usr.course_id=#{courseId}
  1180. </if>
  1181. <if test="moduleId != null">
  1182. AND usr.module_id=#{moduleId}
  1183. </if>
  1184. <if test="goodsId != null and goodsId !='' ">
  1185. AND usr.goods_id=#{goodsId}
  1186. </if>
  1187. <if test="gradeId != null and gradeId !='' ">
  1188. AND usr.grade_id=#{gradeId}
  1189. </if>
  1190. <if test="userId != null and userId !='' ">
  1191. AND usr.user_id=#{userId}
  1192. </if>
  1193. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1194. AND usr.order_goods_id=#{orderGoodsId}
  1195. </if>
  1196. ORDER BY
  1197. usr.create_time DESC
  1198. LIMIT 1
  1199. ) AS study_end_time,
  1200. (
  1201. SELECT
  1202. ubr.performance
  1203. FROM
  1204. user_bank_record ubr
  1205. LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id and cme.chapter_id = ubr.chapter_id
  1206. WHERE 1=1
  1207. AND ubr.current_status = 1
  1208. AND ubr.report_status = 1
  1209. <if test="moduleId != null ">
  1210. AND ubr.module_id=#{moduleId}
  1211. </if>
  1212. <if test="goodsId != null">
  1213. AND ubr.goods_id=#{goodsId}
  1214. </if>
  1215. <if test="moduleId != null ">
  1216. AND cme.module_id=#{moduleId}
  1217. </if>
  1218. <if test="courseId != null">
  1219. AND cme.course_id =#{courseId}
  1220. </if>
  1221. <if test="userId != null and userId !='' ">
  1222. AND ubr.user_id=#{userId}
  1223. </if>
  1224. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1225. AND ubr.order_goods_id=#{orderGoodsId}
  1226. </if>
  1227. AND cme.chapter_id = cmc.chapter_id
  1228. LIMIT 1 ) AS performance
  1229. FROM
  1230. course_menu cm
  1231. LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id and cm.type = 1
  1232. LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
  1233. WHERE
  1234. 1 = 1
  1235. <if test="moduleId != null ">
  1236. AND cmc.module_id=#{moduleId}
  1237. </if>
  1238. <if test="courseId != null">
  1239. AND cm.course_id =#{courseId}
  1240. </if>
  1241. </select>
  1242. <select id="listperiodExam" parameterType="map" resultMap="ClassPeriodSectionVo">
  1243. SELECT
  1244. cme.exam_id as id,
  1245. cme.course_id,
  1246. e.do_type,
  1247. <if test="userId != null and userId !='' ">
  1248. (SELECT u.realname FROM `user` u where 1=1
  1249. and u.user_id = #{userId}
  1250. ) as realname,
  1251. </if>
  1252. <if test="userId != null and userId !='' ">
  1253. #{userId} as user_id,
  1254. </if>
  1255. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1256. null as class_hours,
  1257. 4 as type,
  1258. cme.chapter_id,
  1259. cme.module_id
  1260. FROM
  1261. course_menu_exam cme
  1262. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1263. WHERE 1=1
  1264. AND cme.type=1
  1265. <if test="courseId != null">
  1266. AND cme.course_id=#{courseId}
  1267. </if>
  1268. <if test="chapterId != null">
  1269. AND cme.chapter_id =#{chapterId}
  1270. </if>
  1271. <if test="moduleId != null">
  1272. AND cme.module_id =#{moduleId}
  1273. </if>
  1274. </select>
  1275. <select id="listperiodModuleExam" parameterType="map" resultMap="ClassPeriodChapterVo">
  1276. SELECT
  1277. cme.exam_id as id,
  1278. cme.course_id,
  1279. e.do_type,
  1280. <if test="userId != null and userId !='' ">
  1281. (SELECT u.realname FROM `user` u where 1=1
  1282. and u.user_id = #{userId}
  1283. ) as realname,
  1284. </if>
  1285. <if test="userId != null and userId !='' ">
  1286. #{userId} as user_id,
  1287. </if>
  1288. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1289. null as class_hours,
  1290. 5 as type,
  1291. cme.module_id
  1292. FROM
  1293. course_menu_exam cme
  1294. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1295. WHERE 1=1
  1296. AND cme.type=3
  1297. <if test="courseId != null">
  1298. AND cme.course_id=#{courseId}
  1299. </if>
  1300. <if test="moduleId != null">
  1301. AND cme.module_id =#{moduleId}
  1302. </if>
  1303. </select>
  1304. <select id="listPeriodSection" parameterType="map" resultMap="ClassPeriodSectionVo">
  1305. SELECT
  1306. ccs.sort,
  1307. cs.section_id AS id,
  1308. #{courseId} AS course_id,
  1309. <if test="userId != null and userId !='' ">
  1310. (SELECT u.realname FROM `user` u where 1=1
  1311. and u.user_id = #{userId}
  1312. ) as realname,
  1313. </if>
  1314. <if test="userId != null and userId !='' ">
  1315. #{userId} as user_id,
  1316. </if>
  1317. cs.NAME AS type_name,
  1318. cs.duration_time,
  1319. cs.section_type,
  1320. cs.real_live_start_time,
  1321. cs.real_live_end_time,
  1322. cs.real_duration,
  1323. NULL AS class_hours,
  1324. cs.recording_url,
  1325. 3 AS type
  1326. FROM
  1327. course_chapter_section ccs
  1328. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  1329. WHERE
  1330. 1 = 1
  1331. <if test="chapterId != null">
  1332. AND ccs.chapter_id = #{chapterId}
  1333. </if>
  1334. ORDER BY
  1335. ccs.sort
  1336. </select>
  1337. <select id="listPeriodSectionExam" parameterType="map" resultMap="ClassPeriodSectionVo">
  1338. SELECT
  1339. cme.exam_id as id,
  1340. cme.course_id,
  1341. (SELECT u.realname FROM `user` u where 1=1
  1342. <if test="userId != null and userId !='' ">
  1343. and u.user_id = #{userId}
  1344. </if>
  1345. ) as realname,
  1346. (SELECT u.user_id FROM `user` u where 1=1
  1347. <if test="userId != null and userId !='' ">
  1348. and u.user_id = #{userId}
  1349. </if>
  1350. ) as user_id,
  1351. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  1352. null as class_hours,
  1353. 4 as type
  1354. FROM
  1355. course_menu_exam cme
  1356. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  1357. WHERE 1=1
  1358. and cme.module_id =0
  1359. and cme.type =1
  1360. <if test="courseId != null">
  1361. AND cme.course_id=#{courseId}
  1362. </if>
  1363. <if test="chapterId != null ">
  1364. AND cme.chapter_id = #{chapterId}
  1365. </if>
  1366. </select>
  1367. <select id="selectStart" parameterType="map" resultType="long">
  1368. SELECT
  1369. rp.create_time
  1370. FROM
  1371. user_study_record_photo rp
  1372. LEFT JOIN user_period_status ups ON rp.period_id = ups.id
  1373. LEFT JOIN user_period up ON up.id = ups.period_id
  1374. WHERE
  1375. 1=1
  1376. <if test="orderGoodsId != null ">
  1377. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1378. </if>
  1379. AND ups.period_status = 1
  1380. AND up.grade_id = #{gradeId}
  1381. AND up.user_id = #{userId}
  1382. ORDER BY
  1383. rp.create_time ASC
  1384. </select>
  1385. <select id="selectStartNoPhoto" parameterType="map" resultType="long">
  1386. SELECT
  1387. ups.record_start_time
  1388. FROM
  1389. user_period_status ups
  1390. LEFT JOIN user_period up ON up.id = ups.period_id
  1391. WHERE
  1392. 1=1
  1393. <if test="orderGoodsId != null ">
  1394. AND (up.order_goods_id = #{orderGoodsId} or up.order_goods_id is null)
  1395. </if>
  1396. AND ups.period_status = 1
  1397. AND up.grade_id = #{gradeId}
  1398. AND up.user_id = #{userId}
  1399. ORDER BY
  1400. ups.record_start_time ASC
  1401. limit 1
  1402. </select>
  1403. <select id="selectEnd" parameterType="map" resultType="long">
  1404. SELECT
  1405. usr.end_time
  1406. FROM
  1407. user_study_record usr
  1408. WHERE
  1409. usr.goods_id = #{goodsId}
  1410. AND usr.grade_id = #{gradeId}
  1411. AND usr.user_id = #{userId} UNION
  1412. SELECT
  1413. ubr.update_time as end_time
  1414. FROM
  1415. user_bank_record ubr
  1416. WHERE
  1417. ubr.goods_id =#{goodsId}
  1418. AND ubr.grade_id = #{gradeId}
  1419. AND ubr.user_id = #{userId}
  1420. ORDER BY end_time DESC
  1421. </select>
  1422. <select id="sendClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1423. SELECT
  1424. cgu.user_id,
  1425. cgu.order_goods_id,
  1426. cg.class_start_time,
  1427. cg.class_end_time,
  1428. og.goods_id,
  1429. cg.grade_id
  1430. FROM
  1431. class_grade_user cgu
  1432. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1433. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1434. LEFT JOIN goods g on og.goods_id = g.goods_id
  1435. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1436. where 1=1
  1437. and irb.remind_id =5
  1438. and cgu.status = 1
  1439. AND unix_timestamp(now()) BETWEEN cg.class_end_time-1728000 and cg.class_end_time-1641600
  1440. </select>
  1441. <select id="checkSendClassGradeUser" parameterType="map" resultType="long">
  1442. 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
  1443. </select>
  1444. <select id="sendTenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1445. SELECT
  1446. cgu.user_id,
  1447. cgu.order_goods_id,
  1448. cg.class_start_time,
  1449. cg.class_end_time,
  1450. og.goods_id,
  1451. cg.grade_id
  1452. FROM
  1453. class_grade_user cgu
  1454. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1455. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1456. LEFT JOIN goods g on og.goods_id = g.goods_id
  1457. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1458. where 1=1
  1459. and irb.remind_id =6
  1460. and cgu.status = 1
  1461. AND unix_timestamp(now()) BETWEEN cg.class_end_time-864000 and cg.class_end_time-777600
  1462. </select>
  1463. <select id="sendFiveClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1464. SELECT
  1465. cgu.user_id,
  1466. cgu.order_goods_id,
  1467. cg.class_start_time,
  1468. cg.class_end_time,
  1469. og.goods_id,
  1470. cg.grade_id
  1471. FROM
  1472. class_grade_user cgu
  1473. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1474. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1475. LEFT JOIN goods g on og.goods_id = g.goods_id
  1476. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1477. where 1=1
  1478. and irb.remind_id =7
  1479. and cgu.status = 1
  1480. AND unix_timestamp(now()) BETWEEN cg.class_end_time-432000 and cg.class_end_time-345600
  1481. </select>
  1482. <select id="selectUserCount" parameterType="com.zhongzheng.modules.user.domain.User" resultType="long">
  1483. SELECT
  1484. COUNT( 1 )
  1485. FROM
  1486. `user`
  1487. WHERE
  1488. id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler} and user_id != #{userId} and `status` = 1
  1489. </select>
  1490. <select id="selectUserCertificate" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1491. resultMap="ClassGradeUserVoResult">
  1492. </select>
  1493. <select id="findChapterList" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="CourseChapterResultVo">
  1494. SELECT ui.* from (SELECT
  1495. cc.chapter_id,
  1496. cc.`name`,
  1497. m.sort,
  1498. cm.common_sign,
  1499. (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
  1500. FROM
  1501. course_module_chapter p
  1502. LEFT JOIN course_chapter cc ON p.chapter_id = cc.chapter_id
  1503. LEFT JOIN course_menu m ON m.menu_id = p.module_id
  1504. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  1505. LEFT JOIN course_module cm ON p.module_id = cm.module_id
  1506. WHERE
  1507. gc.goods_id = #{goodsId}
  1508. <if test="moduleId != null and moreCertificateStatus == 2 ">
  1509. AND p.module_id = #{moduleId}
  1510. </if>
  1511. AND m.type = 1 UNION ALL
  1512. SELECT
  1513. cc.chapter_id,
  1514. cc.`name`,
  1515. m.sort,
  1516. 0 as common_sign,
  1517. (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
  1518. FROM
  1519. course_menu m
  1520. LEFT JOIN course_chapter cc ON m.menu_id = cc.chapter_id
  1521. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  1522. WHERE
  1523. gc.goods_id = #{goodsId}
  1524. <if test="moduleId != null and moreCertificateStatus == 2 ">
  1525. AND 1 = 0
  1526. </if>
  1527. AND m.type = 2)ui
  1528. ORDER BY ui.sort
  1529. </select>
  1530. <select id="selectOfficialInfoCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1531. SELECT
  1532. count(*)
  1533. FROM
  1534. class_grade_user cgu
  1535. WHERE
  1536. cgu.grade_id = #{gradeId}
  1537. AND cgu.official_status = 1
  1538. </select>
  1539. <select id="selectLearnStatusCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1540. SELECT
  1541. count(*)
  1542. FROM
  1543. class_grade_user cgu
  1544. WHERE
  1545. cgu.grade_id = #{gradeId}
  1546. AND cgu.learn_status = 1
  1547. </select>
  1548. <select id="selectOfficialPeriodCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1549. SELECT
  1550. count(*)
  1551. FROM
  1552. class_grade_user cgu
  1553. WHERE
  1554. cgu.grade_id = #{gradeId}
  1555. AND cgu.period_plush = 1
  1556. </select>
  1557. <select id="selectOfficialNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  1558. SELECT
  1559. gu.*
  1560. FROM
  1561. class_grade g
  1562. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  1563. WHERE
  1564. g.interface_push_id > 0
  1565. AND g.official_name IS NOT NULL
  1566. AND g.`status` = 1
  1567. AND gu.`status` = 1
  1568. AND gu.change_grade = 0
  1569. AND IFNULL(gu.official_status,0) != 1
  1570. </select>
  1571. <select id="selectPeriodNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  1572. SELECT
  1573. gu.*
  1574. FROM
  1575. class_grade g
  1576. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  1577. WHERE
  1578. g.interface_period_id > 0
  1579. AND g.`status` = 1
  1580. AND gu.`status` = 1
  1581. AND gu.change_grade = 0
  1582. AND IFNULL( gu.period_plush, 0 ) != 1
  1583. AND gu.period_status = 1
  1584. AND gu.official_status = 1
  1585. </select>
  1586. <select id="selectGoodsGradeList" parameterType="Long" resultMap="ClassGradeUserGoodsVoResult">
  1587. SELECT
  1588. cgg.goods_id,
  1589. cgg.grade_id,
  1590. cgu.user_id,
  1591. cgu.order_goods_id
  1592. FROM
  1593. class_grade_goods cgg
  1594. LEFT JOIN class_grade_user cgu ON cgg.grade_id = cgu.grade_id
  1595. WHERE
  1596. cgg.goods_id = #{goodsId}
  1597. AND cgu.user_id IS NOT NULL
  1598. </select>
  1599. <select id="queryCountList" parameterType="java.lang.Integer" resultMap="ClassGradeUserVoResult">
  1600. SELECT
  1601. cgu.*,
  1602. cg.interface_account_id,
  1603. cg.no_interface_account_id
  1604. FROM
  1605. class_grade_user cgu
  1606. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1607. LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
  1608. LEFT JOIN goods g on og.goods_id = g.goods_id
  1609. WHERE
  1610. cgu.`status` = 1
  1611. and g.project_id = #{projectId}
  1612. and g.business_id = #{businessId}
  1613. <if test="all != null and all == 0">
  1614. and (cg.interface_account_id is not null or cg.no_interface_account_id is not null)
  1615. </if>
  1616. </select>
  1617. <select id="checkFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1618. SELECT
  1619. IFNULL(count(*),0)
  1620. FROM
  1621. class_grade_user cgu
  1622. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1623. LEFT JOIN goods g on og.goods_id = g.goods_id
  1624. LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
  1625. WHERE
  1626. cgu.user_id = #{userId}
  1627. AND cgu.period_status = -1
  1628. AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
  1629. and g.business_id = #{businessId}
  1630. and g.goods_id != #{goodsId}
  1631. AND (
  1632. SELECT
  1633. IFNULL( count(*), 0 )
  1634. FROM
  1635. user_period up
  1636. WHERE
  1637. 1 = 1
  1638. AND up.user_id = cgu.user_id
  1639. AND up.grade_id = cgu.grade_id
  1640. )>0
  1641. </select>
  1642. <select id="getSevenPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1643. SELECT
  1644. p.create_time
  1645. FROM
  1646. user_study_record usr
  1647. LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
  1648. LEFT JOIN course_module cm ON usr.module_id = cm.module_id
  1649. WHERE
  1650. usr.current_status = 1
  1651. AND usr.user_id = #{userId}
  1652. AND usr.grade_id = #{gradeId}
  1653. AND cm.common_sign = 0
  1654. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1655. AND usr.order_goods_id = #{orderGoodsId}
  1656. </if>
  1657. AND P.create_time IS NOT NULL
  1658. ORDER BY
  1659. P.create_time
  1660. LIMIT 1
  1661. </select>
  1662. <select id="getPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1663. SELECT
  1664. p.create_time
  1665. FROM
  1666. user_study_record usr
  1667. LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
  1668. WHERE
  1669. usr.current_status = 1
  1670. AND usr.user_id = #{userId}
  1671. AND usr.grade_id = #{gradeId}
  1672. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1673. AND usr.order_goods_id = #{orderGoodsId}
  1674. </if>
  1675. AND P.create_time IS NOT NULL
  1676. ORDER BY
  1677. P.create_time
  1678. LIMIT 1
  1679. </select>
  1680. <select id="getPeriodEndTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1681. SELECT
  1682. ups.record_end_time
  1683. FROM
  1684. user_period_status ups
  1685. LEFT JOIN user_period up ON up.id = ups.period_id
  1686. WHERE
  1687. 1 = 1
  1688. AND up.user_id = #{userId}
  1689. AND up.grade_id = #{gradeId}
  1690. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1691. AND up.order_goods_id = #{orderGoodsId}
  1692. </if>
  1693. AND ups.period_status = 1
  1694. ORDER BY
  1695. ups.record_end_time DESC
  1696. LIMIT 1
  1697. </select>
  1698. <select id="getClassInfoByUser" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
  1699. SELECT
  1700. cgu.*
  1701. FROM
  1702. class_grade_user cgu
  1703. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1704. LEFT JOIN goods g ON og.goods_id = g.goods_id
  1705. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  1706. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  1707. LEFT JOIN course_business cb ON g.business_id = cb.id
  1708. WHERE
  1709. cgu.`status` = 1
  1710. AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "继续教育" ) > 0
  1711. AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "施工现场专业人员" ) > 0
  1712. AND og.`status` = 1
  1713. AND og.refund_status != 2
  1714. AND og.pay_status IN ( 2, 3, 4 )
  1715. AND cgu.period_status != 1
  1716. AND cgu.finish_status = 0
  1717. AND (
  1718. SELECT
  1719. COUNT( usr.record_id )
  1720. FROM
  1721. user_study_record usr
  1722. WHERE
  1723. usr.order_goods_id = cgu.order_goods_id
  1724. AND usr.user_id = cgu.user_id
  1725. AND usr.current_status = 1
  1726. ) > 0
  1727. AND cgu.user_id = #{userId}
  1728. </select>
  1729. <select id="listVideoUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1730. resultMap="ClassPeriodStudentVo">
  1731. SELECT
  1732. u.user_account,
  1733. u.user_id,
  1734. cgu.`status`,
  1735. u.realname,
  1736. og.goods_id,
  1737. u.id_card,
  1738. cgu.grade_id,
  1739. u.telphone,
  1740. u.one_inch_photos,
  1741. g.class_hours as class_hours,
  1742. g.study_start_time as study_start_time,
  1743. g.study_end_time as study_end_time,
  1744. g.goods_name,
  1745. g.code as goods_code,
  1746. g.stand_price,
  1747. g.goods_id,
  1748. cgu.period_status,
  1749. cg.class_start_time,
  1750. cg.class_end_time,
  1751. cg.class_name,
  1752. cgu.period_plush,
  1753. cgu.period_status_num,
  1754. cgu.period_time,
  1755. cgu.order_goods_id,
  1756. IFNULL(ge.exam_num,0) as exam_num,
  1757. cgu.period_wait_time as end_time,
  1758. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  1759. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  1760. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  1761. (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,
  1762. cet.education_name,
  1763. cpt.project_name,
  1764. m.category_name,
  1765. cb.business_name
  1766. FROM
  1767. class_grade_user cgu
  1768. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1769. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1770. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1771. LEFT JOIN goods g on og.goods_id = g.goods_id
  1772. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  1773. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  1774. LEFT JOIN course_business cb ON g.business_id = cb.id
  1775. LEFT JOIN major m ON g.major_id = m.id
  1776. LEFT JOIN (SELECT
  1777. COUNT( m.id ) AS exam_num,
  1778. c.goods_id
  1779. FROM
  1780. course_menu_exam m
  1781. LEFT JOIN goods_course c ON m.course_id = c.course_id
  1782. where
  1783. m.type in (1,3)
  1784. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  1785. where 1=1
  1786. and cgu.`status` =1
  1787. <if test="periodPlush != null and periodPlush != ''">
  1788. AND cgu.period_plush = #{periodPlush}
  1789. </if>
  1790. <if test="officialStatus != null and officialStatus != ''">
  1791. AND cgu.official_status = #{officialStatus}
  1792. </if>
  1793. <if test="changeGrade != null and changeGrade != ''">
  1794. AND cgu.change_grade = #{changeGrade}
  1795. </if>
  1796. <if test="profileStatus != null and profileStatus != ''">
  1797. AND up.status = #{profileStatus}
  1798. </if>
  1799. <if test="gradeId != null and gradeId !='' ">
  1800. and cgu.grade_id = #{gradeId}
  1801. </if>
  1802. <if test="businessId != null and businessId != ''">
  1803. AND g.business_id = #{businessId}
  1804. </if>
  1805. <if test="projectId != null and projectId != ''">
  1806. AND g.project_id = #{projectId}
  1807. </if>
  1808. <if test="educationTypeId != null and educationTypeId != ''">
  1809. AND g.education_type_id = #{educationTypeId}
  1810. </if>
  1811. <if test="schoolId != null and schoolId != ''">
  1812. AND g.school_id = #{schoolId}
  1813. </if>
  1814. <if test="majorId != null and majorId != ''">
  1815. AND g.major_id = #{majorId}
  1816. </if>
  1817. <if test="periodStatus != null ">
  1818. and cgu.period_status = #{periodStatus}
  1819. </if>
  1820. <if test="classStartTime != null and classStartTime != '' ">
  1821. AND cg.class_start_time >= #{classStartTime}
  1822. </if>
  1823. <if test="classEndTime != null and classEndTime != '' ">
  1824. AND #{classEndTime} >= cg.class_end_time
  1825. </if>
  1826. <if test="studyStatus != null and studyStatus == 1 ">
  1827. and cgu.period_status = -1
  1828. </if>
  1829. <if test="studyStatus != null and studyStatus == 2 ">
  1830. and cgu.period_status != -1
  1831. </if>
  1832. <if test="className != null and className !='' ">
  1833. and cg.class_name like concat('%', #{className}, '%')
  1834. </if>
  1835. <if test="searchKey != null and searchKey != '' ">
  1836. and (u.realname like concat('%', #{searchKey}, '%')
  1837. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  1838. or g.goods_name like concat('%', #{searchKey}, '%')
  1839. or cg.class_name like concat('%', #{searchKey}, '%'))
  1840. </if>
  1841. <if test="userId != null and userId !='' ">
  1842. AND cgu.user_id = #{userId}
  1843. </if>
  1844. <if test="idCard != null and idCard !='' ">
  1845. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1846. </if>
  1847. <if test="telphone != null and telphone !='' ">
  1848. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1849. </if>
  1850. <if test="searchStartTime != null and searchStartTime != '' ">
  1851. and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND r.create_time >= #{searchStartTime} )>0
  1852. </if>
  1853. <if test="searchEndTime != null and searchEndTime != '' ">
  1854. and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND #{searchEndTime} >= r.create_time )>0
  1855. </if>
  1856. <if test="periodStartTime != null and periodStartTime !='' ">
  1857. AND cgu.period_time >=#{periodStartTime}
  1858. </if>
  1859. <if test="periodEndTime != null and periodEndTime !='' ">
  1860. AND #{periodEndTime} >= cgu.period_time
  1861. </if>
  1862. order by cgu.create_time desc
  1863. </select>
  1864. <select id="listBKUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1865. resultMap="ClassPeriodStudentVo">
  1866. SELECT
  1867. g.goods_name,
  1868. cgu.create_time,
  1869. g.year as goods_year,
  1870. cet.education_name,
  1871. cpt.project_name,
  1872. m.category_name,
  1873. cb.business_name,
  1874. up.`status` as profile_status
  1875. FROM
  1876. class_grade_user cgu
  1877. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1878. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1879. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1880. LEFT JOIN goods g on og.goods_id = g.goods_id
  1881. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  1882. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  1883. LEFT JOIN course_business cb ON g.business_id = cb.id
  1884. LEFT JOIN major m ON g.major_id = m.id
  1885. LEFT JOIN user_profile up on cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  1886. where 1=1
  1887. and cgu.`status` =1
  1888. <if test="profileStatus != null and profileStatus != ''">
  1889. AND up.`status` = #{profileStatus}
  1890. </if>
  1891. <if test="periodPlush != null and periodPlush != ''">
  1892. AND cgu.period_plush = #{periodPlush}
  1893. </if>
  1894. <if test="officialStatus != null and officialStatus != ''">
  1895. AND cgu.official_status = #{officialStatus}
  1896. </if>
  1897. <if test="changeGrade != null and changeGrade != ''">
  1898. AND cgu.change_grade = #{changeGrade}
  1899. </if>
  1900. <if test="profileStatus != null and profileStatus != ''">
  1901. AND up.status = #{profileStatus}
  1902. </if>
  1903. <if test="gradeId != null and gradeId !='' ">
  1904. and cgu.grade_id = #{gradeId}
  1905. </if>
  1906. <if test="businessId != null and businessId != ''">
  1907. AND g.business_id = #{businessId}
  1908. </if>
  1909. <if test="projectId != null and projectId != ''">
  1910. AND g.project_id = #{projectId}
  1911. </if>
  1912. <if test="educationTypeId != null and educationTypeId != ''">
  1913. AND g.education_type_id = #{educationTypeId}
  1914. </if>
  1915. <if test="schoolId != null and schoolId != ''">
  1916. AND g.school_id = #{schoolId}
  1917. </if>
  1918. <if test="majorId != null and majorId != ''">
  1919. AND g.major_id = #{majorId}
  1920. </if>
  1921. <if test="periodStatus != null ">
  1922. and cgu.period_status = #{periodStatus}
  1923. </if>
  1924. <if test="classStartTime != null and classStartTime != '' ">
  1925. AND cg.class_start_time >= #{classStartTime}
  1926. </if>
  1927. <if test="classEndTime != null and classEndTime != '' ">
  1928. AND #{classEndTime} >= cg.class_end_time
  1929. </if>
  1930. <if test="studyStatus != null and studyStatus == 1 ">
  1931. and cgu.period_status = -1
  1932. </if>
  1933. <if test="studyStatus != null and studyStatus == 2 ">
  1934. and cgu.period_status != -1
  1935. </if>
  1936. <if test="className != null and className !='' ">
  1937. and cg.class_name like concat('%', #{className}, '%')
  1938. </if>
  1939. <if test="searchKey != null and searchKey != '' ">
  1940. and (u.realname like concat('%', #{searchKey}, '%')
  1941. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  1942. or g.goods_name like concat('%', #{searchKey}, '%')
  1943. or cg.class_name like concat('%', #{searchKey}, '%'))
  1944. </if>
  1945. <if test="userId != null and userId !='' ">
  1946. AND u.user_id = #{userId}
  1947. </if>
  1948. <if test="idCard != null and idCard !='' ">
  1949. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1950. </if>
  1951. <if test="telphone != null and telphone !='' ">
  1952. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1953. </if>
  1954. <if test="searchStartTime != null and searchStartTime !='' ">
  1955. AND cgu.create_time >= #{searchStartTime}
  1956. </if>
  1957. <if test="searchEndTime != null and searchEndTime !='' ">
  1958. AND #{searchEndTime} >= cgu.create_time
  1959. </if>
  1960. <if test="periodStartTime != null and periodStartTime !='' ">
  1961. AND cgu.period_time >= #{periodStartTime}
  1962. </if>
  1963. <if test="periodEndTime != null and periodEndTime !='' ">
  1964. AND #{periodEndTime} >= cgu.period_time
  1965. </if>
  1966. order by cgu.create_time desc
  1967. </select>
  1968. <select id="getListUserSubscribe" resultType="com.zhongzheng.modules.user.vo.UserUsbRecordVo" parameterType="com.zhongzheng.modules.user.bo.UserUsbRecordBo">
  1969. SELECT
  1970. us.subscribe_id,
  1971. us.create_time,
  1972. g.goods_name,
  1973. CONCAT(cet.education_name,'-',cb.business_name,cpt.project_name) AS businessName,
  1974. m.category_name AS majorName,
  1975. us.subscribe_status,
  1976. us.apply_site_exam_time AS applyTime,
  1977. us.apply_site_start_time AS applyStarTime,
  1978. us.apply_site_end_time AS applyEndTime,
  1979. us.apply_site_address AS applyAddress,
  1980. '自带文具、身份证' AS remark
  1981. FROM user_subscribe us
  1982. LEFT JOIN order_goods og ON us.order_goods_id = og.order_goods_id
  1983. LEFT JOIN goods g ON og.goods_id = g.goods_id
  1984. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  1985. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  1986. LEFT JOIN course_business cb ON g.business_id = cb.id
  1987. LEFT JOIN major m ON g.major_id = m.id
  1988. WHERE 1=1 AND us.exam_status = 0
  1989. <if test="userId != null and userId !='' ">
  1990. AND us.user_id = #{userId}
  1991. </if>
  1992. <if test="subStartTime != null and subStartTime !='' ">
  1993. AND us.create_time &gt;= #{subStartTime}
  1994. </if>
  1995. <if test="subEndTime != null and subStartTime !='' ">
  1996. AND us.create_time &lt;= #{subEndTime}
  1997. </if>
  1998. <if test="educationTypeId != null and educationTypeId !='' ">
  1999. AND cet.id = #{educationTypeId}
  2000. </if>
  2001. <if test="businessId != null and businessId !='' ">
  2002. AND cb.id = #{businessId}
  2003. </if>
  2004. <if test="majorId != null and majorId !='' ">
  2005. AND m.id = #{majorId}
  2006. </if>
  2007. <if test="goodsName != null and goodsName !='' ">
  2008. AND g.goods_name like concat('%', #{goodsName}, '%')
  2009. </if>
  2010. <if test="subscribeStatus != null and subscribeStatus == 1">
  2011. AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) &gt; UNIX_TIMESTAMP()
  2012. </if>
  2013. <if test="subscribeStatus != null and subscribeStatus == 2">
  2014. AND us.subscribe_status = #{subscribeStatus}
  2015. </if>
  2016. <if test="subscribeStatus != null and subscribeStatus == 3">
  2017. AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) &lt; UNIX_TIMESTAMP()
  2018. </if>
  2019. <if test="applySiteExamTime != null and applySiteExamTime != '' ">
  2020. and us.apply_site_exam_time = #{applySiteExamTime}
  2021. </if>
  2022. <if test="monthStartTime != null and monthStartTime != '' ">
  2023. and us.apply_site_exam_time &gt;= #{monthStartTime}
  2024. </if>
  2025. <if test="monthEndTime != null and monthEndTime != '' ">
  2026. and us.apply_site_exam_time &lt;= #{monthEndTime}
  2027. </if>
  2028. <if test="applySiteStartTime != null and applySiteStartTime != '' ">
  2029. and us.apply_site_start_time = #{applySiteStartTime}
  2030. </if>
  2031. <if test="applySiteEndTime != null and applySiteEndTime != '' ">
  2032. and us.apply_site_end_time = #{applySiteEndTime}
  2033. </if>
  2034. order by us.create_time DESC
  2035. </select>
  2036. <update id="updateGradeUser" parameterType="com.zhongzheng.modules.grade.domain.ClassGradeUser" >
  2037. update class_grade_user
  2038. <set>
  2039. <if test="sevenPushCheck != null">
  2040. seven_push_check = #{sevenPushCheck},
  2041. </if>
  2042. <if test="sevenPushReason != null ">
  2043. seven_push_reason=#{sevenPushReason},
  2044. </if>
  2045. <if test="updateTime != null ">
  2046. update_time=#{updateTime},
  2047. </if>
  2048. </set>
  2049. where id = #{id}
  2050. </update>
  2051. <select id="selectUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  2052. resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
  2053. SELECT
  2054. g.*
  2055. FROM
  2056. class_grade_user g
  2057. WHERE
  2058. 1 = 1
  2059. AND g.id = #{id}
  2060. </select>
  2061. </mapper>