ClassGradeUserMapper.xml 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172
  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. </resultMap>
  33. <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeUserVo" id="ClassGradeUserVoResult">
  34. <result property="id" column="id"/>
  35. <result property="userId" column="user_id"/>
  36. <result property="gradeId" column="grade_id"/>
  37. <result property="className" column="class_name"/>
  38. <result property="status" column="status"/>
  39. <result property="code" column="user_account"/>
  40. <result property="realName" column="realname"/>
  41. <result property="idCard" column="id_card"/>
  42. <result property="createBy" column="create_by"/>
  43. <result property="telPhone" column="telphone"/>
  44. <result property="changeGrade" column="change_grade"/>
  45. <result property="interfacePushId" column="interface_push_id"/>
  46. <result property="classStatus" column="class_status"/>
  47. <result property="officialName" column="official_name"/>
  48. <result property="classStartTime" column="class_start_time"/>
  49. <result property="classEndTime" column="class_end_time"/>
  50. <result property="officialStatusNum" column="official_status_num"/>
  51. <result property="periodTime" column="period_time"/>
  52. <result property="periodWaitTime" column="period_wait_time"/>
  53. <result property="periodStatus" column="period_status"/>
  54. <result property="periodStatusNum" column="period_status_num"/>
  55. <result property="periodIngTime" column="period_ing_time"/>
  56. </resultMap>
  57. <resultMap type="com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo" id="ClassGradeUserGoodsVoResult">
  58. <result property="id" column="id"/>
  59. <result property="userId" column="user_id"/>
  60. <result property="gradeId" column="grade_id"/>
  61. <result property="status" column="status"/>
  62. <result property="goodsCode" column="goods_code"/>
  63. <result property="goodsName" column="goods_name"/>
  64. <result property="gradeStatus" column="grade_status"/>
  65. <result property="gradeCode" column="grade_code"/>
  66. <result property="gradeName" column="grade_name"/>
  67. <result property="year" column="year"/>
  68. <result property="educationName" column="education_name"/>
  69. <result property="projectName" column="project_name"/>
  70. <result property="businessName" column="business_name"/>
  71. <result property="schoolName" column="school_name"/>
  72. <result property="createTime" column="create_time"/>
  73. <result property="createBy" column="create_by"/>
  74. <result property="goodsId" column="goods_id"/>
  75. <result property="classStartTime" column="class_start_time"/>
  76. <result property="classEndTime" column="class_end_time"/>
  77. </resultMap>
  78. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodStudentVo" id="ClassPeriodStudentVo">
  79. <result property="userId" column="user_id"/>
  80. <result property="gradeId" column="grade_id"/>
  81. <result property="studentCode" column="user_account"/>
  82. <result property="realName" column="realname"/>
  83. <result property="idCard" column="id_card"/>
  84. <result property="telPhone" column="telphone"/>
  85. <result property="status" column="status"/>
  86. <result property="classHours" column="class_hours"/>
  87. <result property="periodStatus" column="period_status"/>
  88. <result property="secAllNum" column="sec_all_num"/>
  89. <result property="examNum" column="exam_num"/>
  90. <result property="recordNum" column="record_num"/>
  91. <result property="periodPlush" column="period_plush"/>
  92. <result property="startTime" column="start_time"/>
  93. <result property="endTime" column="end_time"/>
  94. <result property="studyStartTime" column="study_start_time"/>
  95. <result property="studyEndTime" column="study_end_time"/>
  96. <result property="rebuildNum" column="rebuild_num"/>
  97. <result property="profileStatus" column="profile_status"/>
  98. <result property="className" column="class_name"/>
  99. <result property="goodsName" column="goods_name"/>
  100. <result property="standPrice" column="stand_price"/>
  101. <result property="goodsCode" column="goods_code"/>
  102. <result property="keyValue" column="key_value"/>
  103. <result property="classStartTime" column="class_start_time"/>
  104. <result property="classEndTime" column="class_end_time"/>
  105. <result property="periodStatusNum" column="period_status_num"/>
  106. <result property="serviceStartTime" column="service_start_time"/>
  107. <result property="serviceEndTime" column="service_end_time"/>
  108. </resultMap>
  109. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodUserVo" id="ClassPeriodUserVo">
  110. <result property="userId" column="user_id"/>
  111. <result property="studentCode" column="user_account"/>
  112. <result property="realName" column="realname"/>
  113. <result property="oneInchPhotos" column="one_inch_photos"/>
  114. <result property="idCardImg1" column="id_card_img1"/>
  115. <result property="idCardImg2" column="id_card_img2"/>
  116. <result property="idCard" column="id_card"/>
  117. <result property="telPhone" column="telphone"/>
  118. <result property="secAllNum" column="sec_all_num"/>
  119. <result property="examNum" column="exam_num"/>
  120. <result property="recordNum" column="record_num"/>
  121. <result property="pass" column="pass"/>
  122. <result property="cheat" column="cheat"/>
  123. <result property="pending" column="pending"/>
  124. <result property="examPass" column="exam_pass"/>
  125. <result property="examPending" column="exam_pending"/>
  126. <result property="examCheat" column="exam_cheat"/>
  127. <result property="keyValue" column="key_value"/>
  128. <result property="periodStatus" column="period_status"/>
  129. <result property="studyStartTime" column="study_start_time"/>
  130. <result property="studyEndTime" column="study_end_time"/>
  131. </resultMap>
  132. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodVo" id="ClassPeriodVo">
  133. <result property="userId" column="user_id"/>
  134. <result property="id" column="id"/>
  135. <result property="typeName" column="type_name"/>
  136. <result property="realName" column="realname"/>
  137. <result property="classHours" column="class_hours"/>
  138. <result property="studyStartTime" column="study_start_time"/>
  139. <result property="status" column="status"/>
  140. <result property="auditTime" column="audit_time"/>
  141. <result property="type" column="type"/>
  142. <result property="sort" column="sort"/>
  143. <result property="courseId" column="course_id"/>
  144. <result property="studyEndTime" column="study_end_time"/>
  145. <result property="durationTime" column="duration_time"/>
  146. <result property="courseSort" column="course_sort"/>
  147. </resultMap>
  148. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodChapterVo" id="ClassPeriodChapterVo">
  149. <result property="userId" column="user_id"/>
  150. <result property="id" column="id"/>
  151. <result property="courseId" column="course_id"/>
  152. <result property="typeName" column="type_name"/>
  153. <result property="realName" column="realname"/>
  154. <result property="classHours" column="class_hours"/>
  155. <result property="studyStartTime" column="study_start_time"/>
  156. <result property="status" column="status"/>
  157. <result property="auditTime" column="audit_time"/>
  158. <result property="type" column="type"/>
  159. <result property="studyEndTime" column="study_end_time"/>
  160. <result property="performance" column="performance"/>
  161. <result property="sort" column="sort"/>
  162. </resultMap>
  163. <resultMap type="com.zhongzheng.modules.grade.vo.ClassPeriodSectionVo" id="ClassPeriodSectionVo">
  164. <result property="userId" column="user_id"/>
  165. <result property="id" column="id"/>
  166. <result property="typeName" column="type_name"/>
  167. <result property="realName" column="realname"/>
  168. <result property="classHours" column="class_hours"/>
  169. <result property="durationTime" column="duration_time"/>
  170. <result property="studyStartTime" column="study_start_time"/>
  171. <result property="status" column="status"/>
  172. <result property="auditTime" column="audit_time"/>
  173. <result property="type" column="type"/>
  174. <result property="studyEndTime" column="study_end_time"/>
  175. <result property="auditNum" column="audit_num"/>
  176. <result property="sort" column="sort"/>
  177. </resultMap>
  178. <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterVo" id="CourseChapterResultVo">
  179. <result property="chapterId" column="chapter_id"/>
  180. <result property="name" column="name"/>
  181. </resultMap>
  182. <select id="selectUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  183. resultMap="ClassGradeUserVoResult">
  184. SELECT
  185. g.*,
  186. u.user_account,
  187. u.realname,
  188. u.id_card,
  189. u.telphone,
  190. cg.class_name,
  191. cg.official_name,
  192. cg.class_status,
  193. cg.interface_push_id,
  194. cg.class_start_time,
  195. cg.class_end_time,
  196. g.official_status_num,
  197. g.period_time,
  198. g.period_wait_time,
  199. g.period_status
  200. FROM
  201. class_grade_user g
  202. LEFT JOIN `user` u ON g.user_id = u.user_id
  203. LEFT JOIN class_grade cg ON cg.grade_id = g.grade_id
  204. WHERE
  205. 1 = 1
  206. AND g.change_grade = 0
  207. AND g.grade_id = #{gradeId}
  208. AND g.user_id = #{userId}
  209. </select>
  210. <select id="select" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  211. resultMap="ClassGradeUserVoResult">
  212. SELECT
  213. g.*,
  214. u.user_account,
  215. u.realname,
  216. u.id_card,
  217. u.telphone
  218. FROM
  219. class_grade_user g
  220. LEFT JOIN `user` u ON g.user_id = u.user_id
  221. WHERE
  222. 1 = 1
  223. <if test="status != null and status.size()!=0 ">
  224. AND g.status in
  225. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  226. #{item}
  227. </foreach>
  228. </if>
  229. <if test="gradeId != null and gradeId != ''">
  230. AND g.grade_id = #{gradeId}
  231. </if>
  232. <if test="userId != null and userId != ''">
  233. AND g.user_id = #{userId}
  234. </if>
  235. <if test="classStartTime != null or classEndTime != null ">
  236. AND #{classStartTime} BETWEEN g.class_start_time
  237. </if>
  238. order by g.update_time desc
  239. </select>
  240. <select id="listUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  241. resultMap="ClassGradeUserGoodsVoResult">
  242. SELECT
  243. * ,
  244. (select `code` FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
  245. u.grade_id) as goods_code,
  246. (select `year` FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
  247. u.grade_id) as year,
  248. (select goods_name FROM goods g LEFT JOIN class_grade_goods c on g.goods_id = c.goods_id where c.grade_id =
  249. u.grade_id) as goods_name,
  250. (select b.business_name FROM course_business b LEFT JOIN goods g on b.id = g.business_id LEFT JOIN
  251. class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as business_name,
  252. (select b.project_name FROM course_project_type b LEFT JOIN goods g on b.id = g.project_id LEFT JOIN
  253. class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as project_name,
  254. (select b.school_name FROM school b LEFT JOIN goods g on b.id = g.school_id LEFT JOIN class_grade_goods c on
  255. g.goods_id = c.goods_id where c.grade_id = u.grade_id) as school_name,
  256. (select b.education_name FROM course_education_type b LEFT JOIN goods g on b.id = g.education_type_id LEFT JOIN
  257. class_grade_goods c on g.goods_id = c.goods_id where c.grade_id = u.grade_id) as education_name,
  258. (SELECT g.grade_code FROM class_grade g where u.grade_id = g.grade_id) as grade_code,
  259. (SELECT g.class_name FROM class_grade g where u.grade_id = g.grade_id) as grade_name,
  260. (SELECT g.status FROM class_grade g where u.grade_id = g.grade_id) as grade_status
  261. FROM
  262. class_grade_user u
  263. where 1=1
  264. <if test="status != null and status.size()!=0 ">
  265. AND u.status in
  266. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  267. #{item}
  268. </foreach>
  269. </if>
  270. <if test="userId != null and userId != ''">
  271. and u.user_id= #{userId}
  272. </if>
  273. order by u.update_time desc
  274. </select>
  275. <select id="listUserPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  276. resultMap="ClassPeriodStudentVo">
  277. SELECT
  278. u.user_account,
  279. u.user_id,
  280. cgu.`status`,
  281. u.realname,
  282. cgg.goods_id,
  283. u.id_card,
  284. cgu.grade_id,
  285. u.telphone,
  286. up.`status` as profile_status,
  287. g.class_hours as class_hours,
  288. g.study_start_time as study_start_time,
  289. g.study_end_time as study_end_time,
  290. g.goods_name,
  291. g.code as goods_code,
  292. g.stand_price,
  293. cgu.period_status,
  294. cg.class_start_time,
  295. cg.class_end_time,
  296. cg.class_name,
  297. cgu.period_plush,
  298. cgu.period_status_num,
  299. (SELECT
  300. COUNT( m.id )
  301. FROM
  302. goods_course c LEFT JOIN course_menu_exam m ON m.course_id = c.course_id
  303. where
  304. m.type = 1
  305. and c.goods_id = cgg.goods_id) as exam_num,
  306. <if test="userPhoto != null and userPhoto == 1">
  307. up.key_value,
  308. </if>
  309. cgu.period_time as end_time,
  310. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  311. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  312. (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.grade_id = cgu.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num
  313. <if test="userPhoto == null">
  314. ,(select COUNT(up.id) from user_period up LEFT JOIN user_period_status ups on up.id=ups.period_id where up.goods_id = (SELECT cgg.goods_id FROM class_grade_goods cgg where cg.grade_id=cgg.grade_id) and up.grade_id = cgu.grade_id and up.user_id = u.user_id
  315. 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
  316. </if>
  317. FROM
  318. class_grade_user cgu
  319. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  320. LEFT JOIN class_grade_goods cgg on cg.grade_id=cgg.grade_id
  321. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  322. LEFT JOIN user_profile up on u.user_id =up.user_id and up.goods_id = cgg.goods_id and cgu.order_goods_id = up.order_goods_id and up.type_status=1 and up.current_status = 1
  323. LEFT JOIN goods g on cgg.goods_id = g.goods_id
  324. where 1=1
  325. and cgu.`status` =1
  326. <if test="periodPlush != null and periodPlush != ''">
  327. AND cgu.period_plush = #{periodPlush}
  328. </if>
  329. <if test="officialStatus != null and officialStatus != ''">
  330. AND cgu.official_status = #{officialStatus}
  331. </if>
  332. <if test="changeGrade != null and changeGrade != ''">
  333. AND cgu.change_grade = #{changeGrade}
  334. </if>
  335. <if test="profileStatus != null and profileStatus != ''">
  336. AND up.status = #{profileStatus}
  337. </if>
  338. <if test="gradeId != null and gradeId !='' ">
  339. and cgu.grade_id = #{gradeId}
  340. </if>
  341. <if test="businessId != null and businessId != ''">
  342. AND g.business_id = #{businessId}
  343. </if>
  344. <if test="educationTypeId != null and educationTypeId != ''">
  345. AND g.education_type_id = #{educationTypeId}
  346. </if>
  347. <if test="schoolId != null and schoolId != ''">
  348. AND g.school_id = #{schoolId}
  349. </if>
  350. <if test="majorId != null and majorId != ''">
  351. AND g.major_id = #{majorId}
  352. </if>
  353. <if test="periodStatus != null ">
  354. and cgu.period_status = #{periodStatus}
  355. </if>
  356. <if test="classStartTime != null and classStartTime != '' ">
  357. AND cg.class_start_time >= #{classStartTime}
  358. </if>
  359. <if test="classEndTime != null and classEndTime != '' ">
  360. AND #{classEndTime} >= cg.class_end_time
  361. </if>
  362. <if test="studyStatus != null and studyStatus == 1 ">
  363. and cgu.period_status = -1
  364. </if>
  365. <if test="studyStatus != null and studyStatus == 2 ">
  366. and cgu.period_status != -1
  367. </if>
  368. <if test="className != null and className !='' ">
  369. and cg.class_name like concat('%', #{className}, '%')
  370. </if>
  371. <if test="searchKey != null and searchKey != '' ">
  372. 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}, '%'))
  373. </if>
  374. <if test="searchStartTime != null and searchStartTime !='' ">
  375. AND cgu.create_time >=#{searchStartTime}
  376. </if>
  377. <if test="searchEndTime != null and searchEndTime !='' ">
  378. AND #{searchEndTime} >= cgu.create_time
  379. </if>
  380. <if test="periodStatus != 2 and periodStatus != 3">
  381. order by cgu.update_time desc
  382. </if>
  383. <if test="periodStatus == 2 ">
  384. order by cgu.period_wait_time,cgu.create_time
  385. </if>
  386. <if test="periodStatus == 3 ">
  387. order by cgu.period_ing_time,cgu.create_time
  388. </if>
  389. </select>
  390. <select id="listUserPeriodExport" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  391. resultMap="ClassPeriodStudentVo">
  392. SELECT
  393. u.user_account,
  394. u.user_id,
  395. cgu.`status`,
  396. u.realname,
  397. cgg.goods_id,
  398. u.id_card,
  399. cgu.grade_id,
  400. u.telphone,
  401. g.class_hours as class_hours,
  402. g.study_start_time as study_start_time,
  403. g.study_end_time as study_end_time,
  404. g.goods_name,
  405. g.code as goods_code,
  406. g.stand_price,
  407. cgu.period_status,
  408. cg.class_start_time,
  409. cg.class_end_time,
  410. cg.class_name,
  411. cgu.period_plush,
  412. cgu.period_status_num,
  413. (SELECT og.service_start_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_start_time,
  414. (SELECT og.service_end_time FROM order_goods og where og.order_goods_id = cgu.order_goods_id ) as service_end_time,
  415. <if test="userPhoto != null and userPhoto == 1">
  416. up.key_value,
  417. </if>
  418. cgu.period_time as end_time
  419. FROM
  420. class_grade_user cgu
  421. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  422. LEFT JOIN class_grade_goods cgg on cg.grade_id=cgg.grade_id
  423. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  424. LEFT JOIN goods g on cgg.goods_id = g.goods_id
  425. 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
  426. where 1=1
  427. and cgu.`status` =1
  428. <if test="periodPlush != null and periodPlush != ''">
  429. AND cgu.period_plush = #{periodPlush}
  430. </if>
  431. <if test="officialStatus != null and officialStatus != ''">
  432. AND cgu.official_status = #{officialStatus}
  433. </if>
  434. <if test="changeGrade != null and changeGrade != ''">
  435. AND cgu.change_grade = #{changeGrade}
  436. </if>
  437. <if test="profileStatus != null and profileStatus != ''">
  438. AND up.status = #{profileStatus}
  439. </if>
  440. <if test="gradeId != null and gradeId !='' ">
  441. and cgu.grade_id = #{gradeId}
  442. </if>
  443. <if test="businessId != null and businessId != ''">
  444. AND g.business_id = #{businessId}
  445. </if>
  446. <if test="educationTypeId != null and educationTypeId != ''">
  447. AND g.education_type_id = #{educationTypeId}
  448. </if>
  449. <if test="schoolId != null and schoolId != ''">
  450. AND g.school_id = #{schoolId}
  451. </if>
  452. <if test="majorId != null and majorId != ''">
  453. AND g.major_id = #{majorId}
  454. </if>
  455. <if test="periodStatus != null ">
  456. and cgu.period_status = #{periodStatus}
  457. </if>
  458. <if test="classStartTime != null and classStartTime != '' ">
  459. AND cg.class_start_time >= #{classStartTime}
  460. </if>
  461. <if test="classEndTime != null and classEndTime != '' ">
  462. AND #{classEndTime} >= cg.class_end_time
  463. </if>
  464. <if test="studyStatus != null and studyStatus == 1 ">
  465. and cgu.period_status = -1
  466. </if>
  467. <if test="studyStatus != null and studyStatus == 2 ">
  468. and cgu.period_status != -1
  469. </if>
  470. <if test="searchKey != null and searchKey != '' ">
  471. 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}, '%'))
  472. </if>
  473. <if test="searchStartTime != null and searchStartTime !='' ">
  474. AND cgu.create_time >=#{searchStartTime}
  475. </if>
  476. <if test="searchEndTime != null and searchEndTime !='' ">
  477. AND #{searchEndTime} >= cgu.create_time
  478. </if>
  479. <if test="periodStatus != 2 and periodStatus != 3">
  480. order by cgu.update_time desc
  481. </if>
  482. <if test="periodStatus == 2 ">
  483. order by cgu.period_wait_time,cgu.create_time
  484. </if>
  485. <if test="periodStatus == 3 ">
  486. order by cgu.period_ing_time,cgu.create_time
  487. </if>
  488. </select>
  489. <select id="userPeriodStatus" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  490. resultMap="ClassPeriodStudentVo">
  491. SELECT
  492. IFNULL(ge.exam_num,0) as exam_num,
  493. cg.class_start_time,
  494. cg.class_end_time,
  495. g.study_start_time,
  496. g.study_end_time,
  497. (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id
  498. = ubr.goods_id where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
  499. cgu.user_id,
  500. cgg.goods_id
  501. FROM
  502. class_grade_user cgu
  503. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  504. LEFT JOIN class_grade_goods cgg on cg.grade_id=cgg.grade_id
  505. LEFT JOIN goods g on g.goods_id=cgg.goods_id
  506. LEFT JOIN (SELECT
  507. COUNT( m.id ) AS exam_num,
  508. c.goods_id
  509. FROM
  510. course_menu_exam m
  511. LEFT JOIN goods_course c ON m.course_id = c.course_id
  512. where
  513. m.type = 1
  514. GROUP BY c.goods_id ) ge on cgg.goods_id = ge.goods_id
  515. where 1=1
  516. and cgu.`status` =1
  517. <if test="gradeId != null and gradeId !='' ">
  518. and cgu.grade_id = #{gradeId}
  519. </if>
  520. <if test="userId != null ">
  521. and cgu.user_id = #{userId}
  522. </if>
  523. LIMIT 1
  524. </select>
  525. <select id="listPeriod" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  526. resultMap="ClassPeriodUserVo">
  527. SELECT
  528. u.user_account,
  529. u.realname,
  530. u.id_card,
  531. u.user_id,
  532. u.telphone,
  533. (SELECT cgg.goods_id FROM class_grade_goods cgg where cg.grade_id=cgg.grade_id) as goods_id,
  534. u.one_inch_photos,
  535. u.id_card_img1,
  536. u.id_card_img2,
  537. cgu.period_status,
  538. (SELECT COUNT(m.id) FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id LEFT JOIN
  539. class_grade_goods cgg on cgg.goods_id = c.goods_id where cg.grade_id=cgg.grade_id and m.type = 1 ) as exam_num,
  540. (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.user_id=#{userId} and ubr.grade_id=cgu.grade_id and ubr.current_status=1) as record_num,
  541. (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
  542. 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.type = 1) as pass,
  543. (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
  544. 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.user_id = #{userId} and up.type = 1) as pending,
  545. (SELECT
  546. 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`
  547. =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.type = 1) as cheat,
  548. (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
  549. ups.`status` =1 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.user_id = #{userId} and up.grade_id = cg.grade_id and up.type = 2) as exam_pass,
  550. (SELECT
  551. 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`
  552. =0 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.type = 2) as exam_cheat,
  553. (SELECT
  554. 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`
  555. =2 and ups.period_status = 1 and up.goods_id=#{goodsId} and up.grade_id = cg.grade_id and up.user_id = #{userId} and up.type = 2) as exam_pending,
  556. (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
  557. <if test="userId != null and userId !='' ">
  558. ,(SELECT MIN(first_start_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId}) as study_start_time,
  559. (SELECT MAX(end_time) from user_study_record where user_id = #{userId} and grade_id = #{gradeId}) as study_end_time
  560. </if>
  561. FROM
  562. class_grade_user cgu
  563. LEFT JOIN class_grade cg ON cgu.grade_id = cg.grade_id
  564. LEFT JOIN `user` u ON u.user_id = cgu.user_id
  565. where 1=1
  566. <if test="userId != null and userId !='' ">
  567. and u.user_id = #{userId}
  568. </if>
  569. <if test="gradeId != null and gradeId !='' ">
  570. and cgu.grade_id = #{gradeId}
  571. </if>
  572. <if test="periodStatus != null and periodStatus !='' ">
  573. and cgu.period_status = #{periodStatus}
  574. </if>
  575. LIMIT 1
  576. </select>
  577. <select id="listPeriodAudit" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  578. resultMap="ClassPeriodVo">
  579. SELECT
  580. gc.sort as course_sort,
  581. cm.sort,
  582. cm.menu_id as id,
  583. cm.course_id,
  584. (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  585. and u.user_id = #{userId}
  586. </if>) as realname,
  587. (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  588. and u.user_id = #{userId}
  589. </if>) as user_id,
  590. (SELECT cm.module_name FROM course_module cm where cm.menu_id = cm.module_id) as type_name,
  591. (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs LEFT JOIN course_module_chapter cmc on
  592. cmc.chapter_id=ccs.chapter_id where cmc.module_id=cm.menu_id) as class_hours,
  593. 1 as type,
  594. NULL as study_start_time,
  595. NULL as study_end_time
  596. FROM
  597. course_menu cm
  598. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  599. where 1=1
  600. <if test="goodsId != null and goodsId !='' ">
  601. and gc.goods_id=#{goodsId}
  602. </if>
  603. AND cm.type=1
  604. UNION
  605. SELECT
  606. gc.sort as course_sort,
  607. cm.sort,
  608. cm.menu_id as id,
  609. cm.course_id,
  610. (SELECT u.realname FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  611. and u.user_id = #{userId}
  612. </if>) as realname,
  613. (SELECT u.user_id FROM `user` u where 1=1 <if test="userId != null and userId !='' ">
  614. and u.user_id = #{userId}
  615. </if>) as user_id,
  616. (SELECT cc.`name` FROM course_chapter cc where cm.menu_id = cc.chapter_id) as type_name,
  617. (SELECT COUNT(ccs.section_id) FROM course_chapter_section ccs where ccs.chapter_id=cm.menu_id) as class_hours,
  618. 2 as type,
  619. (SELECT usr.create_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
  620. 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} ORDER BY usr.create_time ASC
  621. limit 1) as study_start_time,
  622. (SELECT usr.update_time FROM user_study_record usr LEFT JOIN course_chapter_section ccs on usr.section_id =
  623. 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} ORDER BY usr.create_time DESC
  624. limit 1) as study_end_time
  625. FROM
  626. course_menu cm
  627. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  628. where 1=1 <if test="goodsId != null and goodsId !='' ">
  629. and gc.goods_id=#{goodsId}
  630. </if> AND cm.type=2
  631. </select>
  632. <select id="listPeriodAuditSection" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  633. resultMap="ClassPeriodVo">
  634. SELECT
  635. gc.sort as course_sort,
  636. cm.sort,
  637. cm.menu_id as id,
  638. cm.course_id,
  639. (SELECT u.realname FROM `user` u where 1=1
  640. <if test="userId != null and userId !='' ">
  641. and u.user_id = #{userId}
  642. </if>
  643. ) as realname,
  644. (SELECT u.user_id FROM `user` u where 1=1
  645. <if test="userId != null and userId !='' ">
  646. and u.user_id = #{userId}
  647. </if>
  648. ) as user_id,
  649. cs.`name` as type_name,
  650. cs.duration_time,
  651. null as class_hours,
  652. 3 as type
  653. FROM
  654. course_menu cm
  655. LEFT JOIN course_section cs on cm.menu_id = cs.section_id
  656. LEFT JOIN goods_course gc on gc.course_id = cm.course_id
  657. where 1=1
  658. <if test="goodsId != null and goodsId !='' ">
  659. and gc.goods_id = #{goodsId}
  660. </if>
  661. AND cm.type=3
  662. </select>
  663. <select id="listPeriodAuditExam" parameterType="map" resultMap="ClassPeriodChapterVo">
  664. SELECT
  665. cme.exam_id as id,
  666. cme.course_id,
  667. (SELECT u.realname FROM `user` u where 1=1
  668. <if test="userId != null and userId !='' ">
  669. and u.user_id = #{userId}
  670. </if>
  671. ) as realname,
  672. (SELECT u.user_id FROM `user` u where 1=1
  673. <if test="userId != null and userId !='' ">
  674. and u.user_id = #{userId}
  675. </if>
  676. ) as user_id,
  677. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  678. null as class_hours,
  679. 4 as type,
  680. (
  681. SELECT
  682. ups.record_start_time
  683. FROM
  684. user_period_status ups
  685. LEFT JOIN user_period up ON up.id = ups.period_id
  686. WHERE
  687. period_status = 1
  688. AND up.course_id = gc.course_id
  689. <if test="goodsId != null and goodsId !='' ">
  690. AND up.goods_id = #{goodsId}
  691. </if>
  692. and cme.section_id =up.section_id
  693. AND up.exam_id = cme.exam_id
  694. ) AS study_start_time,
  695. (
  696. SELECT
  697. ups.record_end_time
  698. FROM
  699. user_period_status ups
  700. LEFT JOIN user_period up ON up.id = ups.period_id
  701. WHERE
  702. period_status = 1
  703. AND up.course_id = gc.course_id
  704. <if test="goodsId != null and goodsId !='' ">
  705. AND up.goods_id = #{goodsId}
  706. </if>
  707. AND up.exam_id = cme.exam_id
  708. ) AS study_end_time,
  709. (
  710. SELECT
  711. ups.`status`
  712. FROM
  713. user_period_status ups
  714. LEFT JOIN user_period up ON up.id = ups.period_id
  715. WHERE
  716. period_status = 1
  717. AND up.course_id = gc.course_id
  718. <if test="goodsId != null and goodsId !='' ">
  719. AND up.goods_id = #{goodsId}
  720. </if>
  721. and cme.section_id =up.section_id
  722. AND up.exam_id = cme.exam_id
  723. ) AS STATUS,
  724. (
  725. SELECT
  726. ups.create_time
  727. FROM
  728. user_period_status ups
  729. LEFT JOIN user_period up ON up.id = ups.period_id
  730. WHERE
  731. period_status = 1
  732. AND up.course_id = gc.course_id
  733. <if test="goodsId != null and goodsId !='' ">
  734. AND up.goods_id = #{goodsId}
  735. </if>
  736. and cme.section_id =up.section_id
  737. AND up.exam_id = cme.exam_id
  738. ) AS audit_time,
  739. (
  740. SELECT
  741. COUNT( ups.id )
  742. FROM
  743. user_period_status ups
  744. LEFT JOIN user_period up ON up.id = ups.period_id
  745. WHERE
  746. period_status = 1
  747. AND up.course_id = gc.course_id
  748. <if test="goodsId != null and goodsId !='' ">
  749. AND up.goods_id = #{goodsId}
  750. </if>
  751. and cme.section_id =up.section_id
  752. AND up.exam_id = cme.exam_id
  753. ) AS audit_num
  754. FROM
  755. course_menu_exam cme
  756. LEFT JOIN goods_course gc on gc.course_id = cme.course_id
  757. LEFT JOIN course_menu cm on cme.section_id = cm.menu_id
  758. where 1=1
  759. <if test="goodsId != null and goodsId !='' ">
  760. and gc.goods_id= #{goodsId}
  761. </if>
  762. AND cm.type=3 and cme.chapter_id=0 and cme.module_id=0 and cme.type=1 and cm.type=3
  763. </select>
  764. <select id="listperiodChapter" parameterType="map" resultMap="ClassPeriodChapterVo">
  765. SELECT
  766. cmc.sort,
  767. cc.chapter_id as id,
  768. cm.course_id,
  769. ( SELECT u.realname FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
  770. and u.user_id = #{userId}
  771. </if> LIMIT 1) AS realname,
  772. ( SELECT u.user_id FROM `user` u WHERE 1=1 <if test="userId != null and userId !='' ">
  773. and u.user_id = #{userId}
  774. </if> LIMIT 1) AS user_id,
  775. cc.`name` as type_name,
  776. ( SELECT COUNT( ccs.section_id ) FROM course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id ) AS
  777. class_hours,
  778. 2 AS type,
  779. (
  780. SELECT
  781. usr.create_time
  782. FROM
  783. user_study_record usr
  784. LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
  785. WHERE
  786. ccs.chapter_id = cc.chapter_id
  787. AND usr.current_status = 1
  788. <if test="courseId != null and courseId !='' ">
  789. AND usr.course_id=#{courseId}
  790. </if>
  791. <if test="moduleId != null and moduleId !='' ">
  792. AND usr.module_id=#{moduleId}
  793. </if>
  794. <if test="goodsId != null and goodsId !='' ">
  795. AND usr.goods_id=#{goodsId}
  796. </if>
  797. <if test="gradeId != null and gradeId !='' ">
  798. AND usr.grade_id=#{gradeId}
  799. </if>
  800. <if test="userId != null and userId !='' ">
  801. AND usr.user_id=#{userId}
  802. </if>
  803. ORDER BY
  804. usr.create_time ASC
  805. LIMIT 1
  806. ) AS study_start_time,
  807. (
  808. SELECT
  809. usr.update_time
  810. FROM
  811. user_study_record usr
  812. LEFT JOIN course_chapter_section ccs ON usr.section_id = ccs.section_id and ccs.chapter_id = usr.chapter_id
  813. WHERE
  814. ccs.chapter_id = cc.chapter_id
  815. AND usr.current_status = 1
  816. <if test="courseId != null and courseId !='' ">
  817. AND usr.course_id=#{courseId}
  818. </if>
  819. <if test="moduleId != null and moduleId !='' ">
  820. AND usr.module_id=#{moduleId}
  821. </if>
  822. <if test="goodsId != null and goodsId !='' ">
  823. AND usr.goods_id=#{goodsId}
  824. </if>
  825. <if test="gradeId != null and gradeId !='' ">
  826. AND usr.grade_id=#{gradeId}
  827. </if>
  828. <if test="userId != null and userId !='' ">
  829. AND usr.user_id=#{userId}
  830. </if>
  831. ORDER BY
  832. usr.create_time DESC
  833. LIMIT 1
  834. ) AS study_end_time,
  835. (
  836. SELECT
  837. ubr.performance
  838. FROM
  839. user_bank_record ubr
  840. LEFT JOIN course_menu_exam cme ON cme.exam_id = ubr.exam_id and cme.chapter_id = ubr.chapter_id
  841. WHERE 1=1
  842. AND ubr.current_status = 1
  843. <if test="moduleId != null and moduleId !='' ">
  844. AND ubr.module_id=#{moduleId}
  845. </if>
  846. <if test="goodsId != null and goodsId !='' ">
  847. AND ubr.goods_id=#{goodsId}
  848. </if>
  849. <if test="moduleId != null and moduleId !='' ">
  850. AND cme.module_id=#{moduleId}
  851. </if>
  852. <if test="courseId != null and courseId !='' ">
  853. AND cme.course_id =#{courseId}
  854. </if>
  855. <if test="userId != null and userId !='' ">
  856. AND ubr.user_id=#{userId}
  857. </if>
  858. AND cme.chapter_id = cmc.chapter_id
  859. LIMIT 1 ) AS performance
  860. FROM
  861. course_menu cm
  862. LEFT JOIN course_module_chapter cmc ON cm.menu_id = cmc.module_id
  863. LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
  864. WHERE
  865. 1 = 1
  866. <if test="moduleId != null and moduleId !='' ">
  867. AND cmc.module_id=#{moduleId}
  868. </if>
  869. <if test="courseId != null and courseId !='' ">
  870. AND cm.course_id =#{courseId}
  871. </if>
  872. </select>
  873. <select id="listperiodExam" parameterType="map" resultMap="ClassPeriodSectionVo">
  874. SELECT
  875. cme.exam_id as id,
  876. cme.course_id,
  877. (SELECT u.realname FROM `user` u where 1=1
  878. <if test="userId != null and userId !='' ">
  879. and u.user_id = #{userId}
  880. </if>
  881. ) as realname,
  882. (SELECT u.user_id FROM `user` u where 1=1
  883. <if test="userId != null and userId !='' ">
  884. and u.user_id = #{userId}
  885. </if>
  886. ) as user_id,
  887. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  888. null as class_hours,
  889. 4 as type
  890. FROM
  891. course_menu_exam cme
  892. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  893. WHERE 1=1
  894. <if test="courseId != null and courseId !='' ">
  895. AND cme.course_id=#{courseId}
  896. </if>
  897. <if test="chapterId != null and chapterId !='' ">
  898. AND cme.chapter_id =#{chapterId}
  899. </if>
  900. <if test="moduleId != null and moduleId !='' ">
  901. AND cme.module_id =#{moduleId}
  902. </if>
  903. </select>
  904. <select id="listPeriodSection" parameterType="map" resultMap="ClassPeriodSectionVo">
  905. SELECT
  906. ccs.sort,
  907. cs.section_id AS id,
  908. #{courseId} AS course_id,
  909. ( SELECT u.realname FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
  910. and u.user_id = #{userId}
  911. </if> ) AS realname,
  912. ( SELECT u.user_id FROM `user` u WHERE 1 = 1 <if test="userId != null and userId !='' ">
  913. and u.user_id = #{userId}
  914. </if> ) AS user_id,
  915. cs.NAME AS type_name,
  916. cs.duration_time,
  917. NULL AS class_hours,
  918. 3 AS type
  919. FROM
  920. course_chapter_section ccs
  921. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  922. WHERE
  923. 1 = 1
  924. <if test="chapterId != null and chapterId !='' ">
  925. AND ccs.chapter_id = #{chapterId}
  926. </if>
  927. </select>
  928. <select id="listPeriodSectionExam" parameterType="map" resultMap="ClassPeriodSectionVo">
  929. SELECT
  930. cme.exam_id as id,
  931. cme.course_id,
  932. (SELECT u.realname FROM `user` u where 1=1
  933. <if test="userId != null and userId !='' ">
  934. and u.user_id = #{userId}
  935. </if>
  936. ) as realname,
  937. (SELECT u.user_id FROM `user` u where 1=1
  938. <if test="userId != null and userId !='' ">
  939. and u.user_id = #{userId}
  940. </if>
  941. ) as user_id,
  942. (SELECT e.exam_name FROM exam e where cme.exam_id = e.exam_id) as type_name,
  943. null as class_hours,
  944. 4 as type
  945. FROM
  946. course_menu_exam cme
  947. LEFT JOIN exam e ON cme.exam_id = e.exam_id
  948. WHERE 1=1
  949. and cme.module_id =0
  950. <if test="courseId != null and courseId !='' ">
  951. AND cme.course_id=#{courseId}
  952. </if>
  953. <if test="chapterId != null and chapterId !='' ">
  954. AND cme.chapter_id = #{chapterId}
  955. </if>
  956. </select>
  957. <select id="selectStart" parameterType="map" resultType="long">
  958. SELECT
  959. usr.create_time
  960. FROM
  961. user_study_record usr
  962. WHERE
  963. usr.goods_id = #{goodsId}
  964. AND usr.grade_id = #{gradeId}
  965. AND usr.user_id = #{userId} UNION
  966. SELECT
  967. ubr.create_time
  968. FROM
  969. user_bank_record ubr
  970. WHERE
  971. ubr.goods_id =#{goodsId}
  972. AND ubr.grade_id = #{gradeId}
  973. AND ubr.user_id = #{userId}
  974. ORDER BY create_time ASC
  975. </select>
  976. <select id="sendClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  977. SELECT
  978. cgu.user_id,
  979. cg.class_start_time,
  980. cg.class_end_time,
  981. cgg.goods_id,
  982. cg.grade_id
  983. FROM
  984. class_grade_user cgu
  985. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  986. LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
  987. LEFT JOIN goods g on cgg.goods_id = g.goods_id
  988. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  989. where 1=1
  990. and irb.remind_id =5
  991. and cgu.status = 1
  992. AND unix_timestamp(now()) BETWEEN cg.class_end_time-1728000 and cg.class_end_time-1641600
  993. AND (SELECT COUNT(1) FROM inform_user iu where 1=1 and iu.remind_id = 5 and cgu.user_id = iu.user_id and cgu.grade_id = iu.grade_id and iu.system_status=3) &lt; 1
  994. </select>
  995. <select id="sendTenClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  996. SELECT
  997. cgu.user_id,
  998. cg.class_start_time,
  999. cg.class_end_time,
  1000. cgg.goods_id,
  1001. cg.grade_id
  1002. FROM
  1003. class_grade_user cgu
  1004. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1005. LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
  1006. LEFT JOIN goods g on cgg.goods_id = g.goods_id
  1007. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1008. where 1=1
  1009. and irb.remind_id =6
  1010. and cgu.status = 1
  1011. AND unix_timestamp(now()) BETWEEN cg.class_end_time-864000 and cg.class_end_time-777600
  1012. AND (SELECT COUNT(1) FROM inform_user iu where 1=1 and iu.remind_id = 6 and cgu.user_id = iu.user_id and cgu.grade_id = iu.grade_id and iu.system_status=3) &lt; 1
  1013. </select>
  1014. <select id="sendFiveClassGradeUser" resultMap="ClassGradeUserGoodsVoResult">
  1015. SELECT
  1016. cgu.user_id,
  1017. cg.class_start_time,
  1018. cg.class_end_time,
  1019. cgg.goods_id,
  1020. cg.grade_id
  1021. FROM
  1022. class_grade_user cgu
  1023. LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
  1024. LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
  1025. LEFT JOIN goods g on cgg.goods_id = g.goods_id
  1026. LEFT JOIN inform_remind_business irb on irb.business_id = g.business_id
  1027. where 1=1
  1028. and irb.remind_id =7
  1029. and cgu.status = 1
  1030. AND unix_timestamp(now()) BETWEEN cg.class_end_time-432000 and cg.class_end_time-345600
  1031. AND (SELECT COUNT(1) FROM inform_user iu where 1=1 and iu.remind_id = 7 and cgu.user_id = iu.user_id and cgu.grade_id = iu.grade_id and iu.system_status=3) &lt; 1
  1032. </select>
  1033. <select id="selectUserCount" parameterType="com.zhongzheng.modules.user.domain.User" resultType="long">
  1034. SELECT
  1035. COUNT( 1 )
  1036. FROM
  1037. `user`
  1038. WHERE
  1039. id_card = #{idCard} and user_id != #{userId} and `status` = 1
  1040. </select>
  1041. <select id="selectUserCertificate" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
  1042. resultMap="ClassGradeUserVoResult">
  1043. </select>
  1044. <select id="findChapterList" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultMap="CourseChapterResultVo">
  1045. SELECT
  1046. cc.chapter_id,
  1047. cc.`name`
  1048. FROM
  1049. course_module_chapter p
  1050. LEFT JOIN course_chapter cc ON p.chapter_id = cc.chapter_id
  1051. LEFT JOIN course_menu m ON m.menu_id = p.module_id
  1052. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  1053. WHERE
  1054. gc.goods_id = #{goodsId}
  1055. AND m.type IN ( 1 ) UNION
  1056. SELECT
  1057. cc.chapter_id,
  1058. cc.`name`
  1059. FROM
  1060. course_menu m
  1061. LEFT JOIN course_chapter cc ON m.menu_id = cc.chapter_id
  1062. LEFT JOIN goods_course gc ON gc.course_id = m.course_id
  1063. WHERE
  1064. gc.goods_id = #{goodsId}
  1065. AND m.type IN ( 2 )
  1066. </select>
  1067. <select id="selectOfficialInfoCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1068. SELECT
  1069. count(*)
  1070. FROM
  1071. class_grade_user cgu
  1072. WHERE
  1073. cgu.grade_id = #{gradeId}
  1074. AND cgu.official_status = 1
  1075. </select>
  1076. <select id="selectLearnStatusCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1077. SELECT
  1078. count(*)
  1079. FROM
  1080. class_grade_user cgu
  1081. WHERE
  1082. cgu.grade_id = #{gradeId}
  1083. AND cgu.learn_status = 1
  1084. </select>
  1085. <select id="selectOfficialPeriodCount" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo" resultType="long">
  1086. SELECT
  1087. count(*)
  1088. FROM
  1089. class_grade_user cgu
  1090. WHERE
  1091. cgu.grade_id = #{gradeId}
  1092. AND cgu.period_plush = 1
  1093. </select>
  1094. <select id="selectOfficialNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  1095. SELECT
  1096. gu.*
  1097. FROM
  1098. class_grade g
  1099. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  1100. WHERE
  1101. g.interface_push_id > 0
  1102. AND g.`status` = 1
  1103. AND gu.`status` = 1
  1104. AND gu.change_grade = 0
  1105. AND IFNULL(gu.official_status,0) != 1
  1106. </select>
  1107. <select id="selectPeriodNotPush" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="ClassGradeUserGoodsVoResult">
  1108. SELECT
  1109. gu.*
  1110. FROM
  1111. class_grade g
  1112. LEFT JOIN class_grade_user gu ON g.grade_id = gu.grade_id
  1113. WHERE
  1114. g.interface_period_id > 0
  1115. AND g.`status` = 1
  1116. AND gu.`status` = 1
  1117. AND gu.change_grade = 0
  1118. AND IFNULL(gu.period_plush,0) != 1
  1119. AND gu.period_status = 1
  1120. </select>
  1121. </mapper>