Jelajahi Sumber

模块列表

he2802 4 tahun lalu
induk
melakukan
19a9b87d3c

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

@@ -50,7 +50,7 @@ public class CourseModuleController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<CourseModuleVo> list(CourseModuleQueryBo bo) {
         startPage();
-        List<CourseModuleVo> list = iCourseModuleService.queryList(bo);
+        List<CourseModuleVo> list = iCourseModuleService.selectList(bo);
         return getDataTable(list);
     }
 

+ 9 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseModuleQueryBo.java

@@ -55,5 +55,13 @@ public class CourseModuleQueryBo 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/CourseModuleBusiness.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/CourseModuleMapper.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.CourseModuleQueryBo;
 import com.zhongzheng.modules.course.domain.CourseModule;
+import com.zhongzheng.modules.course.vo.CourseChapterVo;
+import com.zhongzheng.modules.course.vo.CourseModuleVo;
+
+import java.util.List;
 
 /**
  * 课程模块Mapper接口
@@ -11,5 +17,5 @@ import com.zhongzheng.modules.course.domain.CourseModule;
  * @date 2021-10-09
  */
 public interface CourseModuleMapper extends BaseMapper<CourseModule> {
-
+    List<CourseModuleVo> selectList(CourseModuleQueryBo bo);
 }

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

@@ -23,6 +23,8 @@ public interface ICourseModuleService extends IService<CourseModule> {
 	 */
 	CourseModuleVo queryById(Long moduleId);
 
+	List<CourseModuleVo> selectList(CourseModuleQueryBo bo);
+
 	/**
 	 * 查询列表
 	 */

+ 8 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleServiceImpl.java

@@ -38,12 +38,20 @@ public class CourseModuleServiceImpl extends ServiceImpl<CourseModuleMapper, Cou
     @Autowired
     private ICourseModuleChapterService iCourseModuleChapterService;
 
+    @Autowired
+    private CourseModuleMapper courseModuleMapper;
+
     @Override
     public CourseModuleVo queryById(Long moduleId){
         CourseModule db = this.baseMapper.selectById(moduleId);
         return BeanUtil.toBean(db, CourseModuleVo.class);
     }
 
+    @Override
+    public List<CourseModuleVo> selectList(CourseModuleQueryBo bo) {
+        return courseModuleMapper.selectList(bo);
+    }
+
     @Override
     public List<CourseModuleVo> queryList(CourseModuleQueryBo bo) {
         LambdaQueryWrapper<CourseModule> lqw = Wrappers.lambdaQuery();

+ 14 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseModuleVo.java

@@ -2,11 +2,12 @@ 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 io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import java.util.Date;
-
+import java.util.List;
 
 
 /**
@@ -48,5 +49,17 @@ public class CourseModuleVo {
 	@Excel(name = "编码")
 	@ApiModelProperty("编码")
 	private String code;
+	/** 业务层级列表 */
+	@ApiModelProperty("业务层级列表")
+	private List<CourseChapterBusiness> businessList;
+	/** 课程列表 */
+	@ApiModelProperty("课程列表")
+	private List<CourseSectionListVo> courseList;
+	@Excel(name = "节数")
+	@ApiModelProperty("节数")
+	private Integer sectionNum;
+	@Excel(name = "节时间")
+	@ApiModelProperty("节时间")
+	private Integer durationTime;
 
 }

+ 97 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleMapper.xml

@@ -16,5 +16,102 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="code" column="code"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.course.vo.CourseModuleVo" id="CourseModuleResultVo">
+        <result property="moduleId" column="module_id"/>
+        <result property="prefixName" column="prefix_name"/>
+        <result property="moduleName" column="module_name"/>
+        <result property="coverUrl" column="cover_url"/>
+        <result property="publishStatus" column="publish_status"/>
+        <result property="status" column="status"/>
+        <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="CourseModuleBusiness"/>
+        <collection property="courseList" javaType="java.util.List" resultMap="CourseSectionListResult"/>
+    </resultMap>
+
+    <resultMap type="com.zhongzheng.modules.course.domain.CourseModuleBusiness" id="CourseModuleBusiness">
+        <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.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.CourseModuleQueryBo" resultMap="CourseModuleResultVo">
+        SELECT
+        c.*,
+        cmb.education_type_id,
+        cmb.id,
+        cmb.business_id,
+        cmb.subject_id,
+        cmb.project_id,
+        cet.education_name,
+        cpt.project_name,
+        cb.business_name,
+        cs.subject_name,
+        m.course_id,
+        co.course_name
+        FROM
+        (
+        SELECT
+        cm.*,
+        count( ccs.section_id ) AS section_num,
+        COALESCE ( SUM( cs.duration_time ), 0 ) AS duration_time
+        FROM
+        course_module cm
+        LEFT JOIN course_module_chapter cmc ON cm.module_id = cmc.module_id
+        LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
+        LEFT JOIN course_chapter_section ccs ON cc.chapter_id = ccs.chapter_id
+        LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
+        WHERE
+        cm.STATUS !=- 1
+        AND cs.`status` !=- 1
+        GROUP BY
+        cm.module_id
+        ) c
+        LEFT JOIN course_module_business cmb ON cmb.module_id = c.module_id
+        LEFT JOIN course_education_type cet ON cmb.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON cmb.project_id = cpt.id
+        LEFT JOIN course_business cb ON cmb.business_id = cb.id
+        LEFT JOIN course_subject cs ON cmb.subject_id = cs.id
+        LEFT JOIN ( SELECT course_id, menu_id FROM course_menu WHERE type = 1 AND STATUS = 1 ) m ON c.module_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 cmb.education_type_id = #{educationTypeId}
+        </if>
+        <if test="subjectId != null and subjectId != ''">
+            AND cmb.subject_id = #{subjectId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND cmb.business_id = #{businessId}
+        </if>
+        <if test="moduleName != null and moduleName != ''">
+            AND c.module_name like concat('%', #{moduleName}, '%')
+        </if>
+        <if test="prefixName != null and prefixName != ''">
+            AND c.prefix_name like concat('%', #{prefixName}, '%')
+        </if>
+    </select>
 </mapper>