Selaa lähdekoodia

根据外框id获取品牌信息

lyhzzz 1 vuosi sitten
vanhempi
commit
68a28eb6a7

+ 15 - 0
src/main/java/com/cdf/controller/back/HotOutlineController.java

@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cdf.common.PageInfo;
 import com.cdf.common.ResultCode;
 import com.cdf.common.ResultData;
+import com.cdf.entity.Brand;
 import com.cdf.entity.HotOutline;
 import com.cdf.exception.BusinessException;
 import com.cdf.request.BaseRequest;
+import com.cdf.service.IBrandService;
 import com.cdf.service.IHotOutlineService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -17,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * <p>
  *  前端控制器
@@ -31,6 +35,8 @@ public class HotOutlineController {
 
     @Autowired
     IHotOutlineService hotOutlineService;
+    @Autowired
+    IBrandService brandService;
 
     @PostMapping("/list")
     public ResultData list(@RequestBody BaseRequest param){
@@ -54,5 +60,14 @@ public class HotOutlineController {
         hotOutlineService.removeById(hotOutline.getId());
         return ResultData.ok();
     }
+
+    @PostMapping("/detail")
+    public ResultData detail(@RequestBody HotOutline hotOutline){
+        if(hotOutline.getId() == null){
+            throw new BusinessException(ResultCode.PARAM_MISS);
+        }
+        List<Brand> brands = brandService.getByHotOutlineId(hotOutline.getId());
+        return ResultData.ok(brands);
+    }
 }
 

+ 2 - 0
src/main/java/com/cdf/service/IBrandService.java

@@ -28,4 +28,6 @@ public interface IBrandService extends IService<Brand> {
     List<Brand> getByCdfBrandIds(List<String> brandIds);
 
     void updateBrandOutline(String brandId, String outlineId);
+
+    List<Brand> getByHotOutlineId(Integer outlineId);
 }

+ 7 - 0
src/main/java/com/cdf/service/impl/BrandServiceImpl.java

@@ -194,4 +194,11 @@ public class BrandServiceImpl extends ServiceImpl<IBrandMapper, Brand> implement
         wrapper.set(Brand::getOutlineId,outlineId);
         this.update(wrapper);
     }
+
+    @Override
+    public List<Brand> getByHotOutlineId(Integer outlineId) {
+        LambdaQueryWrapper<Brand> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Brand::getOutlineId,outlineId);
+        return this.list(wrapper);
+    }
 }