CourseChapterSectionMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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.CourseChapterSectionMapper">
  6. <resultMap type="com.zhongzheng.modules.course.domain.CourseChapterSection" id="CourseChapterSectionResult">
  7. <result property="sectionId" column="section_id"/>
  8. <result property="chapterId" column="chapter_id"/>
  9. <result property="sort" column="sort"/>
  10. <result property="id" column="id"/>
  11. </resultMap>
  12. <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterSectionVo" id="CourseChapterSectionResultVo">
  13. <result property="sectionId" column="section_id"/>
  14. <result property="chapterId" column="chapter_id"/>
  15. <result property="sort" column="c_sort"/>
  16. <result property="id" column="id"/>
  17. <result property="type" column="type"/>
  18. <result property="code" column="code"/>
  19. <result property="name" column="name"/>
  20. <result property="prefixName" column="prefix_name"/>
  21. <result property="status" column="status"/>
  22. <result property="sectionType" column="section_type"/>
  23. <result property="publishStatus" column="publish_status"/>
  24. <result property="durationTime" column="duration_time"/>
  25. </resultMap>
  26. <resultMap type="com.zhongzheng.modules.course.vo.CourseUserChapterSectionVo" id="CourseUserChapterSectionVo">
  27. <result property="typeId" column="type_id"/>
  28. <result property="chapterId" column="chapter_id"/>
  29. <result property="sort" column="c_sort"/>
  30. <result property="id" column="id"/>
  31. <result property="type" column="type"/>
  32. <result property="code" column="code"/>
  33. <result property="name" column="name"/>
  34. <result property="prefixName" column="prefix_name"/>
  35. <result property="status" column="status"/>
  36. <result property="sectionType" column="section_type"/>
  37. <result property="publishStatus" column="publish_status"/>
  38. <result property="durationTime" column="duration_time"/>
  39. <result property="liveStartTime" column="live_start_time"/>
  40. <result property="liveEndTime" column="live_end_time"/>
  41. </resultMap>
  42. <select id="getListById" parameterType="Long" resultMap="CourseChapterSectionResultVo">
  43. SELECT
  44. cs.*,
  45. ccs.sort as c_sort,
  46. ccs.id,
  47. ccs.chapter_id
  48. FROM
  49. course_chapter_section ccs
  50. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  51. WHERE
  52. cs.`status` !=- 1
  53. AND ccs.chapter_id = #{id}
  54. ORDER BY
  55. c_sort asc
  56. </select>
  57. <select id="getInformById" parameterType="Long" resultMap="CourseChapterSectionResultVo">
  58. SELECT
  59. cs.*,
  60. ccs.sort as c_sort,
  61. ccs.id,
  62. ccs.chapter_id,
  63. 3 as type
  64. FROM
  65. course_chapter_section ccs
  66. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  67. WHERE
  68. cs.`status` !=- 1
  69. AND ccs.chapter_id = #{id}
  70. ORDER BY
  71. c_sort DESC
  72. </select>
  73. <select id="sectionList" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo" resultMap="CourseUserChapterSectionVo">
  74. SELECT
  75. cs.section_id as type_id,
  76. #{gradeId} as grade_id,
  77. <if test="moduleId != null ">
  78. #{moduleId} as module_id,
  79. </if>
  80. <if test="moduleId == null ">
  81. 0 as module_id,
  82. </if>
  83. cs.*,
  84. ccs.sort as c_sort,
  85. ccs.id,
  86. ccs.chapter_id,
  87. 1 as type,
  88. cmc.module_id
  89. FROM
  90. course_chapter_section ccs
  91. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  92. LEFT JOIN course_module_chapter cmc ON cmc.chapter_id = ccs.chapter_id
  93. WHERE
  94. cs.`status` = 1
  95. AND ccs.chapter_id = #{chapterId}
  96. ORDER BY
  97. c_sort DESC
  98. </select>
  99. <select id="examList" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo" resultMap="CourseUserChapterSectionVo">
  100. SELECT
  101. e.*,
  102. cme.course_id,
  103. cme.module_id,
  104. cme.chapter_id,
  105. cme.section_id,
  106. e.exam_name as name,
  107. e.exam_id as type_id,
  108. #{gradeId} as grade_id,
  109. 2 as type
  110. FROM
  111. exam e
  112. LEFT JOIN course_menu_exam cme ON cme.exam_id = e.exam_id
  113. where 1=1
  114. and cme.chapter_id = #{chapterId}
  115. and cme.course_id = #{courseId}
  116. </select>
  117. <select id="getListTotalTime" parameterType="Long" resultType="java.lang.Long">
  118. SELECT
  119. IFNULL(sum( cs.duration_time ),0) AS duration_time
  120. FROM
  121. course_chapter_section ccs
  122. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  123. WHERE
  124. cs.`status` !=- 1
  125. AND ccs.chapter_id =#{id}
  126. </select>
  127. <select id="rebuildCheck" parameterType="map" resultType="integer">
  128. SELECT
  129. COUNT(up.id)
  130. FROM
  131. user_period up
  132. LEFT JOIN user_period_status ups ON up.id = ups.period_id
  133. WHERE
  134. up.grade_id =#{gradeId}
  135. AND up.user_id = #{userId}
  136. AND up.module_id= #{moduleId}
  137. and up.chapter_id=#{chapterId}
  138. and up.section_id=#{typeId}
  139. and up.exam_id=#{examId}
  140. AND ups.period_status =1
  141. and (ups.`status` = 0 or ups.`status` = 3)
  142. </select>
  143. </mapper>