lzy 1 week ago
parent
commit
2a725c73f4

+ 4 - 4
src/main/java/com/futu/course/course/domain/Course.java

@@ -37,7 +37,7 @@ public class Course implements Serializable {
      */
     private Long teacherId;
 
-    private String describe;
+    private String describeTion;
 
     /**
      * 分类
@@ -93,7 +93,7 @@ public class Course implements Serializable {
             && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
             && (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
             && (this.getTeacherId() == null ? other.getTeacherId() == null : this.getTeacherId().equals(other.getTeacherId()))
-            && (this.getDescribe() == null ? other.getDescribe() == null : this.getDescribe().equals(other.getDescribe()))
+            && (this.getDescribeTion() == null ? other.getDescribeTion() == null : this.getDescribeTion().equals(other.getDescribeTion()))
             && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
             && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
             && (this.getCoverImg() == null ? other.getCoverImg() == null : this.getCoverImg().equals(other.getCoverImg()))
@@ -111,7 +111,7 @@ public class Course implements Serializable {
         result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
         result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
         result = prime * result + ((getTeacherId() == null) ? 0 : getTeacherId().hashCode());
-        result = prime * result + ((getDescribe() == null) ? 0 : getDescribe().hashCode());
+        result = prime * result + ((getDescribeTion() == null) ? 0 : getDescribeTion().hashCode());
         result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
         result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
         result = prime * result + ((getCoverImg() == null) ? 0 : getCoverImg().hashCode());
@@ -132,7 +132,7 @@ public class Course implements Serializable {
         sb.append(", title=").append(title);
         sb.append(", shopId=").append(shopId);
         sb.append(", teacherId=").append(teacherId);
-        sb.append(", describe=").append(describe);
+        sb.append(", describeTion=").append(describeTion);
         sb.append(", categoryId=").append(categoryId);
         sb.append(", price=").append(price);
         sb.append(", coverImg=").append(coverImg);

+ 2 - 2
src/main/java/com/futu/course/cupons/controller/CouponController.java

@@ -21,8 +21,8 @@ public class CouponController {
 
 //    可以使用的优惠券
     @RequestMapping("/findAll")
-    public R findAll(@RequestBody CouponDto primary){
-        return couponService.findAll(primary);
+    public R findAll(@RequestBody CouponDto couponDto){
+        return couponService.findAll(couponDto);
     }
 
 

+ 1 - 1
src/main/java/com/futu/course/cupons/dto/CouponDto.java

@@ -11,5 +11,5 @@ import java.math.BigDecimal;
 @NoArgsConstructor
 public class CouponDto {
 
-    private  BigDecimal primary;
+    private  Long couponId;
 }

+ 7 - 1
src/main/java/com/futu/course/cupons/service/impl/CouponServiceImpl.java

@@ -3,6 +3,8 @@ package com.futu.course.cupons.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.futu.course.common.entity.R;
+import com.futu.course.course.domain.Course;
+import com.futu.course.course.mapper.CourseMapper;
 import com.futu.course.cupons.domain.Coupon;
 import com.futu.course.cupons.dto.CouponDto;
 import com.futu.course.cupons.service.CouponService;
@@ -37,6 +39,8 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon>
     @Resource
     private Order1Mapper order1Mapper;
 
+    @Resource
+    private CourseMapper courseMapper;
 
 
     @Override
@@ -46,9 +50,11 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon>
         if (objects == null){
             return R.failed("没有优惠券");
         }
+        Course course = courseMapper.selectById(primary.getCouponId());
+        System.err.println(course);
         List<Coupon> list=new ArrayList<>();
         for (Long i:objects){
-            list.add(this.baseMapper.selectOne(new QueryWrapper<Coupon>().eq("id",i).ge("condition_amount",primary.getPrimary())));
+            list.add(this.baseMapper.selectOne(new QueryWrapper<Coupon>().eq("id",i).ge("condition_amount",course.getPrice())));
         }
         if (list==null){
             return R.failed("没有可用的优惠券");