CourseSectionMapper.xml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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.course.mapper.CourseSectionMapper">
  6. <resultMap type="com.zhongzheng.modules.course.domain.CourseSection" id="CourseSectionResult">
  7. <result property="sectionId" column="section_id"/>
  8. <result property="name" column="name"/>
  9. <result property="sort" column="sort"/>
  10. <result property="createTime" column="create_time"/>
  11. <result property="updateTime" column="update_time"/>
  12. <result property="prefixName" column="prefix_name"/>
  13. <result property="status" column="status"/>
  14. <result property="sectionType" column="section_type"/>
  15. <result property="publishStatus" column="publish_status"/>
  16. <result property="liveUrl" column="live_url"/>
  17. <result property="liveStartTime" column="live_start_time"/>
  18. <result property="liveEndTime" column="live_end_time"/>
  19. <result property="recordingUrl" column="recording_url"/>
  20. <result property="durationTime" column="duration_time"/>
  21. <result property="coverUrl" column="cover_url"/>
  22. <result property="code" column="code"/>
  23. </resultMap>
  24. <resultMap type="com.zhongzheng.modules.course.vo.CourseSectionVo" id="CourseSectionResultVo">
  25. <result property="sectionId" column="section_id"/>
  26. <result property="name" column="name"/>
  27. <result property="sort" column="sort"/>
  28. <result property="prefixName" column="prefix_name"/>
  29. <result property="status" column="status"/>
  30. <result property="sectionType" column="section_type"/>
  31. <result property="publishStatus" column="publish_status"/>
  32. <result property="liveUrl" column="live_url"/>
  33. <result property="liveStartTime" column="live_start_time"/>
  34. <result property="liveEndTime" column="live_end_time"/>
  35. <result property="recordingUrl" column="recording_url"/>
  36. <result property="durationTime" column="duration_time"/>
  37. <result property="coverUrl" column="cover_url"/>
  38. <result property="code" column="code"/>
  39. <collection property="businessList" column="section_id" select="findBusinessList"/>
  40. <collection property="chapterList" column="section_id" select="findChapterList"/>
  41. <!-- <collection property="moduleList" javaType="java.util.List" resultMap="CourseModuleChapterListResult"/>
  42. <collection property="courseList" javaType="java.util.List" resultMap="CourseSectionListResult"/> -->
  43. </resultMap>
  44. <select id="findChapterList" resultMap="CourseChapterSectionListResult">
  45. SELECT
  46. ccs.chapter_id,
  47. cc.NAME AS chapter_name
  48. FROM
  49. course_chapter_section ccs
  50. LEFT JOIN course_chapter cc ON ccs.chapter_id = cc.chapter_id
  51. WHERE
  52. ccs.id =#{section_id}
  53. </select>
  54. <select id="findBusinessList" resultMap="CourseSectionBusiness">
  55. SELECT
  56. csb.education_type_id,
  57. csb.id,
  58. csb.business_id,
  59. csb.subject_id,
  60. csb.project_id,
  61. cet.education_name,
  62. cpt.project_name,
  63. cb.business_name,
  64. cs.subject_name
  65. FROM
  66. course_section_business csb
  67. LEFT JOIN course_education_type cet ON csb.education_type_id = cet.id
  68. LEFT JOIN course_project_type cpt ON csb.project_id = cpt.id
  69. LEFT JOIN course_business cb ON csb.business_id = cb.id
  70. LEFT JOIN course_subject cs ON csb.subject_id = cs.id
  71. WHERE
  72. csb.section_id=#{section_id}
  73. </select>
  74. <resultMap type="com.zhongzheng.modules.course.domain.CourseSectionBusiness" id="CourseSectionBusiness">
  75. <result property="id" column="id"/>
  76. <result property="subjectId" column="subject_id"/>
  77. <result property="educationTypeId" column="education_type_id"/>
  78. <result property="businessId" column="business_id"/>
  79. <result property="projectId" column="project_id"/>
  80. <result property="educationName" column="education_name"/>
  81. <result property="projectName" column="project_name"/>
  82. <result property="businessName" column="business_name"/>
  83. <result property="subjectName" column="subject_name"/>
  84. </resultMap>
  85. <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterSectionListVo" id="CourseChapterSectionListResult">
  86. <result property="chapterName" column="chapter_name"/>
  87. <result property="chapterId" column="chapter_id"/>
  88. </resultMap>
  89. <resultMap type="com.zhongzheng.modules.course.vo.CourseModuleChapterListVo" id="CourseModuleChapterListResult">
  90. <result property="moduleId" column="module_id"/>
  91. <result property="moduleName" column="module_name"/>
  92. </resultMap>
  93. <resultMap type="com.zhongzheng.modules.course.vo.CourseSectionListVo" id="CourseSectionListResult">
  94. <result property="courseId" column="course_id"/>
  95. <result property="courseName" column="course_name"/>
  96. </resultMap>
  97. <select id="selectSectionList" parameterType="com.zhongzheng.modules.course.bo.CourseSectionQueryBo" resultMap="CourseSectionResultVo">
  98. SELECT
  99. c.*
  100. FROM
  101. course_section c
  102. LEFT JOIN course_section_business csb ON csb.section_id = c.section_id
  103. WHERE
  104. 1 = 1
  105. <if test="name != null and name != ''">
  106. AND c.name like concat('%', #{name}, '%')
  107. </if>
  108. <if test="publishStatus != null and publishStatus != ''">
  109. AND c.publish_status = #{publishStatus}
  110. </if>
  111. <if test="educationTypeId != null and educationTypeId != ''">
  112. AND csb.education_type_id = #{educationTypeId}
  113. </if>
  114. <if test="subjectId != null and subjectId != ''">
  115. AND csb.subject_id = #{subjectId}
  116. </if>
  117. <if test="businessId != null and businessId != ''">
  118. AND csb.business_id = #{businessId}
  119. </if>
  120. <if test="sectionType != null and sectionType != ''">
  121. AND c.section_type = #{sectionType}
  122. </if>
  123. <if test="prefixName != null and prefixName != ''">
  124. AND c.prefix_name like concat('%', #{prefixName}, '%')
  125. </if>
  126. <if test="status != null and status.size()!=0 ">
  127. AND c.status in
  128. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  129. #{item}
  130. </foreach>
  131. </if>
  132. GROUP BY
  133. c.section_id
  134. ORDER BY c.section_id DESC
  135. </select>
  136. <select id="selectSectionList_COUNT" resultType="Long">
  137. SELECT
  138. count(distinct c.section_id )
  139. FROM
  140. course_section c
  141. LEFT JOIN course_section_business csb ON c.section_id = csb.section_id
  142. WHERE
  143. 1 = 1
  144. <if test="name != null and name != ''">
  145. AND c.name like concat('%', #{name}, '%')
  146. </if>
  147. <if test="publishStatus != null and publishStatus != ''">
  148. AND c.publish_status = #{publishStatus}
  149. </if>
  150. <if test="educationTypeId != null and educationTypeId != ''">
  151. AND csb.education_type_id = #{educationTypeId}
  152. </if>
  153. <if test="subjectId != null and subjectId != ''">
  154. AND csb.subject_id = #{subjectId}
  155. </if>
  156. <if test="businessId != null and businessId != ''">
  157. AND csb.business_id = #{businessId}
  158. </if>
  159. <if test="sectionType != null and sectionType != ''">
  160. AND c.section_type = #{sectionType}
  161. </if>
  162. <if test="prefixName != null and prefixName != ''">
  163. AND c.prefix_name like concat('%', #{prefixName}, '%')
  164. </if>
  165. <if test="status != null and status.size()!=0 ">
  166. AND c.status in
  167. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  168. #{item}
  169. </foreach>
  170. </if>
  171. </select>
  172. </mapper>