瀏覽代碼

节业务层

he2802 4 年之前
父節點
當前提交
762ace16e2

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

@@ -6,6 +6,8 @@ import java.util.Arrays;
 import com.zhongzheng.modules.course.bo.CourseSectionAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionEditBo;
 import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
+import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
+import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
 import com.zhongzheng.modules.course.service.ICourseSectionService;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import lombok.RequiredArgsConstructor;
@@ -37,11 +39,13 @@ import io.swagger.annotations.ApiOperation;
 @Api(value = "课程小节控制器", tags = {"课程小节管理"})
 @RequiredArgsConstructor(onConstructor_ = @Autowired)
 @RestController
-@RequestMapping("/system/section")
+@RequestMapping("/course/section")
 public class CourseSectionController extends BaseController {
 
     private final ICourseSectionService iCourseSectionService;
 
+    private final ICourseSectionBusinessService iCourseSectionBusinessService;
+
     /**
      * 查询课程小节列表
      */
@@ -109,4 +113,15 @@ public class CourseSectionController extends BaseController {
     public AjaxResult<Void> remove(@PathVariable Long[] sectionIds) {
         return toAjax(iCourseSectionService.deleteWithValidByIds(Arrays.asList(sectionIds), true) ? 1 : 0);
     }*/
+
+    /**
+     * 获取课程小节详细信息
+     */
+    @ApiOperation("获取课程小节业务层次列表")
+    @PreAuthorize("@ss.hasPermi('system:section:query')")
+    @GetMapping("/business/{sectionId}")
+    public AjaxResult<List<CourseSectionBusiness>> getBusinessList(@PathVariable("sectionId" ) Long sectionId) {
+        List<CourseSectionBusiness> list = iCourseSectionBusinessService.getListById(sectionId);
+        return AjaxResult.success(list);
+    }
 }

+ 9 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/domain/CourseSectionBusiness.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;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseSectionBusinessMapper.java

@@ -2,6 +2,9 @@ package com.zhongzheng.modules.course.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
+import com.zhongzheng.modules.course.vo.CourseSectionBusinessVo;
+
+import java.util.List;
 
 /**
  * 课程节适用业务关系Mapper接口
@@ -10,5 +13,6 @@ import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
  * @date 2021-10-11
  */
 public interface CourseSectionBusinessMapper extends BaseMapper<CourseSectionBusiness> {
+    List<CourseSectionBusiness> getListById(Long id);
 
 }

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

@@ -23,6 +23,8 @@ public interface ICourseSectionBusinessService extends IService<CourseSectionBus
 	 */
 	CourseSectionBusinessVo queryById(Long id);
 
+	List<CourseSectionBusiness> getListById(Long id);
+
 	/**
 	 * 查询列表
 	 */

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionBusinessServiceImpl.java

@@ -9,7 +9,9 @@ import com.zhongzheng.modules.course.bo.CourseSectionBusinessQueryBo;
 import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
 import com.zhongzheng.modules.course.mapper.CourseSectionBusinessMapper;
 import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
+import com.zhongzheng.modules.course.service.IMajorService;
 import com.zhongzheng.modules.course.vo.CourseSectionBusinessVo;
+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 +32,20 @@ import java.util.stream.Collectors;
 @Service
 public class CourseSectionBusinessServiceImpl extends ServiceImpl<CourseSectionBusinessMapper, CourseSectionBusiness> implements ICourseSectionBusinessService {
 
+    @Autowired
+    private CourseSectionBusinessMapper courseSectionBusinessMapper;
+
     @Override
     public CourseSectionBusinessVo queryById(Long id){
         CourseSectionBusiness db = this.baseMapper.selectById(id);
         return BeanUtil.toBean(db, CourseSectionBusinessVo.class);
     }
 
+    @Override
+    public List<CourseSectionBusiness> getListById(Long id) {
+        return courseSectionBusinessMapper.getListById(id);
+    }
+
     @Override
     public List<CourseSectionBusinessVo> queryList(CourseSectionBusinessQueryBo bo) {
         LambdaQueryWrapper<CourseSectionBusiness> lqw = Wrappers.lambdaQuery();

+ 21 - 1
zhongzheng-system/src/main/resources/mapper/modules/course/CourseSectionBusinessMapper.xml

@@ -11,7 +11,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="businessId" column="business_id"/>
         <result property="subjectId" column="subject_id"/>
         <result property="projectId" column="project_id"/>
-    </resultMap>
 
+        <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>
 
+    <select id="getListById" parameterType="Long"  resultMap="CourseSectionBusinessResult">
+        SELECT
+            csb.*,
+            cet.education_name,
+            cpt.project_name,
+            cb.business_name,
+            cs.subject_name
+        FROM
+            course_section_business csb
+                LEFT JOIN course_education_type cet ON csb.education_type_id = cet.id
+                LEFT JOIN course_project_type cpt ON csb.project_id = cpt.id
+                LEFT JOIN course_business cb ON csb.business_id = cb.id
+                LEFT JOIN course_subject cs ON csb.subject_id = cs.id
+        WHERE
+            csb.section_id =#{id}
+    </select>
 </mapper>