CourseSectionMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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="liveDuration" column="live_duration"/>
  20. <result property="recordingUrl" column="recording_url"/>
  21. <result property="recordingDuration" column="recording_duration"/>
  22. <result property="coverUrl" column="cover_url"/>
  23. <result property="code" column="code"/>
  24. </resultMap>
  25. <resultMap type="com.zhongzheng.modules.course.vo.CourseSectionVo" id="CourseSectionResultVo">
  26. <result property="sectionId" column="section_id"/>
  27. <result property="name" column="name"/>
  28. <result property="sort" column="sort"/>
  29. <result property="prefixName" column="prefix_name"/>
  30. <result property="status" column="status"/>
  31. <result property="sectionType" column="section_type"/>
  32. <result property="publishStatus" column="publish_status"/>
  33. <result property="liveUrl" column="live_url"/>
  34. <result property="liveStartTime" column="live_start_time"/>
  35. <result property="liveEndTime" column="live_end_time"/>
  36. <result property="liveDuration" column="live_duration"/>
  37. <result property="recordingUrl" column="recording_url"/>
  38. <result property="recordingDuration" column="recording_duration"/>
  39. <result property="coverUrl" column="cover_url"/>
  40. <result property="code" column="code"/>
  41. <collection property="businessList" javaType="java.util.List" resultMap="CourseSectionBusiness"/>
  42. <collection property="chapterList" javaType="java.util.List" resultMap="CourseChapterSectionListResult"/>
  43. </resultMap>
  44. <resultMap type="com.zhongzheng.modules.course.domain.CourseSectionBusiness" id="CourseSectionBusiness">
  45. <result property="id" column="id"/>
  46. <result property="subjectId" column="subject_id"/>
  47. <result property="educationTypeId" column="education_type_id"/>
  48. <result property="businessId" column="business_id"/>
  49. <result property="projectId" column="project_id"/>
  50. <result property="educationName" column="education_name"/>
  51. <result property="projectName" column="project_name"/>
  52. <result property="businessName" column="business_name"/>
  53. <result property="subjectName" column="subject_name"/>
  54. </resultMap>
  55. <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterSectionListVo" id="CourseChapterSectionListResult">
  56. <result property="chapterName" column="chapter_name"/>
  57. <result property="chapterId" column="chapter_id"/>
  58. </resultMap>
  59. <select id="selectSectionList" parameterType="com.zhongzheng.modules.course.bo.CourseSectionQueryBo" resultMap="CourseSectionResultVo">
  60. SELECT
  61. c.*,
  62. csb.education_type_id,
  63. csb.id,
  64. csb.business_id,
  65. csb.subject_id,
  66. csb.project_id,
  67. cet.education_name,
  68. cpt.project_name,
  69. cb.business_name,
  70. cs.subject_name,
  71. ccs.chapter_id,
  72. cc.NAME AS chapter_name
  73. FROM
  74. course_section c
  75. LEFT JOIN course_section_business csb ON c.section_id = csb.section_id
  76. LEFT JOIN course_education_type cet ON csb.education_type_id = cet.id
  77. LEFT JOIN course_project_type cpt ON csb.project_id = cpt.id
  78. LEFT JOIN course_business cb ON csb.business_id = cb.id
  79. LEFT JOIN course_subject cs ON csb.subject_id = cs.id
  80. LEFT JOIN course_chapter_section ccs ON csb.id = ccs.section_id
  81. LEFT JOIN course_chapter cc ON ccs.chapter_id = cc.chapter_id
  82. WHERE
  83. 1 = 1
  84. <if test="name != null and name != ''">
  85. AND c.name like concat('%', #{name}, '%')
  86. </if>
  87. <if test="publishStatus != null and publishStatus != ''">
  88. AND c.publish_status = #{publishStatus}
  89. </if>
  90. <if test="educationTypeId != null and educationTypeId != ''">
  91. AND csb.education_type_id = #{educationTypeId}
  92. </if>
  93. <if test="subjectId != null and subjectId != ''">
  94. AND csb.subject_id = #{subjectId}
  95. </if>
  96. <if test="businessId != null and businessId != ''">
  97. AND csb.business_id = #{businessId}
  98. </if>
  99. <if test="sectionType != null and sectionType != ''">
  100. AND c.section_type = #{sectionType}
  101. </if>
  102. <if test="prefixName != null and prefixName != ''">
  103. AND c.prefix_name like concat('%', #{prefixName}, '%')
  104. </if>
  105. </select>
  106. </mapper>