he2802 před 4 roky
rodič
revize
748dc73481

+ 1 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseChapterController.java

@@ -50,7 +50,7 @@ public class CourseChapterController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<CourseChapterVo> list(CourseChapterQueryBo bo) {
         startPage();
-        List<CourseChapterVo> list = iCourseChapterService.queryList(bo);
+        List<CourseChapterVo> list = iCourseChapterService.selectList(bo);
         return getDataTable(list);
     }
 

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseChapterQueryBo.java

@@ -58,4 +58,13 @@ public class CourseChapterQueryBo extends BaseEntity {
 	/** 编码 */
 	@ApiModelProperty("编码")
 	private String code;
+	/** 教育类型id */
+	@ApiModelProperty("教育类型id")
+	private Long educationTypeId;
+	/** 业务层次id */
+	@ApiModelProperty("业务层次id")
+	private Long businessId;
+	/** 科目id */
+	@ApiModelProperty("科目id")
+	private Long subjectId;
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CourseChapterBusiness.java

@@ -36,4 +36,13 @@ private static final long serialVersionUID=1L;
     private Long subjectId;
     /** 项目ID */
     private Long projectId;
+
+    @TableField(exist = false)
+    private String educationName;
+    @TableField(exist = false)
+    private String projectName;
+    @TableField(exist = false)
+    private String businessName;
+    @TableField(exist = false)
+    private String subjectName;
 }

+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseChapterMapper.java

@@ -2,7 +2,13 @@ package com.zhongzheng.modules.course.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.course.bo.CourseChapterQueryBo;
+import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseChapter;
+import com.zhongzheng.modules.course.vo.CourseChapterVo;
+import com.zhongzheng.modules.course.vo.CourseSectionVo;
+
+import java.util.List;
 
 /**
  * 课程大章Mapper接口
@@ -11,5 +17,5 @@ import com.zhongzheng.modules.course.domain.CourseChapter;
  * @date 2021-10-09
  */
 public interface CourseChapterMapper extends BaseMapper<CourseChapter> {
-
+    List<CourseChapterVo> selectList(CourseChapterQueryBo bo);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseChapterService.java

@@ -28,6 +28,8 @@ public interface ICourseChapterService extends IService<CourseChapter> {
 	 */
 	List<CourseChapterVo> queryList(CourseChapterQueryBo bo);
 
+	List<CourseChapterVo> selectList(CourseChapterQueryBo bo);
+
 	/**
 	 * 根据新增业务对象插入课程大章
 	 * @param bo 课程大章新增业务对象

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterServiceImpl.java

@@ -9,6 +9,7 @@ import com.zhongzheng.modules.course.domain.CourseChapter;
 import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
 import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
 import com.zhongzheng.modules.course.mapper.CourseChapterMapper;
+import com.zhongzheng.modules.course.mapper.CourseSectionMapper;
 import com.zhongzheng.modules.course.service.ICourseChapterBusinessService;
 import com.zhongzheng.modules.course.service.ICourseChapterService;
 import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
@@ -37,6 +38,9 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
     @Autowired
     private ICourseChapterBusinessService iCourseChapterBusinessService;
 
+    @Autowired
+    private CourseChapterMapper courseChapterMapper;
+
     @Override
     public CourseChapterVo queryById(Long chapterId){
         CourseChapter db = this.baseMapper.selectById(chapterId);
@@ -56,6 +60,11 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
         return entity2Vo(this.list(lqw));
     }
 
+    @Override
+    public List<CourseChapterVo> selectList(CourseChapterQueryBo bo) {
+        return courseChapterMapper.selectList(bo);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 12 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseChapterVo.java

@@ -2,11 +2,13 @@ package com.zhongzheng.modules.course.vo;
 
 import com.zhongzheng.common.annotation.Excel;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zhongzheng.modules.course.domain.CourseChapterBusiness;
+import com.zhongzheng.modules.course.domain.CourseStreamingBusiness;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import java.util.Date;
-
+import java.util.List;
 
 
 /**
@@ -52,4 +54,13 @@ public class CourseChapterVo {
 	@Excel(name = "编码")
 	@ApiModelProperty("编码")
 	private String code;
+	/** 业务层级列表 */
+	@ApiModelProperty("业务层级列表")
+	private List<CourseChapterBusiness> businessList;
+	/** 模块列表 */
+	@ApiModelProperty("模块列表")
+	private List<CourseModuleChapterListVo> moduleList;
+	/** 课程列表 */
+	@ApiModelProperty("课程列表")
+	private List<CourseSectionListVo> courseList;
 }

+ 84 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseChapterMapper.xml

@@ -17,5 +17,89 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="code" column="code"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.course.vo.CourseChapterVo" id="CourseChapterResultVo">
+        <result property="chapterId" column="chapter_id"/>
+        <result property="name" column="name"/>
+        <result property="sort" column="sort"/>
+        <result property="status" column="status"/>
+        <result property="prefixName" column="prefix_name"/>
+        <result property="coverUrl" column="cover_url"/>
+        <result property="publishStatus" column="publish_status"/>
+        <result property="code" column="code"/>
+        <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"/>
+    </resultMap>
+
+    <resultMap type="com.zhongzheng.modules.course.domain.CourseChapterBusiness" id="CourseChapterBusiness">
+        <result property="id" column="id"/>
+        <result property="subjectId" column="subject_id"/>
+        <result property="educationTypeId" column="education_type_id"/>
+        <result property="businessId" column="business_id"/>
+        <result property="projectId" column="project_id"/>
+
+        <result property="educationName" column="education_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="businessName" column="business_name"/>
+        <result property="subjectName" column="subject_name"/>
+    </resultMap>
+
+    <resultMap type="com.zhongzheng.modules.course.vo.CourseModuleChapterListVo" id="CourseModuleChapterListResult">
+        <result property="moduleId" column="module_id"/>
+        <result property="moduleName" column="module_name"/>
+    </resultMap>
+
+    <resultMap type="com.zhongzheng.modules.course.vo.CourseSectionListVo" id="CourseSectionListResult">
+        <result property="courseId" column="course_id"/>
+        <result property="courseName" column="course_name"/>
+    </resultMap>
 
+    <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
+        FROM
+            course_chapter c
+                LEFT JOIN course_chapter_business ccb ON c.chapter_id = ccb.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 = 3 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 ">
+            AND c.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="publishStatus != null and publishStatus != ''">
+            AND c.publish_status = #{publishStatus}
+        </if>
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND csb.education_type_id = #{educationTypeId}
+        </if>
+        <if test="subjectId != null and subjectId != ''">
+            AND csb.subject_id = #{subjectId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND csb.business_id = #{businessId}
+        </if>
+   </select>
 </mapper>