Parcourir la source

feat(app): 增加课程类目功能并优化课程列表接口

- 在 AppCoursesMapper.xml 中添加 details 和 fit_people 字段- 修改 AppDetailController 中的 courseInfoVOList 接口,参数改为类目 ID
- 新增 getAllCategory 接口获取所有类目
- 更新 CourseInfoVO 中的字段类型和名称
- 修改 DetailServiceImpl 中的 courseInfoVOList 方法,支持按类目 ID 查询课程列表
- 新增 getAllCategory 方法获取所有类目
- 更新 IDetailService 接口,修改 courseInfoVOList 方法签名并添加 getAllCategory 方法
SheepHy il y a 2 semaines
Parent
commit
d900f11794

+ 15 - 4
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/AppDetailController.java

@@ -8,6 +8,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.app.service.IDetailService;
 import org.jeecg.modules.app.vo.CourseInfoVO;
 import org.jeecg.modules.app.vo.PlaceInfoVO;
+import org.jeecg.modules.system.app.entity.AppCategory;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -16,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.annotation.Resource;
 import java.util.List;
 @Slf4j
-@Tag(name = "App首页相关接口")
+@Tag(name = "App详情相关接口")
 @RestController
 @RequestMapping("/app/detail")
 public class AppDetailController {
@@ -52,13 +53,12 @@ public class AppDetailController {
      * @Author SheepHy
      * @Description 根据课程类型查询课程列表
      * @Date 9:52 2025/7/9
-     * @Param type 课程类型
      * @return List<PlaceInfoVO.CourseInfoVO>
      **/
     @GetMapping("/courseInfoVOList")
     @Operation(summary = "根据课程类型查询课程列表")
-    public Result<List<PlaceInfoVO.CourseInfoVO>> courseInfoVOList(@RequestParam @Schema(description="课程类型")String type, @RequestParam @Schema(description="课程ID")String id){
-        return Result.ok(detailService.courseInfoVOList(type, id));
+    public Result<List<PlaceInfoVO.CourseInfoVO>> courseInfoVOList(@RequestParam @Schema(description="类目id")String categoryId, @RequestParam @Schema(description="店铺ID")String id){
+        return Result.ok(detailService.courseInfoVOList(categoryId,id));
     }
 
     /**
@@ -73,4 +73,15 @@ public class AppDetailController {
     public Result<PlaceInfoVO.theGymnasiumIsCharteredVO> getPlaceInfoNoFixation(@RequestParam @Schema(description="门店ID")String id, @RequestParam @Schema(description="类目")String categoryId){
         return Result.ok(detailService.getPlaceInfoNoFixation(id, categoryId));
     }
+
+    /**
+     * @Author SheepHy
+     * @Description 获取所有类目
+     * @Date 10:14 2025/7/9
+     **/
+    @GetMapping("/getAllCategory")
+    @Operation(summary = "获取所有类目")
+    public Result<List<AppCategory>> getAllCategory(@RequestParam @Schema(description="门店ID")String id){
+        return Result.ok(detailService.getAllCategory(id));
+    }
 }

+ 9 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/IDetailService.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.app.service;
 
 import org.jeecg.modules.app.vo.CourseInfoVO;
 import org.jeecg.modules.app.vo.PlaceInfoVO;
+import org.jeecg.modules.system.app.entity.AppCategory;
 
 import java.util.List;
 
@@ -31,7 +32,7 @@ public interface IDetailService {
      * @Param type 课程类型
      * @return List<PlaceInfoVO.CourseInfoVO>
      **/
-    List<PlaceInfoVO.CourseInfoVO> courseInfoVOList(String type, String id);
+    List<PlaceInfoVO.CourseInfoVO> courseInfoVOList(String categoryId,String id);
     
     /** 
      * @Author SheepHy
@@ -41,4 +42,11 @@ public interface IDetailService {
      * @return PlaceInfoVO.theGymnasiumIsCharteredVO
      **/
     PlaceInfoVO.theGymnasiumIsCharteredVO getPlaceInfoNoFixation(String id, String categoryId);
+
+    /**
+     * @Author SheepHy
+     * @Description 获取所有类目
+     * @Date 10:14 2025/7/9
+     **/
+    List<AppCategory> getAllCategory(String id);
 }

+ 13 - 3
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/DetailServiceImpl.java

@@ -103,7 +103,7 @@ public class DetailServiceImpl implements IDetailService {
         appCoursesPriceRulesMapper.selectList(Wrappers.<AppCoursesPriceRules>lambdaQuery()
                 .eq(AppCoursesPriceRules::getCoursesId, courseInfoVO.getId())).forEach(appCourses -> {
             CourseInfoVO.CourseDetailVO courseDetailVO = new CourseInfoVO.CourseDetailVO();
-            BeanUtils.copyProperties(courseDetailVO, appCourses);
+            BeanUtils.copyProperties(appCourses,courseDetailVO);
             courseDetailVOList.add(courseDetailVO);
         });
         courseInfoVO.setCourseDetail(courseDetailVOList);
@@ -111,18 +111,20 @@ public class DetailServiceImpl implements IDetailService {
     }
 
     @Override
-    public List<PlaceInfoVO.CourseInfoVO> courseInfoVOList(String type, String id) {
+    public List<PlaceInfoVO.CourseInfoVO> courseInfoVOList(String categoryId,String id) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         List<PlaceInfoVO.CourseInfoVO> courseInfoVOList = new ArrayList<>();
         appCoursesMapper.selectList(Wrappers.<AppCourses>lambdaQuery()
                 .eq(AppCourses::getSiteId, id)
+                .like(AppCourses::getCategoryId, categoryId)
                 .eq(AppCourses::getStatus, 0)
                 .eq(AppCourses::getDelFlag, 0)).forEach(appCourses -> {
             PlaceInfoVO.CourseInfoVO courseInfoVO = new PlaceInfoVO.CourseInfoVO();
-            BeanUtils.copyProperties(courseInfoVO, appCourses);
+            BeanUtils.copyProperties(appCourses, courseInfoVO);
             courseInfoVO.setSales(getCourseSalesCount(appCourses.getId()));
             courseInfoVO.setSalesYear(getCourseSales(appCourses.getId()));
             courseInfoVO.setPriceType(isFirstPurchase(user.getId()));
+            courseInfoVO.setAddress(appSiteMapper.selectById(appCourses.getSiteId()).getAddress());
             courseInfoVOList.add(courseInfoVO);
         });
         return courseInfoVOList;
@@ -143,6 +145,14 @@ public class DetailServiceImpl implements IDetailService {
                 .setTimeSlot(collect);
     }
 
+    @Override
+    public List<AppCategory> getAllCategory(String id) {
+        AppSite appSite = appSiteMapper.selectById(id);
+        return appCategoryMapper.selectList(Wrappers.<AppCategory>lambdaQuery()
+                .eq(AppCategory::getStatus,0).eq(AppCategory::getOrgCode,appSite.getOrgCode())
+                .eq(AppCategory::getDelFlag,0));
+    }
+
     /**
      * @return
      * @Author SheepHy

+ 5 - 5
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/CourseInfoVO.java

@@ -43,11 +43,11 @@ public class CourseInfoVO {
     @Schema(description = "课时")
     private Integer classHour;
     @Schema(description = "限购次数")
-    private Integer limitNum;
+    private String limitNum;
     @Schema(description = "服务详情")
-    private Integer details;
+    private String details;
     @Schema(description = "适用人群")
-    private Integer fitPeople;
+    private String fitPeople;
     @Schema(description = "提示/须知")
     private String reminder;
     @Schema(description = "课程明细")
@@ -59,9 +59,9 @@ public class CourseInfoVO {
     @Schema(description="课程明细返回参数")
     public static class CourseDetailVO {
         @Schema(description = "课程id")
-        private String courseId;
+        private String id;
         @Schema(description = "课程名称")
-        private String courseName;
+        private String name;
         @Schema(description = "开始时间")
         private Date startTime;
         @Schema(description = "结束时间")

+ 2 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/AppCoursesMapper.xml

@@ -45,7 +45,9 @@
             a.cover,
             a.video,
             b.address,
+            a.details,
             a.site_id,
+            a.fit_people,
             a.start_time,
             a.end_time,
             COUNT( c.id ) AS classHour,