ClassGradeUserMapper.xml 91 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159
  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. </resultMap>
  246. <select id="selectUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  247. resultMap="ClassGradeUserVoResult">
  248. SELECT
  249. g.*,
  250. u.user_account,
  251. u.realname,
  252. u.id_card,
  253. u.telphone,
  254. u.sex,
  255. u.edu_level,
  256. u.company_name,
  257. cg.class_name,
  258. cg.official_name,
  259. cg.class_status,
  260. cg.interface_push_id,
  261. cg.class_start_time,
  262. cg.class_end_time,
  263. g.official_status_num,
  264. g.period_time,
  265. g.period_wait_time,
  266. g.period_status
  267. FROM
  268. class_grade_user g
  269. LEFT JOIN `user` u ON g.user_id = u.user_id
  270. LEFT JOIN class_grade cg ON cg.grade_id = g.grade_id
  271. WHERE
  272. 1 = 1
  273. AND g.change_grade = 0
  274. AND g.grade_id = #{gradeId}
  275. AND g.user_id = #{userId}
  276. AND g.order_goods_id = #{orderGoodsId}
  277. </select>
  278. <select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  279. resultMap="ClassGradeUserVoResult">
  280. SELECT
  281. g.*,
  282. u.user_account,
  283. u.realname,
  284. u.id_card,
  285. u.telphone
  286. FROM
  287. class_grade_user g
  288. LEFT JOIN `user` u ON g.user_id = u.user_id
  289. WHERE
  290. 1 = 1
  291. <if test="status != null and status.size()!=0 ">
  292. AND g.status in
  293. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  294. #{item}
  295. </foreach>
  296. </if>
  297. <if test="gradeId != null and gradeId != ''">
  298. AND g.grade_id = #{gradeId}
  299. </if>
  300. <if test="userId != null and userId != ''">
  301. AND g.user_id = #{userId}
  302. </if>
  303. <if test="classStartTime != null or classEndTime != null ">
  304. AND #{classStartTime} BETWEEN g.class_start_time
  305. </if>
  306. order by g.update_time desc
  307. </select>
  308. <select id="listUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  309. resultMap="ClassGradeUserGoodsVoResult">
  310. SELECT
  311. * ,
  312. g.code as goods_code,
  313. g.`year`,
  314. g.goods_name,
  315. (select b.business_name FROM course_business b where b.id = g.business_id) as business_name,
  316. (select b.project_name FROM course_project_type b where b.id = g.project_id) as project_name,
  317. (select b.school_name FROM school b where b.id = g.school_id) as school_name,
  318. (select b.education_name FROM course_education_type b where b.id = g.education_type_id) as education_name,
  319. (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
  320. (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
  321. (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
  322. FROM
  323. class_grade_user u
  324. LEFT JOIN order_goods og on og.order_goods_id = u.order_goods_id
  325. LEFT JOIN goods g on g.goods_id = og.goods_id
  326. where 1=1
  327. <if test="status != null and status.size()!=0 ">
  328. AND u.status in
  329. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  330. #{item}
  331. </foreach>
  332. </if>
  333. <if test="userId != null and userId != ''">
  334. and u.user_id= #{userId}
  335. </if>
  336. order by u.create_time desc
  337. </select>
  338. <select id="listUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  339. resultMap="ClassGradeUserGoodsVoResult">
  340. SELECT
  341. * ,
  342. g.code as goods_code,
  343. g.`year`,
  344. g.goods_name,
  345. (select b.business_name FROM course_business b where b.id = g.business_id) as business_name,
  346. (select b.project_name FROM course_project_type b where b.id = g.project_id) as project_name,
  347. (select b.school_name FROM school b where b.id = g.school_id) as school_name,
  348. (select b.education_name FROM course_education_type b where b.id = g.education_type_id) as education_name,
  349. (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
  350. (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
  351. (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
  352. FROM
  353. class_grade_user u
  354. LEFT JOIN order_goods og on og.order_goods_id = u.order_goods_id
  355. LEFT JOIN goods g on g.goods_id = og.goods_id
  356. where 1=1
  357. <if test="status != null and status.size()!=0 ">
  358. AND u.status in
  359. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  360. #{item}
  361. </foreach>
  362. </if>
  363. <if test="userId != null and userId != ''">
  364. and u.user_id= #{userId}
  365. </if>
  366. order by u.create_time desc
  367. </select>
  368. <select id="listUserVideoRecord" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  369. resultMap="ClassPeriodStudentVo">
  370. SELECT
  371. 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
  372. FROM
  373. user_period up
  374. LEFT JOIN user_period_status ups ON up.id = ups.period_id
  375. LEFT JOIN class_grade cg on up.grade_id = cg.grade_id
  376. LEFT JOIN goods g ON up.goods_id = g.goods_id
  377. LEFT JOIN course_section cs ON up.section_id = cs.section_id
  378. LEFT JOIN `user` u ON up.user_id = u.user_id
  379. WHERE
  380. up.grade_id > 0 and up.type = 1
  381. <if test="businessId != null and businessId != ''">
  382. AND g.business_id = #{businessId}
  383. </if>
  384. <if test="educationTypeId != null and educationTypeId != ''">
  385. AND g.education_type_id = #{educationTypeId}
  386. </if>
  387. <if test="projectId != null and projectId != ''">
  388. AND g.project_id = #{projectId}
  389. </if>
  390. <if test="realname != null and realname != ''">
  391. AND u.realname like concat('%', #{realname}, '%')
  392. </if>
  393. <if test="telphone != null and telphone != ''">
  394. AND u.telphone = #{telphone`,typeHandler=com.zhongzheng.common.type.EncryptHandler`}
  395. </if>
  396. <if test="idCard != null and idCard != ''">
  397. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  398. </if>
  399. <if test="companyName != null and companyName != ''">
  400. AND u.company_name like concat('%', #{companyName}, '%')
  401. </if>
  402. order by up.create_time desc
  403. </select>
  404. <select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  405. resultMap="ClassPeriodStudentVo">
  406. SELECT
  407. u.user_account,
  408. u.user_id,
  409. cgu.`status`,
  410. u.realname,
  411. og.goods_id,
  412. u.id_card,
  413. cgu.grade_id,
  414. u.telphone,
  415. u.one_inch_photos,
  416. up.`status` as profile_status,
  417. g.class_hours as class_hours,
  418. g.study_start_time as study_start_time,
  419. g.study_end_time as study_end_time,
  420. g.goods_name,
  421. g.code as goods_code,
  422. g.stand_price,
  423. cgu.period_status,
  424. cg.class_start_time,
  425. cg.class_end_time,
  426. cg.class_name,
  427. cgu.period_plush,
  428. cgu.period_status_num,
  429. cgu.period_time,
  430. cgu.order_goods_id,
  431. /* IFNULL(ge.exam_num,0) as exam_num, */
  432. <if test="userPhoto != null and userPhoto == 1">
  433. up.key_value,
  434. </if>
  435. cgu.period_wait_time as end_time,
  436. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  437. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  438. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  439. (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
  440. <if test="userPhoto == null">
  441. /* ,(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
  442. 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 */
  443. </if>
  444. FROM
  445. class_grade_user cgu
  446. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  447. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  448. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  449. 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
  450. LEFT JOIN goods g on og.goods_id = g.goods_id
  451. LEFT JOIN course_business cb ON g.business_id = cb.id
  452. /* LEFT JOIN (SELECT
  453. COUNT( m.id ) AS exam_num,
  454. c.goods_id
  455. FROM
  456. course_menu_exam m
  457. LEFT JOIN goods_course c ON m.course_id = c.course_id
  458. where
  459. m.type in (1,3)
  460. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id */
  461. where 1=1
  462. and cgu.`status` =1
  463. and cb.`period_check_sign` = 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. FROM
  1500. course_module_chapter p
  1501. LEFT JOIN course_chapter cc ON p.chapter_id = cc.chapter_id
  1502. LEFT JOIN course_menu m ON m.menu_id = p.module_id
  1503. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  1504. LEFT JOIN course_module cm ON p.module_id = cm.module_id
  1505. WHERE
  1506. gc.goods_id = #{goodsId}
  1507. <if test="moduleId != null and moreCertificateStatus == 2 ">
  1508. AND p.module_id = #{moduleId}
  1509. </if>
  1510. AND m.type = 1 UNION ALL
  1511. SELECT
  1512. cc.chapter_id,
  1513. cc.`name`,
  1514. m.sort,
  1515. 0 as common_sign
  1516. FROM
  1517. course_menu m
  1518. LEFT JOIN course_chapter cc ON m.menu_id = cc.chapter_id
  1519. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  1520. WHERE
  1521. gc.goods_id = #{goodsId}
  1522. <if test="moduleId != null and moreCertificateStatus == 2 ">
  1523. AND 1 = 0
  1524. </if>
  1525. AND m.type = 2)ui
  1526. ORDER BY ui.sort
  1527. </select>
  1528. <select id="selectOfficialInfoCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1529. SELECT
  1530. count(*)
  1531. FROM
  1532. class_grade_user cgu
  1533. WHERE
  1534. cgu.grade_id = #{gradeId}
  1535. AND cgu.official_status = 1
  1536. </select>
  1537. <select id="selectLearnStatusCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1538. SELECT
  1539. count(*)
  1540. FROM
  1541. class_grade_user cgu
  1542. WHERE
  1543. cgu.grade_id = #{gradeId}
  1544. AND cgu.learn_status = 1
  1545. </select>
  1546. <select id="selectOfficialPeriodCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1547. SELECT
  1548. count(*)
  1549. FROM
  1550. class_grade_user cgu
  1551. WHERE
  1552. cgu.grade_id = #{gradeId}
  1553. AND cgu.period_plush = 1
  1554. </select>
  1555. <select id="selectOfficialNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  1556. SELECT
  1557. gu.*
  1558. FROM
  1559. class_grade g
  1560. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  1561. WHERE
  1562. g.interface_push_id > 0
  1563. AND g.official_name IS NOT NULL
  1564. AND g.`status` = 1
  1565. AND gu.`status` = 1
  1566. AND gu.change_grade = 0
  1567. AND IFNULL(gu.official_status,0) != 1
  1568. </select>
  1569. <select id="selectPeriodNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  1570. SELECT
  1571. gu.*
  1572. FROM
  1573. class_grade g
  1574. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  1575. WHERE
  1576. g.interface_period_id > 0
  1577. AND g.`status` = 1
  1578. AND gu.`status` = 1
  1579. AND gu.change_grade = 0
  1580. AND IFNULL( gu.period_plush, 0 ) != 1
  1581. AND gu.period_status = 1
  1582. AND gu.official_status = 1
  1583. </select>
  1584. <select id="selectGoodsGradeList" parameterType="Long" resultMap="ClassGradeUserGoodsVoResult">
  1585. SELECT
  1586. cgg.goods_id,
  1587. cgg.grade_id,
  1588. cgu.user_id,
  1589. cgu.order_goods_id
  1590. FROM
  1591. class_grade_goods cgg
  1592. LEFT JOIN class_grade_user cgu ON cgg.grade_id = cgu.grade_id
  1593. WHERE
  1594. cgg.goods_id = #{goodsId}
  1595. AND cgu.user_id IS NOT NULL
  1596. </select>
  1597. <select id="queryCountList" parameterType="java.lang.Integer" resultMap="ClassGradeUserVoResult">
  1598. SELECT
  1599. cgu.*,
  1600. cg.interface_account_id,
  1601. cg.no_interface_account_id
  1602. FROM
  1603. class_grade_user cgu
  1604. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1605. LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
  1606. LEFT JOIN goods g on og.goods_id = g.goods_id
  1607. WHERE
  1608. cgu.`status` = 1
  1609. and g.project_id = #{projectId}
  1610. and g.business_id = #{businessId}
  1611. <if test="all != null and all == 0">
  1612. and (cg.interface_account_id is not null or cg.no_interface_account_id is not null)
  1613. </if>
  1614. </select>
  1615. <select id="checkFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1616. SELECT
  1617. IFNULL(count(*),0)
  1618. FROM
  1619. class_grade_user cgu
  1620. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1621. LEFT JOIN goods g on og.goods_id = g.goods_id
  1622. LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
  1623. WHERE
  1624. cgu.user_id = #{userId}
  1625. AND cgu.period_status = -1
  1626. AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
  1627. and g.business_id = #{businessId}
  1628. and g.goods_id != #{goodsId}
  1629. AND (
  1630. SELECT
  1631. IFNULL( count(*), 0 )
  1632. FROM
  1633. user_period up
  1634. WHERE
  1635. 1 = 1
  1636. AND up.user_id = cgu.user_id
  1637. AND up.grade_id = cgu.grade_id
  1638. )>0
  1639. </select>
  1640. <select id="getFinishRequiredCourse" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1641. SELECT
  1642. g.goods_id
  1643. FROM
  1644. class_grade_user cgu
  1645. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1646. LEFT JOIN goods g on og.goods_id = g.goods_id
  1647. LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
  1648. WHERE
  1649. cgu.user_id = #{userId}
  1650. AND cgu.period_status = -1
  1651. AND (unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time)
  1652. and g.business_id = #{businessId}
  1653. and g.goods_id != #{goodsId}
  1654. AND (
  1655. SELECT
  1656. IFNULL( count(*), 0 )
  1657. FROM
  1658. user_period up
  1659. WHERE
  1660. 1 = 1
  1661. AND up.user_id = cgu.user_id
  1662. AND up.grade_id = cgu.grade_id
  1663. )>0
  1664. </select>
  1665. <select id="getSevenPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1666. SELECT
  1667. p.create_time
  1668. FROM
  1669. user_study_record usr
  1670. LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
  1671. LEFT JOIN course_module cm ON usr.module_id = cm.module_id
  1672. WHERE
  1673. usr.current_status = 1
  1674. AND usr.user_id = #{userId}
  1675. AND usr.grade_id = #{gradeId}
  1676. AND cm.common_sign = 0
  1677. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1678. AND usr.order_goods_id = #{orderGoodsId}
  1679. </if>
  1680. AND P.create_time IS NOT NULL
  1681. ORDER BY
  1682. P.create_time
  1683. LIMIT 1
  1684. </select>
  1685. <select id="getPeriodStartTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1686. SELECT
  1687. p.create_time
  1688. FROM
  1689. user_study_record usr
  1690. LEFT JOIN user_study_record_photo p ON usr.record_id = p.record_id
  1691. WHERE
  1692. usr.current_status = 1
  1693. AND usr.user_id = #{userId}
  1694. AND usr.grade_id = #{gradeId}
  1695. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1696. AND usr.order_goods_id = #{orderGoodsId}
  1697. </if>
  1698. AND P.create_time IS NOT NULL
  1699. ORDER BY
  1700. P.create_time
  1701. LIMIT 1
  1702. </select>
  1703. <select id="getPeriodEndTime" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="java.lang.Long">
  1704. SELECT
  1705. ups.record_end_time
  1706. FROM
  1707. user_period_status ups
  1708. LEFT JOIN user_period up ON up.id = ups.period_id
  1709. WHERE
  1710. 1 = 1
  1711. AND up.user_id = #{userId}
  1712. AND up.grade_id = #{gradeId}
  1713. <if test="orderGoodsId != null and orderGoodsId !='' ">
  1714. AND up.order_goods_id = #{orderGoodsId}
  1715. </if>
  1716. AND ups.period_status = 1
  1717. ORDER BY
  1718. ups.record_end_time DESC
  1719. LIMIT 1
  1720. </select>
  1721. <select id="getClassInfoByUser" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
  1722. SELECT
  1723. cgu.*
  1724. FROM
  1725. class_grade_user cgu
  1726. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1727. LEFT JOIN goods g ON og.goods_id = g.goods_id
  1728. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  1729. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  1730. LEFT JOIN course_business cb ON g.business_id = cb.id
  1731. WHERE
  1732. cgu.`status` = 1
  1733. AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "继续教育" ) > 0
  1734. AND INSTR( CONCAT( cet.education_name, cb.business_name, cpt.project_name ), "施工现场专业人员" ) > 0
  1735. AND og.`status` = 1
  1736. AND og.refund_status != 2
  1737. AND og.pay_status IN ( 2, 3, 4 )
  1738. AND cgu.period_status != 1
  1739. AND cgu.finish_status = 0
  1740. AND (
  1741. SELECT
  1742. COUNT( usr.record_id )
  1743. FROM
  1744. user_study_record usr
  1745. WHERE
  1746. usr.order_goods_id = cgu.order_goods_id
  1747. AND usr.user_id = cgu.user_id
  1748. AND usr.current_status = 1
  1749. ) > 0
  1750. AND cgu.user_id = #{userId}
  1751. </select>
  1752. <select id="listVideoUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1753. resultMap="ClassPeriodStudentVo">
  1754. SELECT
  1755. u.user_account,
  1756. u.user_id,
  1757. cgu.`status`,
  1758. u.realname,
  1759. og.goods_id,
  1760. u.id_card,
  1761. cgu.grade_id,
  1762. u.telphone,
  1763. u.one_inch_photos,
  1764. g.class_hours as class_hours,
  1765. g.study_start_time as study_start_time,
  1766. g.study_end_time as study_end_time,
  1767. g.goods_name,
  1768. g.code as goods_code,
  1769. g.stand_price,
  1770. g.goods_id,
  1771. cgu.period_status,
  1772. cg.class_start_time,
  1773. cg.class_end_time,
  1774. cg.class_name,
  1775. cgu.period_plush,
  1776. cgu.period_status_num,
  1777. cgu.period_time,
  1778. cgu.order_goods_id,
  1779. IFNULL(ge.exam_num,0) as exam_num,
  1780. cgu.period_wait_time as end_time,
  1781. (SELECT og.seven_year FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as seven_year,
  1782. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  1783. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  1784. (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,
  1785. cet.education_name,
  1786. cpt.project_name,
  1787. m.category_name,
  1788. cb.business_name
  1789. FROM
  1790. class_grade_user cgu
  1791. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1792. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1793. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1794. LEFT JOIN goods g on og.goods_id = g.goods_id
  1795. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  1796. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  1797. LEFT JOIN course_business cb ON g.business_id = cb.id
  1798. LEFT JOIN major m ON g.major_id = m.id
  1799. LEFT JOIN (SELECT
  1800. COUNT( m.id ) AS exam_num,
  1801. c.goods_id
  1802. FROM
  1803. course_menu_exam m
  1804. LEFT JOIN goods_course c ON m.course_id = c.course_id
  1805. where
  1806. m.type in (1,3)
  1807. GROUP BY c.goods_id ) ge on og.goods_id = ge.goods_id
  1808. where 1=1
  1809. and cgu.`status` =1
  1810. <if test="periodPlush != null and periodPlush != ''">
  1811. AND cgu.period_plush = #{periodPlush}
  1812. </if>
  1813. <if test="officialStatus != null and officialStatus != ''">
  1814. AND cgu.official_status = #{officialStatus}
  1815. </if>
  1816. <if test="changeGrade != null and changeGrade != ''">
  1817. AND cgu.change_grade = #{changeGrade}
  1818. </if>
  1819. <if test="profileStatus != null and profileStatus != ''">
  1820. AND up.status = #{profileStatus}
  1821. </if>
  1822. <if test="gradeId != null and gradeId !='' ">
  1823. and cgu.grade_id = #{gradeId}
  1824. </if>
  1825. <if test="businessId != null and businessId != ''">
  1826. AND g.business_id = #{businessId}
  1827. </if>
  1828. <if test="projectId != null and projectId != ''">
  1829. AND g.project_id = #{projectId}
  1830. </if>
  1831. <if test="educationTypeId != null and educationTypeId != ''">
  1832. AND g.education_type_id = #{educationTypeId}
  1833. </if>
  1834. <if test="schoolId != null and schoolId != ''">
  1835. AND g.school_id = #{schoolId}
  1836. </if>
  1837. <if test="majorId != null and majorId != ''">
  1838. AND g.major_id = #{majorId}
  1839. </if>
  1840. <if test="periodStatus != null ">
  1841. and cgu.period_status = #{periodStatus}
  1842. </if>
  1843. <if test="classStartTime != null and classStartTime != '' ">
  1844. AND cg.class_start_time >= #{classStartTime}
  1845. </if>
  1846. <if test="classEndTime != null and classEndTime != '' ">
  1847. AND #{classEndTime} >= cg.class_end_time
  1848. </if>
  1849. <if test="studyStatus != null and studyStatus == 1 ">
  1850. and cgu.period_status = -1
  1851. </if>
  1852. <if test="studyStatus != null and studyStatus == 2 ">
  1853. and cgu.period_status != -1
  1854. </if>
  1855. <if test="className != null and className !='' ">
  1856. and cg.class_name like concat('%', #{className}, '%')
  1857. </if>
  1858. <if test="searchKey != null and searchKey != '' ">
  1859. and (u.realname like concat('%', #{searchKey}, '%')
  1860. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  1861. or g.goods_name like concat('%', #{searchKey}, '%')
  1862. or cg.class_name like concat('%', #{searchKey}, '%'))
  1863. </if>
  1864. <if test="userId != null and userId !='' ">
  1865. AND cgu.user_id = #{userId}
  1866. </if>
  1867. <if test="idCard != null and idCard !='' ">
  1868. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1869. </if>
  1870. <if test="telphone != null and telphone !='' ">
  1871. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1872. </if>
  1873. <if test="searchStartTime != null and searchStartTime != '' ">
  1874. and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND r.create_time >= #{searchStartTime} )>0
  1875. </if>
  1876. <if test="searchEndTime != null and searchEndTime != '' ">
  1877. and (SELECT count(*) FROM user_study_record r where r.order_goods_id = cgu.order_goods_id AND #{searchEndTime} >= r.create_time )>0
  1878. </if>
  1879. <if test="periodStartTime != null and periodStartTime !='' ">
  1880. AND cgu.period_time >=#{periodStartTime}
  1881. </if>
  1882. <if test="periodEndTime != null and periodEndTime !='' ">
  1883. AND #{periodEndTime} >= cgu.period_time
  1884. </if>
  1885. order by cgu.create_time desc
  1886. </select>
  1887. <select id="listBKUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1888. resultMap="ClassPeriodStudentVo">
  1889. SELECT
  1890. g.goods_name,
  1891. cgu.create_time,
  1892. g.year as goods_year,
  1893. cet.education_name,
  1894. cpt.project_name,
  1895. m.category_name,
  1896. cb.business_name,
  1897. up.`status` as profile_status
  1898. FROM
  1899. class_grade_user cgu
  1900. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  1901. LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
  1902. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  1903. LEFT JOIN goods g on og.goods_id = g.goods_id
  1904. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  1905. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  1906. LEFT JOIN course_business cb ON g.business_id = cb.id
  1907. LEFT JOIN major m ON g.major_id = m.id
  1908. LEFT JOIN user_profile up on cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  1909. where 1=1
  1910. and cgu.`status` =1
  1911. <if test="profileStatus != null and profileStatus != ''">
  1912. AND up.`status` = #{profileStatus}
  1913. </if>
  1914. <if test="periodPlush != null and periodPlush != ''">
  1915. AND cgu.period_plush = #{periodPlush}
  1916. </if>
  1917. <if test="officialStatus != null and officialStatus != ''">
  1918. AND cgu.official_status = #{officialStatus}
  1919. </if>
  1920. <if test="changeGrade != null and changeGrade != ''">
  1921. AND cgu.change_grade = #{changeGrade}
  1922. </if>
  1923. <if test="profileStatus != null and profileStatus != ''">
  1924. AND up.status = #{profileStatus}
  1925. </if>
  1926. <if test="gradeId != null and gradeId !='' ">
  1927. and cgu.grade_id = #{gradeId}
  1928. </if>
  1929. <if test="businessId != null and businessId != ''">
  1930. AND g.business_id = #{businessId}
  1931. </if>
  1932. <if test="projectId != null and projectId != ''">
  1933. AND g.project_id = #{projectId}
  1934. </if>
  1935. <if test="educationTypeId != null and educationTypeId != ''">
  1936. AND g.education_type_id = #{educationTypeId}
  1937. </if>
  1938. <if test="schoolId != null and schoolId != ''">
  1939. AND g.school_id = #{schoolId}
  1940. </if>
  1941. <if test="majorId != null and majorId != ''">
  1942. AND g.major_id = #{majorId}
  1943. </if>
  1944. <if test="periodStatus != null ">
  1945. and cgu.period_status = #{periodStatus}
  1946. </if>
  1947. <if test="classStartTime != null and classStartTime != '' ">
  1948. AND cg.class_start_time >= #{classStartTime}
  1949. </if>
  1950. <if test="classEndTime != null and classEndTime != '' ">
  1951. AND #{classEndTime} >= cg.class_end_time
  1952. </if>
  1953. <if test="studyStatus != null and studyStatus == 1 ">
  1954. and cgu.period_status = -1
  1955. </if>
  1956. <if test="studyStatus != null and studyStatus == 2 ">
  1957. and cgu.period_status != -1
  1958. </if>
  1959. <if test="className != null and className !='' ">
  1960. and cg.class_name like concat('%', #{className}, '%')
  1961. </if>
  1962. <if test="searchKey != null and searchKey != '' ">
  1963. and (u.realname like concat('%', #{searchKey}, '%')
  1964. or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
  1965. or g.goods_name like concat('%', #{searchKey}, '%')
  1966. or cg.class_name like concat('%', #{searchKey}, '%'))
  1967. </if>
  1968. <if test="userId != null and userId !='' ">
  1969. AND u.user_id = #{userId}
  1970. </if>
  1971. <if test="idCard != null and idCard !='' ">
  1972. AND u.id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1973. </if>
  1974. <if test="telphone != null and telphone !='' ">
  1975. AND u.telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
  1976. </if>
  1977. <if test="searchStartTime != null and searchStartTime !='' ">
  1978. AND cgu.create_time >= #{searchStartTime}
  1979. </if>
  1980. <if test="searchEndTime != null and searchEndTime !='' ">
  1981. AND #{searchEndTime} >= cgu.create_time
  1982. </if>
  1983. <if test="periodStartTime != null and periodStartTime !='' ">
  1984. AND cgu.period_time >= #{periodStartTime}
  1985. </if>
  1986. <if test="periodEndTime != null and periodEndTime !='' ">
  1987. AND #{periodEndTime} >= cgu.period_time
  1988. </if>
  1989. order by cgu.create_time desc
  1990. </select>
  1991. <select id="getListUserSubscribe" resultType="com.zhongzheng.modules.user.vo.UserUsbRecordVo" parameterType="com.zhongzheng.modules.user.bo.UserUsbRecordBo">
  1992. SELECT
  1993. us.subscribe_id,
  1994. us.create_time,
  1995. g.goods_name,
  1996. CONCAT(cet.education_name,'-',cb.business_name,cpt.project_name) AS businessName,
  1997. m.category_name AS majorName,
  1998. us.subscribe_status,
  1999. us.apply_site_exam_time AS applyTime,
  2000. us.apply_site_start_time AS applyStarTime,
  2001. us.apply_site_end_time AS applyEndTime,
  2002. us.apply_site_address AS applyAddress,
  2003. '自带文具、身份证' AS remark
  2004. FROM user_subscribe us
  2005. LEFT JOIN order_goods og ON us.order_goods_id = og.order_goods_id
  2006. LEFT JOIN goods g ON og.goods_id = g.goods_id
  2007. LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
  2008. LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
  2009. LEFT JOIN course_business cb ON g.business_id = cb.id
  2010. LEFT JOIN major m ON g.major_id = m.id
  2011. WHERE 1=1 AND us.exam_status = 0
  2012. <if test="userId != null and userId !='' ">
  2013. AND us.user_id = #{userId}
  2014. </if>
  2015. <if test="subStartTime != null and subStartTime !='' ">
  2016. AND us.create_time &gt;= #{subStartTime}
  2017. </if>
  2018. <if test="subEndTime != null and subStartTime !='' ">
  2019. AND us.create_time &lt;= #{subEndTime}
  2020. </if>
  2021. <if test="educationTypeId != null and educationTypeId !='' ">
  2022. AND cet.id = #{educationTypeId}
  2023. </if>
  2024. <if test="businessId != null and businessId !='' ">
  2025. AND cb.id = #{businessId}
  2026. </if>
  2027. <if test="majorId != null and majorId !='' ">
  2028. AND m.id = #{majorId}
  2029. </if>
  2030. <if test="goodsName != null and goodsName !='' ">
  2031. AND g.goods_name like concat('%', #{goodsName}, '%')
  2032. </if>
  2033. <if test="subscribeStatus != null and subscribeStatus == 1">
  2034. AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) &gt; UNIX_TIMESTAMP()
  2035. </if>
  2036. <if test="subscribeStatus != null and subscribeStatus == 2">
  2037. AND us.subscribe_status = #{subscribeStatus}
  2038. </if>
  2039. <if test="subscribeStatus != null and subscribeStatus == 3">
  2040. AND us.subscribe_status = 1 AND (TIME_TO_SEC(us.apply_site_end_time) + us.apply_site_exam_time) &lt; UNIX_TIMESTAMP()
  2041. </if>
  2042. <if test="applySiteExamTime != null and applySiteExamTime != '' ">
  2043. and us.apply_site_exam_time = #{applySiteExamTime}
  2044. </if>
  2045. <if test="monthStartTime != null and monthStartTime != '' ">
  2046. and us.apply_site_exam_time &gt;= #{monthStartTime}
  2047. </if>
  2048. <if test="monthEndTime != null and monthEndTime != '' ">
  2049. and us.apply_site_exam_time &lt;= #{monthEndTime}
  2050. </if>
  2051. <if test="applySiteStartTime != null and applySiteStartTime != '' ">
  2052. and us.apply_site_start_time = #{applySiteStartTime}
  2053. </if>
  2054. <if test="applySiteEndTime != null and applySiteEndTime != '' ">
  2055. and us.apply_site_end_time = #{applySiteEndTime}
  2056. </if>
  2057. order by us.create_time DESC
  2058. </select>
  2059. <update id="updateGradeUser" parameterType="com.zhongzheng.modules.grade.domain.ClassGradeUser" >
  2060. update class_grade_user
  2061. <set>
  2062. <if test="sevenPushCheck != null">
  2063. seven_push_check = #{sevenPushCheck},
  2064. </if>
  2065. <if test="sevenPushReason != null ">
  2066. seven_push_reason=#{sevenPushReason},
  2067. </if>
  2068. <if test="updateTime != null ">
  2069. update_time=#{updateTime},
  2070. </if>
  2071. </set>
  2072. where id = #{id}
  2073. </update>
  2074. <select id="selectUserNoTenant" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  2075. resultType="com.zhongzheng.modules.grade.domain.ClassGradeUser">
  2076. SELECT
  2077. g.*
  2078. FROM
  2079. class_grade_user g
  2080. WHERE
  2081. 1 = 1
  2082. AND g.id = #{id}
  2083. </select>
  2084. </mapper>