소스 검색

fix 计费单商品

he2802 3 년 전
부모
커밋
8c2340d309
1개의 변경된 파일52개의 추가작업 그리고 22개의 파일을 삭제
  1. 52 22
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterMapper.xml

+ 52 - 22
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterMapper.xml

@@ -28,9 +28,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="code" column="code"/>
         <result property="sectionNum" column="section_num"/>
         <result property="durationTime" column="duration_time"/>
-        <collection property="businessList" javaType="java.util.List" resultMap="CourseChapterBusiness"/>
-        <collection property="moduleList" javaType="java.util.List" resultMap="CourseModuleChapterListResult"/>
-        <collection property="courseList" javaType="java.util.List" resultMap="CourseSectionListResult"/>
+        <collection property="businessList" column="chapter_id" select="findBusinessList"/>
+        <collection property="moduleList" column="chapter_id" select="findModuleList"/>
+        <collection property="courseList" column="chapter_id" select="findCourseList"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.course.domain.CourseChapterBusiness" id="CourseChapterBusiness">
@@ -56,22 +56,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="courseName" column="course_name"/>
     </resultMap>
 
+    <select id="findCourseList" resultMap="CourseSectionListResult">
+        SELECT
+            m.course_id,
+            co.course_name
+        FROM
+                ( SELECT course_id, menu_id FROM course_menu WHERE type = 2 AND STATUS = 1 ) m
+            LEFT JOIN course co ON m.course_id = co.course_id
+        WHERE
+            m.menu_id=#{chapter_id}
+    </select>
+
+    <select id="findModuleList" resultMap="CourseModuleChapterListResult">
+        SELECT
+            cmc.module_id,
+            cm.module_name
+        FROM
+            course_module_chapter cmc
+            LEFT JOIN course_module cm ON cmc.module_id = cm.module_id
+        WHERE
+            cmc.chapter_id=#{chapter_id}
+    </select>
+
+    <select id="findBusinessList" resultMap="CourseChapterBusiness">
+        SELECT
+            ccb.education_type_id,
+            ccb.id,
+            ccb.business_id,
+            ccb.subject_id,
+            ccb.project_id,
+            cet.education_name,
+            cpt.project_name,
+            cb.business_name,
+            cs.subject_name
+        FROM
+            course_chapter_business ccb
+            LEFT JOIN course_education_type cet ON ccb.education_type_id = cet.id
+            LEFT JOIN course_project_type cpt ON ccb.project_id = cpt.id
+            LEFT JOIN course_business cb ON ccb.business_id = cb.id
+            LEFT JOIN course_subject cs ON ccb.subject_id = cs.id
+        WHERE
+            ccb.chapter_id=#{chapter_id}
+    </select>
+
     <select id="selectList" parameterType="com.zhongzheng.modules.course.bo.CourseChapterQueryBo" resultMap="CourseChapterResultVo">
         SELECT
-        c.*,
-        ccb.education_type_id,
-        ccb.id,
-        ccb.business_id,
-        ccb.subject_id,
-        ccb.project_id,
-        cet.education_name,
-        cpt.project_name,
-        cb.business_name,
-        cs.subject_name,
-        cmc.module_id,
-        cm.module_name,
-        m.course_id,
-        co.course_name
+        c.*
+
+
         FROM
         (
         SELECT
@@ -86,15 +118,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         GROUP BY
         cc.chapter_id
         ) c
-        LEFT JOIN course_chapter_business ccb ON c.chapter_id = ccb.chapter_id
+        LEFT JOIN course_chapter_business ccb ON ccb.chapter_id = c.chapter_id
         LEFT JOIN course_education_type cet ON ccb.education_type_id = cet.id
         LEFT JOIN course_project_type cpt ON ccb.project_id = cpt.id
         LEFT JOIN course_business cb ON ccb.business_id = cb.id
         LEFT JOIN course_subject cs ON ccb.subject_id = cs.id
-        LEFT JOIN course_module_chapter cmc ON c.chapter_id = cmc.chapter_id
-        LEFT JOIN course_module cm ON cmc.module_id = cm.module_id
-        LEFT JOIN ( SELECT course_id, menu_id FROM course_menu WHERE type = 2 AND STATUS = 1 ) m ON c.chapter_id = m.menu_id
-        LEFT JOIN course co ON m.course_id = co.course_id
         WHERE
         1 = 1
         <if test="status != null and status.size()!=0 ">
@@ -121,6 +149,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="prefixName != null and prefixName != ''">
             AND c.prefix_name like concat('%', #{prefixName}, '%')
         </if>
+        GROUP BY
+        c.chapter_id
    </select>