ClassGradeUserMapper.xml 86 KB

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