CourseChapterSectionMapper.xml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. </resultMap>
  40. <select id="getListById" parameterType="Long" resultMap="CourseChapterSectionResultVo">
  41. SELECT
  42. cs.*,
  43. ccs.sort as c_sort,
  44. ccs.id,
  45. ccs.chapter_id
  46. FROM
  47. course_chapter_section ccs
  48. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  49. WHERE
  50. cs.`status` !=- 1
  51. AND ccs.chapter_id = #{id}
  52. ORDER BY
  53. c_sort DESC
  54. </select>
  55. <select id="getInformById" parameterType="Long" resultMap="CourseChapterSectionResultVo">
  56. SELECT
  57. cs.*,
  58. ccs.sort as c_sort,
  59. ccs.id,
  60. ccs.chapter_id,
  61. 3 as type
  62. FROM
  63. course_chapter_section ccs
  64. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  65. WHERE
  66. cs.`status` !=- 1
  67. AND ccs.chapter_id = #{id}
  68. ORDER BY
  69. c_sort DESC
  70. </select>
  71. <select id="sectionList" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo" resultMap="CourseUserChapterSectionVo">
  72. SELECT
  73. cs.section_id as type_id,
  74. #{gradeId} as grade_id,
  75. <if test="moduleId != null ">
  76. #{moduleId} as module_id,
  77. </if>
  78. <if test="moduleId == null ">
  79. 0 as module_id,
  80. </if>
  81. cs.*,
  82. ccs.sort as c_sort,
  83. ccs.id,
  84. ccs.chapter_id,
  85. 1 as type,
  86. cmc.module_id
  87. FROM
  88. course_chapter_section ccs
  89. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  90. LEFT JOIN course_module_chapter cmc ON cmc.chapter_id = ccs.chapter_id
  91. WHERE
  92. cs.`status` = 1
  93. AND ccs.chapter_id = #{chapterId}
  94. ORDER BY
  95. c_sort DESC
  96. </select>
  97. <select id="examList" parameterType="com.zhongzheng.modules.course.bo.CourseMenuQueryBo" resultMap="CourseUserChapterSectionVo">
  98. SELECT
  99. e.*,
  100. cme.course_id,
  101. cme.module_id,
  102. cme.chapter_id,
  103. cme.section_id,
  104. e.exam_name as name,
  105. e.exam_id as type_id,
  106. #{gradeId} as grade_id,
  107. 2 as type
  108. FROM
  109. exam e
  110. LEFT JOIN course_menu_exam cme ON cme.exam_id = e.exam_id
  111. where 1=1
  112. and cme.chapter_id = #{chapterId}
  113. and cme.course_id = #{courseId}
  114. </select>
  115. <select id="getListTotalTime" parameterType="Long" resultType="java.lang.Long">
  116. SELECT
  117. IFNULL(sum( cs.duration_time ),0) AS duration_time
  118. FROM
  119. course_chapter_section ccs
  120. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  121. WHERE
  122. cs.`status` !=- 1
  123. AND ccs.chapter_id =#{id}
  124. </select>
  125. <select id="rebuildCheck" parameterType="map" resultType="integer">
  126. SELECT
  127. COUNT(up.id)
  128. FROM
  129. user_period up
  130. LEFT JOIN user_period_status ups ON up.id = ups.period_id
  131. WHERE
  132. up.grade_id =#{gradeId}
  133. AND up.user_id = #{userId}
  134. AND up.module_id= #{moduleId}
  135. and up.chapter_id=#{chapterId}
  136. and up.section_id=#{typeId}
  137. and up.exam_id=#{examId}
  138. AND ups.period_status =1
  139. and (ups.`status` = 0 or ups.`status` = 3)
  140. </select>
  141. </mapper>