CourseChapterSectionMapper.xml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. <select id="getListById" parameterType="Long" resultMap="CourseChapterSectionResultVo">
  27. SELECT
  28. cs.*,
  29. ccs.sort as c_sort,
  30. ccs.id,
  31. ccs.chapter_id
  32. FROM
  33. course_chapter_section ccs
  34. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  35. WHERE
  36. cs.`status` !=- 1
  37. AND ccs.chapter_id = #{id}
  38. ORDER BY
  39. c_sort DESC
  40. </select>
  41. <select id="getInformById" parameterType="Long" resultMap="CourseChapterSectionResultVo">
  42. SELECT
  43. cs.*,
  44. ccs.sort as c_sort,
  45. ccs.id,
  46. ccs.chapter_id,
  47. 3 as type
  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 DESC
  56. </select>
  57. <select id="getListTotalTime" parameterType="Long" resultType="java.lang.Long">
  58. SELECT
  59. IFNULL(sum( cs.duration_time ),0) AS duration_time
  60. FROM
  61. course_chapter_section ccs
  62. LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
  63. WHERE
  64. cs.`status` !=- 1
  65. AND ccs.chapter_id =#{id}
  66. </select>
  67. </mapper>