Parcourir la source

Merge remote-tracking branch 'origin/master'

SheepHy il y a 1 semaine
Parent
commit
85ff6d476e

+ 4 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/coach/CoachController.java

@@ -4,6 +4,7 @@ package org.jeecg.modules.app.controller.coach;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.vo.LoginUser;
@@ -49,6 +50,9 @@ public class CoachController {
     @GetMapping("/findByCoachId")
     @Operation(summary = "查询教练详情-缺少订单数和评价")
     public Result<AppCoachDetailsVO> findByCoachId(AppCoachDetailsRequestVO appCoachDetailsRequestVO){
+        if (StringUtils.isEmpty(appCoachDetailsRequestVO.getId())){
+         return Result.error("查询失败,教练编号为空");
+        }
         //获取登录用户信息
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         return iCoachService.findByCoachId(appCoachDetailsRequestVO,sysUser.getId());

+ 4 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/service/impl/CoachServiceImpl.java

@@ -58,7 +58,11 @@ public class CoachServiceImpl implements ICoachService {
     @Override
     public Result<AppCoachDetailsVO> findByCoachId(AppCoachDetailsRequestVO appCoachDetailsRequestVO, String userId) {
         AppCoachDetailsVO appCoachDetailsVO = appInstructorMapper.findById(appCoachDetailsRequestVO.getId());
+        if(appCoachDetailsVO==null){
+            return Result.error("未查到教练信息");
+        }
         List<AppCategory> appCategories = appCategoryMapper.selectList(Wrappers.<AppCategory>lambdaQuery().eq(AppCategory::getDelFlag, 0));
+
         String trainingProgramsName=getTrainingProgramsName(appCoachDetailsVO.getTrainingPrograms(),appCategories);
         appCoachDetailsVO.setTrainingProgramsName(trainingProgramsName);
         List<String> honorList = new ArrayList<>();

+ 0 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/coach/AppCoachDetailsRequestVO.java

@@ -3,10 +3,8 @@ package org.jeecg.modules.app.vo.coach;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
 
 @Data
-@Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
 @Schema(description="教练详情信息")
 public class AppCoachDetailsRequestVO {

+ 2 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/coach/AppCoachDetailsVO.java

@@ -18,6 +18,8 @@ public class AppCoachDetailsVO {
     private String id;
     @Schema(description = "教练姓名")
     private String realname;
+    @Schema(description = "教练头像")
+    private String avatar;
     @Schema(description = "所教项目编号使用,分割")
     private String trainingPrograms;
     @Schema(description = "所教项目使用,分割")

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/coach/AppCoachVO.java

@@ -16,6 +16,9 @@ public class AppCoachVO {
     @Schema(description = "教练姓名")
     private String realname;
 
+    @Schema(description = "教练头像")
+    private String avatar;
+
     @Schema(description = "所教项目编号使用,分割")
     private String trainingPrograms;
     @Schema(description = "所教项目使用,分割")

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/course/CourseRequestVo.java

@@ -33,6 +33,6 @@ public class CourseRequestVo extends PageDTO {
     @Schema(description = "用户纬度")
     private BigDecimal latitude;
 
-    @Schema(description = "排序方式 0-时间倒序,1-距离排序,2-销量排序")
+    @Schema(description = "排序方式 0-时间倒序,1-距离排序,2-销量排序,3-根据好评排序")
     private Integer orderByType;
 }

+ 3 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/course/CourseResponseVo.java

@@ -25,6 +25,9 @@ public class CourseResponseVo extends PageDTO {
     private BigDecimal sellingPrice;
     @Schema(description = "课程名称")
     private String name;
+
+    @Schema(description = "课程封面")
+    private String cover;
     @Schema(description = "费用类型")
     private String priceType;
     @Schema(description = "好评率")

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

@@ -92,17 +92,17 @@
         <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
             and  b.user_id=#{courseRequestVo.instructorId}
         </if>
-        <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
+        <if test="courseRequestVo.siteId != null and courseRequestVo.siteId !=''">
             and  b.site_id=#{courseRequestVo.siteId}
         </if>
-        <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
-            and  b.site_id=#{courseRequestVo.siteId}
+        <if test="courseRequestVo.priceType != null">
+            and  b.price_type=#{courseRequestVo.priceType}
         </if>
         GROUP BY b.id
     </select>
     <select id="findByLaLoList" resultType="org.jeecg.modules.app.vo.course.CourseResponseVo">
-        select b.`name`,e.address,b.original_price,b.selling_price
-             ,b.id,b.price_type,b.good_rate,e.latitude,e.longitude,count(c.courses_id) as coursesNum,
+        select b.`name`,e.address,b.original_price,b.selling_price,b.cover
+             ,b.id,b.price_type,ROUND(b.good_rate * 100)  as  good_rate ,e.latitude,e.longitude,count(c.courses_id) as coursesNum,
                ST_Distance_Sphere(
                        POINT(#{courseRequestVo.longitude}, #{courseRequestVo.latitude}),
                        POINT(e.longitude, e.latitude)
@@ -110,6 +110,16 @@
         FROM nm_courses b
         LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
         LEFT JOIN nm_site e on e.id = b.site_id
+        where 1=1
+        <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
+            and  b.user_id=#{courseRequestVo.instructorId}
+        </if>
+        <if test="courseRequestVo.siteId != null and courseRequestVo.siteId !=''">
+            and  b.site_id=#{courseRequestVo.siteId}
+        </if>
+        <if test="courseRequestVo.priceType != null">
+            and  b.price_type=#{courseRequestVo.priceType}
+        </if>
         GROUP BY b.id
         <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '1'">
             ORDER BY km DESC
@@ -120,6 +130,9 @@
         <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '0'">
             ORDER BY b.create_time DESC
         </if>
+        <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '0'">
+            ORDER BY b.good_rate DESC
+        </if>
     </select>
     <select id="findByList" resultType="org.jeecg.modules.app.vo.course.CourseResponseVo">
         select b.`name`,e.address,b.original_price,b.selling_price
@@ -127,6 +140,16 @@
         FROM nm_courses b
         LEFT JOIN nm_courses_price_rules c on b.id= c.courses_id
         LEFT JOIN nm_site e on e.id = b.site_id
+        where 1=1
+        <if test="courseRequestVo.instructorId != null and courseRequestVo.instructorId !=''">
+            and  b.user_id=#{courseRequestVo.instructorId}
+        </if>
+        <if test="courseRequestVo.siteId != null and courseRequestVo.siteId !=''">
+            and  b.site_id=#{courseRequestVo.siteId}
+        </if>
+        <if test="courseRequestVo.priceType != null">
+            and  b.price_type=#{courseRequestVo.priceType}
+        </if>
         GROUP BY b.id
         <if test="courseRequestVo.orderByType != null and courseRequestVo.orderByType == '1'">
             ORDER BY b.create_time DESC

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

@@ -57,11 +57,11 @@
         ORDER BY orderCount DESC
     </select>
     <select id="findCoachList" resultType="org.jeecg.modules.app.vo.coach.AppCoachVO">
-        select a.user_id as id,b.realname,a.training_programs  from nm_instructor a
+        select a.user_id as id,b.realname,a.training_programs,b.avatar  from nm_instructor a
             left join  sys_user b on a.user_id = b.id
     </select>
     <select id="findById" resultType="org.jeecg.modules.app.vo.coach.AppCoachDetailsVO">
-        select a.user_id as id,b.realname,a.training_programs,a.good_rate,a.teaching_philosophy,excel_msg,
+        select a.user_id as id,b.realname,a.training_programs,a.good_rate,a.teaching_philosophy,a.excel_msg,b.avatar,
                a.certificate_innocence,a.healthy,a.honor  from nm_instructor a left join  sys_user b on a.user_id = b.id where a.user_id = #{id}
 
     </select>