PracticeGroupMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <!--
  4. 这个文件是自动生成的。
  5. 不要修改此文件。所有改动将在下次重新自动生成时丢失。
  6. -->
  7. <mapper namespace="com.ym.mec.biz.dal.dao.PracticeGroupDao">
  8. <resultMap type="com.ym.mec.biz.dal.entity.PracticeGroup" id="PracticeGroup">
  9. <result column="id_" property="id"/>
  10. <result column="name_" property="name"/>
  11. <result column="subject_id_" property="subjectId"/>
  12. <result column="user_id_" property="userId"/>
  13. <result column="student_id_" property="studentId"/>
  14. <result column="single_class_minutes_" property="singleClassMinutes"/>
  15. <result column="organ_id_" property="organId"/>
  16. <result column="courses_start_date_" property="coursesStartDate"/>
  17. <result column="courses_expire_date_" property="coursesExpireDate"/>
  18. <result column="create_time_" property="createTime"/>
  19. <result column="update_time_" property="updateTime"/>
  20. <result column="memo_" property="memo"/>
  21. <result column="buy_months_" property="buyMonths"/>
  22. <result column="drill_times_on_week_" property="drillTimesOnWeek"/>
  23. <result column="drill_times_json_" property="drillTimesJson"/>
  24. <result column="group_status_" property="groupStatus"
  25. typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  26. <result column="be_renew_group_id_" property="beRenewGroupId"/>
  27. <result column="educational_teacher_id_" property="educationalTeacherId"/>
  28. </resultMap>
  29. <resultMap id="PracticeCourseDto" type="com.ym.mec.biz.dal.dto.PracticeCourseDto" extends="PracticeGroup">
  30. <result property="teacherName" column="real_name_"/>
  31. <result property="avatar" column="avatar_"/>
  32. <result property="subjectName" column="subject_name_"/>
  33. <result property="eduTeacherName" column="edu_teacher_name_"/>
  34. </resultMap>
  35. <resultMap type="com.ym.mec.biz.dal.dto.PracticeGroupDto" id="PracticeGroupDto" extends="PracticeGroup">
  36. <result column="id_" property="id"/>
  37. <result column="name_" property="name"/>
  38. <result column="subject_id_" property="subjectId"/>
  39. <result column="user_id_" property="userId"/>
  40. <result column="single_class_minutes_" property="singleClassMinutes"/>
  41. <result column="organ_id_" property="organId"/>
  42. <result column="courses_start_date_" property="coursesStartDate"/>
  43. <result column="courses_expire_date_" property="coursesExpireDate"/>
  44. <result column="create_time_" property="createTime"/>
  45. <result column="update_time_" property="updateTime"/>
  46. <result column="memo_" property="memo"/>
  47. <result column="subject_name_" property="subjectName"/>
  48. <result column="teacher_name_" property="teacherName"/>
  49. <result column="evaluate_id_" property="evaluateId"/>
  50. <result column="evaluate_status_" property="evaluateStatus"/>
  51. </resultMap>
  52. <update id="updateUserId">
  53. UPDATE practice_group
  54. SET user_id_ = #{teacherId},
  55. update_time_ = NOW()
  56. WHERE id_ = #{practiceGroupId}
  57. </update>
  58. <update id="update" parameterType="com.ym.mec.biz.dal.entity.PracticeGroup">
  59. UPDATE practice_group
  60. <set>
  61. <if test="subjectId!=null">
  62. subject_id_=#{subjectId},
  63. </if>
  64. <if test="memo!=null">
  65. memo_=#{memo},
  66. </if>
  67. <if test="name!=null">
  68. name_=#{name},
  69. </if>
  70. <if test="groupStatus!=null">
  71. group_status_=#{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  72. </if>
  73. <if test="educationalTeacherId!=null">
  74. educational_teacher_id_=#{educationalTeacherId},
  75. </if>
  76. update_time_ = NOW()
  77. </set>
  78. WHERE id_ = #{id}
  79. </update>
  80. <update id="batchUpdate">
  81. <foreach collection="groups" item="group" separator=";">
  82. UPDATE practice_group
  83. <set>
  84. <if test="group.groupStatus!=null">
  85. group_status_=#{group.groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  86. </if>
  87. update_time_ = NOW()
  88. </set>
  89. WHERE id_ = #{group.id}
  90. </foreach>
  91. </update>
  92. <!-- 根据主键查询一条记录 -->
  93. <select id="get" resultMap="PracticeGroup">
  94. SELECT *
  95. FROM practice_group
  96. WHERE id_ = #{id}
  97. </select>
  98. <!-- 全查询 -->
  99. <select id="findAll" resultMap="PracticeGroup">
  100. SELECT *
  101. FROM practice_group
  102. </select>
  103. <!-- 向数据库增加一条记录 -->
  104. <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.PracticeGroup" useGeneratedKeys="true" keyColumn="id"
  105. keyProperty="id">
  106. <!--
  107. <selectKey resultClass="int" keyProperty="id" >
  108. SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
  109. </selectKey>
  110. -->
  111. INSERT INTO practice_group
  112. (id_,name_,subject_id_,user_id_,student_id_,single_class_minutes_,organ_id_,courses_start_date_,courses_expire_date_,create_time_,update_time_,memo_,buy_months_,drill_times_on_week_,drill_times_json_,group_status_,be_renew_group_id_,educational_teacher_id_)
  113. VALUES(#{id},#{name},#{subjectId},#{userId},#{studentId},#{singleClassMinutes},#{organId},#{coursesStartDate},#{coursesExpireDate},NOW(),NOW(),#{memo},#{buyMonths},#{drillTimesOnWeek},#{drillTimesJson},#{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{beRenewGroupId},#{educationalTeacherId})
  114. </insert>
  115. <select id="getUserFreePracticeGroup" resultMap="PracticeGroup">
  116. SELECT *
  117. FROM practice_group
  118. WHERE student_id_ = #{userId}
  119. AND buy_months_ IS NULL
  120. </select>
  121. <!-- 分页查询 -->
  122. <select id="queryPage" resultMap="PracticeGroup" parameterType="map">
  123. SELECT * FROM practice_group
  124. <include refid="global.limit"/>
  125. </select>
  126. <!-- 查询当前表的总记录数 -->
  127. <select id="queryCount" resultType="int">
  128. SELECT COUNT(*)
  129. FROM practice_group
  130. </select>
  131. <select id="getUserPracticeCoursesWithDateRange" resultMap="PracticeGroup">
  132. SELECT *
  133. FROM practice_group
  134. WHERE user_id_ = #{userId}
  135. AND (courses_start_date_ BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d'))
  136. </select>
  137. <select id="countUserPracticeApplyRecord" resultType="int">
  138. SELECT COUNT(*)
  139. FROM practice_group
  140. WHERE student_id_ = #{userId}
  141. AND group_status_ = 'NORMAL'
  142. AND buy_months_ IS NULL
  143. AND create_time_ > '2020-03-25'
  144. </select>
  145. <select id="countPracticeGroupByOrgan" resultType="java.lang.Integer">
  146. SELECT count(*) FROM practice_group pg
  147. <include refid="practiceGroupQueryCondition"/>
  148. </select>
  149. <select id="findAllByOrgan" resultMap="PracticeGroupDto">
  150. SELECT pg.*,
  151. su.real_name_ teacher_name_
  152. FROM
  153. practice_group pg
  154. LEFT JOIN sys_user su ON pg.user_id_ = su.id_
  155. <include refid="practiceGroupQueryCondition"/>
  156. ORDER BY pg.id_ DESC
  157. <include refid="global.limit"/>
  158. </select>
  159. <select id="countPracticeGroupOverCourse" resultType="java.util.Map">
  160. </select>
  161. <select id="findUserLatestPracticeGroup" resultMap="PracticeGroup">
  162. SELECT *
  163. FROM practice_group
  164. WHERE student_id_ = #{userId}
  165. AND buy_months_ IS NOT NULL
  166. ORDER BY create_time_ DESC
  167. LIMIT 1;
  168. </select>
  169. <select id="findUserBuyPracticeGroups" resultMap="PracticeCourseDto">
  170. SELECT pg.*,
  171. su.real_name_,
  172. su.avatar_,
  173. s.name_ subject_name_
  174. FROM practice_group pg
  175. LEFT JOIN sys_user su ON pg.user_id_ = su.id_
  176. LEFT JOIN `subject` s ON pg.subject_id_ = s.id_
  177. WHERE student_id_ = #{userId}
  178. AND (pg.group_status_ = 'NORMAL' OR pg.group_status_ = 'LOCK')
  179. AND pg.buy_months_ IS NOT NULL
  180. </select>
  181. <select id="findUserBuyPracticeGroupsWithDate" resultMap="PracticeCourseDto">
  182. SELECT pg.*,
  183. su.real_name_,
  184. su.avatar_,
  185. s.name_ subject_name_
  186. FROM practice_group pg
  187. LEFT JOIN sys_user su ON pg.user_id_ = su.id_
  188. LEFT JOIN `subject` s ON pg.subject_id_ = s.id_
  189. WHERE student_id_ = #{userId}
  190. AND courses_start_date_ = #{date}
  191. AND group_status_ = 'LOCK'
  192. AND pg.buy_months_ IS NOT NULL
  193. </select>
  194. <select id="findUserPracticeGroup" resultMap="PracticeGroup">
  195. SELECT *
  196. FROM practice_group
  197. WHERE student_id_ = #{userId}
  198. AND id_ = #{groupId};
  199. </select>
  200. <select id="findUserPracticeGroup2" resultMap="PracticeGroupDto">
  201. SELECT pg.*, su.real_name_ teacher_name_
  202. FROM practice_group pg
  203. LEFT JOIN sys_user su ON pg.user_id_ = su.id_
  204. WHERE pg.student_id_ = #{userId}
  205. AND pg.id_ = #{groupId};
  206. </select>
  207. <select id="findHistoryPracticeGroups" resultMap="PracticeGroup">
  208. SELECT *
  209. FROM practice_group
  210. WHERE courses_expire_date_ &lt; NOW()
  211. AND group_status_ = 'NORMAL'
  212. </select>
  213. <sql id="practiceGroupQueryCondition">
  214. <where>
  215. pg.group_status_ IN ('NORMAL', 'FINISH')
  216. <if test="hasEducationalTeacherId != null and hasEducationalTeacherId == true">
  217. AND pg.educational_teacher_id_ IS NOT NULL
  218. </if>
  219. <if test="hasEducationalTeacherId != null and hasEducationalTeacherId == false">
  220. AND pg.educational_teacher_id_ IS NULL
  221. </if>
  222. <if test="search!=null and search!=''">
  223. AND (pg.name_ LIKE CONCAT('%',#{search},'%') OR pg.id_= #{search})
  224. </if>
  225. <if test="teacherId!=null">
  226. AND pg.user_id_=#{teacherId}
  227. </if>
  228. <if test="organId != null">
  229. AND FIND_IN_SET(pg.organ_id_,#{organId})
  230. </if>
  231. <if test="educationalTeacherId!=null">
  232. AND pg.educational_teacher_id_=#{educationalTeacherId}
  233. </if>
  234. <if test="type != null and type == 1">
  235. AND pg.be_renew_group_id_ IS NULL AND pg.buy_months_ IS NOT NULL
  236. </if>
  237. <if test="type != null and type == 0">
  238. AND pg.be_renew_group_id_ IS NOT NULL AND pg.buy_months_ IS NOT NULL
  239. </if>
  240. <if test="type != null and type == 2">
  241. AND pg.buy_months_ IS NULL
  242. </if>
  243. </where>
  244. </sql>
  245. <!-- 根据主键查询一条记录 -->
  246. <select id="lockPracticeGroup" resultMap="PracticeGroup">
  247. SELECT *
  248. FROM practice_group
  249. WHERE id_ = #{groupId} FOR
  250. UPDATE
  251. </select>
  252. <select id="findUserStatusPracticeGroups" resultMap="PracticeGroup">
  253. SELECT *
  254. FROM practice_group
  255. WHERE student_id_ = #{userId}
  256. AND group_status_ = #{groupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  257. </select>
  258. <select id="findUserLockPracticeGroupWithDate" resultMap="PracticeGroup">
  259. SELECT *
  260. FROM practice_group
  261. WHERE student_id_ = #{userId}
  262. AND courses_start_date_ = #{date}
  263. AND group_status_ = 'LOCK'
  264. </select>
  265. <select id="findUserLockPracticeGroupWithDateBefore" resultMap="PracticeGroup">
  266. SELECT *
  267. FROM practice_group
  268. WHERE student_id_ = #{userId}
  269. AND courses_start_date_ &lt;= #{date}
  270. AND group_status_ = 'LOCK'
  271. </select>
  272. <sql id="practiceGroupReviewsQueryCondition">
  273. <where>
  274. pg.group_status_ != 'LOCK'
  275. <if test="month != null">
  276. AND DATE_FORMAT(cse.create_time_, '%Y-%m') = #{month}
  277. </if>
  278. <if test="search!=null and search!=''">
  279. AND (pg.name_ LIKE CONCAT('%',#{search},'%') OR pg.id_= #{search})
  280. </if>
  281. <if test="teacherId!=null">
  282. AND pg.user_id_=#{teacherId}
  283. </if>
  284. <if test="organId != null">
  285. AND FIND_IN_SET(pg.organ_id_,#{organId})
  286. </if>
  287. <if test="month != null">
  288. AND pg.courses_expire_date_ >= #{month}
  289. </if>
  290. <if test='isFree !=null and isFree=="0"'>
  291. AND pg.buy_months_ > 0
  292. </if>
  293. <if test='isFree !=null and isFree=="1"'>
  294. AND pg.buy_months_ IS NULL
  295. </if>
  296. <if test='isOver !=null and isOver=="0"'>
  297. <![CDATA[AND pg.group_status_ = 'NORMAL'
  298. ]]>
  299. </if>
  300. <if test='isOver !=null and isOver=="1"'>
  301. <![CDATA[ AND pg.group_status_ ='FINISH'
  302. ]]></if>
  303. <if test='hasReport !=null and hasReport=="0"'>
  304. <![CDATA[AND cse.status_ =0
  305. ]]>
  306. </if>
  307. <if test='hasReport !=null and hasReport=="1"'>
  308. <![CDATA[ AND cse.status_ = 1
  309. ]]></if>
  310. </where>
  311. </sql>
  312. <select id="findPracticeGroupsReviews" resultMap="PracticeGroupDto">
  313. SELECT pg.*,cse.id_ evaluate_id_,cse.status_ evaluate_status_,
  314. su.real_name_ teacher_name_
  315. FROM
  316. practice_group pg
  317. LEFT JOIN sys_user su ON pg.user_id_ = su.id_
  318. LEFT JOIN course_schedule_evaluate cse ON pg.id_=cse.music_group_id_
  319. <include refid="practiceGroupReviewsQueryCondition"/>
  320. ORDER BY pg.id_ DESC
  321. <include refid="global.limit"/>
  322. </select>
  323. <select id="countPracticeGroupReviews" resultType="java.lang.Integer">
  324. SELECT count(*) FROM practice_group pg
  325. LEFT JOIN course_schedule_evaluate cse ON pg.id_=cse.music_group_id_
  326. <include refid="practiceGroupReviewsQueryCondition"/>
  327. </select>
  328. <select id="getNeedPostReportPracticeGroups"
  329. resultMap="com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao.CourseScheduleEvaluate">
  330. <![CDATA[
  331. SELECT pg.id_ music_group_id_,
  332. pg.user_id_ teacher_id_,
  333. cg.id_ class_group_id_,
  334. pg.single_class_minutes_ total_minutes_,
  335. pg.subject_id_
  336. FROM practice_group pg
  337. LEFT JOIN class_group cg on pg.id_ = cg.music_group_id_ AND cg.group_type_ = 'PRACTICE'
  338. WHERE pg.group_status_ IN ('NORMAL','FINISH') AND cg.group_type_ = 'PRACTICE'
  339. AND pg.buy_months_ >= 1
  340. AND pg.courses_start_date_ <= #{nowDate,jdbcType=DATE}
  341. AND pg.courses_expire_date_ >= #{afterDate,jdbcType=DATE}
  342. ]]>
  343. <if test="afterDateIsLastDay == false">
  344. AND DATE_FORMAT(pg.courses_expire_date_, '%d') = DATE_FORMAT(#{afterDate}, '%d')
  345. </if>
  346. <if test="afterDateIsLastDay == true">
  347. <![CDATA[ AND DATE_FORMAT(pg.courses_expire_date_, '%d') >= DATE_FORMAT(#{afterDate}, '%d') ]]>
  348. </if>
  349. AND cg.del_flag_ = 0
  350. </select>
  351. <select id="getReportCourseTimes" resultMap="com.ym.mec.biz.dal.dao.ClassGroupDao.ClassGroup">
  352. SELECT COUNT(*) total_class_times_,class_group_id_ id_ from course_schedule WHERE class_group_id_ IN
  353. <foreach collection="classGroupIds" item="classGroupId" open="(" separator="," close=")">
  354. #{classGroupId}
  355. </foreach>
  356. <![CDATA[AND class_date_ >= #{startDate,jdbcType=DATE} AND class_date_ <=#{endDate,jdbcType=DATE} ]]>
  357. AND (del_flag_ =0 OR del_flag_ IS NULL)
  358. GROUP BY class_group_id_
  359. </select>
  360. <select id="findByGroupId" resultMap="PracticeCourseDto">
  361. SELECT pg.*, s.name_ subject_name_, su.real_name_ edu_teacher_name_
  362. FROM practice_group pg
  363. LEFT JOIN subject s on pg.subject_id_ = s.id_
  364. LEFT JOIN sys_user su on pg.educational_teacher_id_ = su.id_
  365. WHERE pg.id_ = #{id}
  366. </select>
  367. <select id="countStudentBuys" resultType="java.lang.Integer">
  368. SELECT COUNT(a.student_id_) FROM
  369. (SELECT DISTINCT(pg.`student_id_`),pg.`organ_id_` FROM `practice_group` pg WHERE pg.`group_status_` in
  370. ('NORMAL','FINISH')) a
  371. LEFT JOIN (SELECT pg.`student_id_` ,max(concat(cs.`class_date_`,' ',cs.`end_class_time_` )) lastClassDate FROM
  372. `practice_group` pg
  373. LEFT JOIN `course_schedule` cs on cs.`music_group_id_` = pg.`id_` and cs.`group_type_` = 'PRACTICE'
  374. WHERE pg.`buy_months_` IS NULL AND cs.`group_type_` = 'PRACTICE'
  375. GROUP BY pg.`student_id_` ) b on a.student_id_ = b.student_id_
  376. left join (SELECT pg.`student_id_` ,min(pg.`create_time_`) firstBuyTime
  377. FROM `practice_group` pg WHERE pg.`buy_months_` IS NOT NULL AND pg.`group_status_` in ('NORMAL','FINISH') GROUP
  378. BY pg.`student_id_` ) c
  379. on a.student_id_ = c.student_id_
  380. left join `sys_user` u on u.`id_` = a.student_id_
  381. left join `organization` o on o.`id_` = a.organ_id_
  382. <include refid="queryStudentBuysSql"/>
  383. </select>
  384. <resultMap id="queryStudentBuysMap" type="com.ym.mec.biz.dal.dto.StudentBuyPracticeDto">
  385. <result property="organName" column="organ_name_"/>
  386. <result property="phone" column="phone_"/>
  387. <result property="studentId" column="student_id_"/>
  388. <result property="studentName" column="student_name_"/>
  389. <result property="firstBuyTime" column="first_buy_time_"/>
  390. <result property="intervalDay" column="interval_day_"/>
  391. <result property="lastClassDate" column="last_class_date_"/>
  392. <result property="buyPractice" column="buy_practice_"
  393. typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
  394. </resultMap>
  395. <select id="queryStudentBuys" resultMap="queryStudentBuysMap">
  396. SELECT o.`name_` organ_name_,a.student_id_,u.`username_` student_name_,u.phone_,
  397. b.lastClassDate last_class_date_,c.firstBuyTime first_buy_time_,
  398. CASE WHEN DATEDIFF(c.firstBuyTime,b.lastClassDate) &lt; 0 THEN 0 ELSE DATEDIFF(c.firstBuyTime,b.lastClassDate)
  399. END interval_day_,
  400. CASE WHEN c.firstBuyTime IS NULL THEN 0 ELSE 1 END buy_practice_
  401. FROM
  402. (SELECT DISTINCT(pg.`student_id_`),pg.`organ_id_` FROM `practice_group` pg WHERE pg.`group_status_` in
  403. ('NORMAL','FINISH')) a
  404. LEFT JOIN (SELECT pg.`student_id_` ,max(concat(cs.`class_date_`,' ',cs.`end_class_time_` )) lastClassDate FROM
  405. `practice_group` pg
  406. LEFT JOIN `course_schedule` cs on cs.`music_group_id_` = pg.`id_` and cs.`group_type_` = 'PRACTICE'
  407. WHERE pg.`buy_months_` IS NULL AND cs.`group_type_` = 'PRACTICE'
  408. GROUP BY pg.`student_id_` ) b on a.student_id_ = b.student_id_
  409. left join (SELECT pg.`student_id_` ,min(pg.`create_time_`) firstBuyTime
  410. FROM `practice_group` pg WHERE pg.`buy_months_` IS NOT NULL AND pg.`group_status_` in ('NORMAL','FINISH') GROUP
  411. BY pg.`student_id_` ) c
  412. on a.student_id_ = c.student_id_
  413. left join `sys_user` u on u.`id_` = a.student_id_
  414. left join `organization` o on o.`id_` = a.organ_id_
  415. <include refid="queryStudentBuysSql"/>
  416. <include refid="global.limit"/>
  417. </select>
  418. <sql id="queryStudentBuysSql">
  419. <where>
  420. <if test="search != null and search != ''">
  421. (u.id_ = #{search} OR u.`username_` LIKE CONCAT('%',#{search},'%'))
  422. </if>
  423. <if test="buyPractice != null and buyPractice == false">
  424. AND c.firstBuyTime IS NULL
  425. </if>
  426. <if test="buyPractice != null and buyPractice == true">
  427. AND c.firstBuyTime IS NOT NULL
  428. </if>
  429. <if test="organId != null">
  430. AND FIND_IN_SET(a.organ_id_,#{organId})
  431. </if>
  432. </where>
  433. </sql>
  434. <resultMap id="courseGroupExport" type="com.ym.mec.biz.dal.dto.CourseGroupExportDto">
  435. <result column="organ_name_" property="organName"/>
  436. <result column="student_id_" property="studentId"/>
  437. <result column="student_name_" property="studentName"/>
  438. <result column="teacher_id_" property="teacherId"/>
  439. <result column="teacher_name_" property="teacherName"/>
  440. <result column="expire_date_" property="expireDate"/>
  441. <result column="class_start_date_" property="classStartDate"/>
  442. <result column="class_end_date_" property="classEndDate"/>
  443. <result column="total_class_times_" property="totalClassTimes"/>
  444. <result column="no_start_class_times_" property="noStartClassTimes"/>
  445. </resultMap>
  446. <select id="getPracticeGroupExport" resultMap="courseGroupExport">
  447. SELECT pg.student_id_,
  448. su.username_ student_name_,
  449. o.name_ organ_name_,
  450. MAX(pg.courses_expire_date_) expire_date_
  451. FROM practice_group pg
  452. LEFT JOIN organization o on o.id_ = pg.organ_id_
  453. LEFT JOIN sys_user su ON su.id_ = pg.student_id_
  454. WHERE pg.group_status_ IN ('NORMAL','FINISH')
  455. <if test="organIds != null and organIds != ''">
  456. AND FIND_IN_SET(pg.organ_id_, #{organIds})
  457. </if>
  458. GROUP BY pg.student_id_,o.id_
  459. </select>
  460. </mapper>