CourseSectionMapper.xml 8.6 KB

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