ClassGradeUserMapper.xml 54 KB

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