ClassGradeUserMapper.xml 92 KB

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