瀏覽代碼

目录列表

he2802 4 年之前
父節點
當前提交
689c17011d

+ 4 - 3
zhongzheng-admin/src/main/java/com/zhongzheng/controller/goods/GoodsCourseController.java

@@ -3,6 +3,7 @@ package com.zhongzheng.controller.goods;
 import java.util.List;
 import java.util.Arrays;
 
+import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseAddBo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseEditBo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
@@ -47,10 +48,10 @@ public class GoodsCourseController extends BaseController {
      */
     @ApiOperation("查询商品课程关系列表")
     @PreAuthorize("@ss.hasPermi('system:course:list')")
-    @GetMapping("/list")
-    public TableDataInfo<GoodsCourseVo> list(GoodsCourseQueryBo bo) {
+    @GetMapping("/list/{id}")
+    public TableDataInfo<CourseVo> list(@PathVariable Long id) {
         startPage();
-        List<GoodsCourseVo> list = iGoodsCourseService.queryList(bo);
+        List<CourseVo> list = iGoodsCourseService.selectList(id);
         return getDataTable(list);
     }
 

+ 6 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/mapper/GoodsCourseMapper.java

@@ -1,7 +1,12 @@
 package com.zhongzheng.modules.goods.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.course.vo.CourseVo;
+import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.domain.GoodsCourse;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
+
+import java.util.List;
 
 /**
  * 商品课程关系Mapper接口
@@ -10,5 +15,5 @@ import com.zhongzheng.modules.goods.domain.GoodsCourse;
  * @date 2021-10-12
  */
 public interface GoodsCourseMapper extends BaseMapper<GoodsCourse> {
-
+    List<CourseVo> selectList(Long goodsId);
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/IGoodsCourseService.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.goods.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseAddBo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseEditBo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
@@ -28,6 +29,8 @@ public interface IGoodsCourseService extends IService<GoodsCourse> {
 	 */
 	List<GoodsCourseVo> queryList(GoodsCourseQueryBo bo);
 
+	List<CourseVo> selectList(Long goodsId);
+
 	/**
 	 * 根据新增业务对象插入商品课程关系
 	 * @param bo 商品课程关系新增业务对象

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsCourseServiceImpl.java

@@ -3,13 +3,16 @@ package com.zhongzheng.modules.goods.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.course.vo.CourseVo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseAddBo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseEditBo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
 import com.zhongzheng.modules.goods.domain.GoodsCourse;
 import com.zhongzheng.modules.goods.mapper.GoodsCourseMapper;
+import com.zhongzheng.modules.goods.mapper.GoodsMapper;
 import com.zhongzheng.modules.goods.service.IGoodsCourseService;
 import com.zhongzheng.modules.goods.vo.GoodsCourseVo;
+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,6 +33,10 @@ import java.util.stream.Collectors;
 @Service
 public class GoodsCourseServiceImpl extends ServiceImpl<GoodsCourseMapper, GoodsCourse> implements IGoodsCourseService {
 
+    @Autowired
+    private GoodsCourseMapper goodsCourseMapper;
+
+
     @Override
     public GoodsCourseVo queryById(Long id){
         GoodsCourse db = this.baseMapper.selectById(id);
@@ -44,6 +51,11 @@ public class GoodsCourseServiceImpl extends ServiceImpl<GoodsCourseMapper, Goods
         return entity2Vo(this.list(lqw));
     }
 
+    @Override
+    public List<CourseVo> selectList(Long goodsId) {
+        return goodsCourseMapper.selectList(goodsId);
+    }
+
     /**
     * 实体类转化成视图对象
     *

+ 52 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsCourseMapper.xml

@@ -11,5 +11,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="sort" column="sort"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.course.vo.CourseVo" id="CourseResultVo">
+        <result property="courseId" column="course_id"/>
+        <result property="prefixName" column="prefix_name"/>
+        <result property="coverUrl" column="cover_url"/>
+        <result property="introduction" column="introduction"/>
+        <result property="status" column="status"/>
+        <result property="educationTypeId" column="education_type_id"/>
+        <result property="businessId" column="business_id"/>
+        <result property="schoolId" column="school_id"/>
+        <result property="courseName" column="course_name"/>
+        <result property="publishStatus" column="publish_status"/>
+        <result property="sort" column="sort"/>
+        <result property="suitableObject" column="suitable_object"/>
+        <result property="pcDetailHtml" column="pc_detail_html"/>
+        <result property="mobileDetailHtml" column="mobile_detail_html"/>
+        <result property="majorId" column="major_id"/>
+        <result property="code" column="code"/>
+        <result property="subjectId" column="subject_id"/>
+        <result property="projectId" column="project_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="educationName" column="education_name"/>
+        <result property="projectName" column="project_name"/>
+        <result property="businessName" column="business_name"/>
+        <result property="schoolName" column="school_name"/>
+        <result property="categoryName" column="category_name"/>
+        <result property="subjectName" column="subject_name"/>
+        <result property="sort" column="g_sort"/>
+    </resultMap>
+
+    <select id="selectList" parameterType="Long" resultMap="CourseResultVo">
+        SELECT
+        c.*,
+        cet.education_name,
+        cpt.project_name,
+        cb.business_name,
+        s.school_name,
+        m.category_name,
+        cs.subject_name,
+               gc.sort as g_sort
+        FROM
+        goods_course gc
+        LEFT JOIN course c ON gc.course_id = c.course_id
+        LEFT JOIN course_education_type cet ON c.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON c.project_id = cpt.id
+        LEFT JOIN course_business cb ON c.business_id = cb.id
+        LEFT JOIN school s ON s.id = c.school_id
+        LEFT JOIN major m ON c.major_id = m.id
+        LEFT JOIN course_subject cs ON cs.id = c.subject_id
+        WHERE
+        gc.goods_id = #{goodsId}
 
+    </select>
 </mapper>