he2802 4 سال پیش
والد
کامیت
69b773b05a

+ 5 - 5
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseModuleChapterController.java

@@ -7,6 +7,7 @@ import com.zhongzheng.modules.course.bo.CourseModuleChapterAddBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterEditBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterQueryBo;
 import com.zhongzheng.modules.course.service.ICourseModuleChapterService;
+import com.zhongzheng.modules.course.vo.CourseMenuVo;
 import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
 import lombok.RequiredArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -56,11 +57,10 @@ public class CourseModuleChapterController extends BaseController {
 
     @ApiOperation("查询模块与章关系列表")
     @PreAuthorize("@ss.hasPermi('system:chapter:list')")
-    @GetMapping("/allList")
-    public TableDataInfo<CourseModuleChapterVo> all_list(CourseModuleChapterQueryBo bo) {
-        startPage();
-        List<CourseModuleChapterVo> list = iCourseModuleChapterService.queryList(bo);
-        return getDataTable(list);
+    @GetMapping("/allList{id}")
+    public AjaxResult<List<CourseModuleChapterVo>> all_list(@PathVariable("id" ) Long id) {
+        List<CourseModuleChapterVo> list = iCourseModuleChapterService.getListById(id);
+        return AjaxResult.success(list);
     }
 
     /**

+ 5 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseModuleChapterMapper.java

@@ -2,6 +2,10 @@ package com.zhongzheng.modules.course.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.domain.CourseModuleChapter;
+import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
+import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
+
+import java.util.List;
 
 /**
  * 模块与章关系Mapper接口
@@ -10,5 +14,5 @@ import com.zhongzheng.modules.course.domain.CourseModuleChapter;
  * @date 2021-10-11
  */
 public interface CourseModuleChapterMapper extends BaseMapper<CourseModuleChapter> {
-
+    List<CourseModuleChapterVo> getListById(Long id);
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseModuleChapterService.java

@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterAddBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterEditBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterQueryBo;
+import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseModuleChapter;
+import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
 import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
+import com.zhongzheng.modules.course.vo.CourseSectionVo;
 
 import java.util.Collection;
 import java.util.List;
@@ -23,6 +26,8 @@ public interface ICourseModuleChapterService extends IService<CourseModuleChapte
 	 */
 	CourseModuleChapterVo queryById(Long id);
 
+	List<CourseModuleChapterVo> getListById(Long id);
+
 	/**
 	 * 查询列表
 	 */

+ 14 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleChapterServiceImpl.java

@@ -6,10 +6,15 @@ import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterAddBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterEditBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterQueryBo;
+import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseModuleChapter;
+import com.zhongzheng.modules.course.mapper.CourseChapterSectionMapper;
 import com.zhongzheng.modules.course.mapper.CourseModuleChapterMapper;
 import com.zhongzheng.modules.course.service.ICourseModuleChapterService;
+import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
 import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
+import com.zhongzheng.modules.course.vo.CourseSectionVo;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -30,12 +35,21 @@ import java.util.stream.Collectors;
 @Service
 public class CourseModuleChapterServiceImpl extends ServiceImpl<CourseModuleChapterMapper, CourseModuleChapter> implements ICourseModuleChapterService {
 
+    @Autowired
+    private CourseModuleChapterMapper courseModuleChapterMapper;
+
     @Override
     public CourseModuleChapterVo queryById(Long id){
         CourseModuleChapter db = this.baseMapper.selectById(id);
         return BeanUtil.toBean(db, CourseModuleChapterVo.class);
     }
 
+    @Override
+    public List<CourseModuleChapterVo> getListById(Long id) {
+        return courseModuleChapterMapper.getListById(id);
+    }
+
+
     @Override
     public List<CourseModuleChapterVo> queryList(CourseModuleChapterQueryBo bo) {
         LambdaQueryWrapper<CourseModuleChapter> lqw = Wrappers.lambdaQuery();

+ 25 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseModuleChapterVo.java

@@ -32,4 +32,29 @@ public class CourseModuleChapterVo {
 	@Excel(name = "章ID")
 	@ApiModelProperty("章ID")
 	private Long chapterId;
+
+	/** 编码 */
+	@Excel(name = "编码")
+	@ApiModelProperty("编码")
+	private String code;
+	/** 名称 */
+	@Excel(name = "名称")
+	@ApiModelProperty("名称")
+	private String name;
+	/** 前缀名称 */
+	@Excel(name = "前缀名称")
+	@ApiModelProperty("前缀名称")
+	private String prefixName;
+	/** 状态 1正常 0关闭 */
+	@Excel(name = "状态 1正常 0关闭")
+	@ApiModelProperty("状态 1正常 0关闭")
+	private Integer status;
+	/** 发布状态 1发布 0未发布 */
+	@Excel(name = "发布状态 1发布 0未发布")
+	@ApiModelProperty("发布状态 1发布 0未发布")
+	private Integer publishStatus;
+	/** $column.columnComment */
+	@Excel(name = "排序")
+	@ApiModelProperty("$column.columnComment")
+	private Long sort;
 }

+ 8 - 9
zhongzheng-system/src/main/resources/mapper/modules/course/CourseModuleChapterMapper.xml

@@ -21,22 +21,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="name" column="name"/>
         <result property="prefixName" column="prefix_name"/>
         <result property="status" column="status"/>
-        <result property="sectionType" column="section_type"/>
         <result property="publishStatus" column="publish_status"/>
     </resultMap>
 
     <select id="getListById" parameterType="Long"  resultMap="CourseModuleChapterResultVo">
         SELECT
-            cs.*,
-            ccs.sort as c_sort,
-            ccs.id,
-            ccs.chapter_id
+            cc.*,
+            cmc.sort AS c_sort,
+            cmc.id,
+            cmc.module_id
         FROM
-            course_chapter_section ccs
-                LEFT JOIN course_section cs ON ccs.section_id = cs.section_id
+            course_module_chapter cmc
+                LEFT JOIN course_chapter cc ON cmc.chapter_id = cc.chapter_id
         WHERE
-            cs.`status` !=- 1
-	        AND ccs.chapter_id = #{id}
+            cc.`status` !=- 1
+	AND cmc.module_id = #{id}
         ORDER BY
             c_sort DESC
     </select>