|
|
@@ -18,6 +18,7 @@ package org.springblade.client.goods.controller;
|
|
|
|
|
|
import com.alibaba.nacos.api.utils.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -27,20 +28,26 @@ import lombok.AllArgsConstructor;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import org.springblade.client.entity.GoodsDesc;
|
|
|
+import org.springblade.client.entity.GoodsPrice;
|
|
|
import org.springblade.client.entity.GoodsType;
|
|
|
import org.springblade.client.goods.enums.GoodsTypeEnum;
|
|
|
+import org.springblade.client.goods.service.IGoodsPriceService;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springblade.client.vo.GoodsDescVO;
|
|
|
import org.springblade.client.goods.service.IGoodsDescService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* 商品详情表 控制器
|
|
|
*
|
|
|
@@ -54,6 +61,8 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|
|
public class GoodsDescController extends BladeController {
|
|
|
|
|
|
private final IGoodsDescService goodsDescService;
|
|
|
+ @Autowired
|
|
|
+ private IGoodsPriceService goodsPriceService;
|
|
|
|
|
|
/**
|
|
|
* 详情
|
|
|
@@ -104,6 +113,25 @@ public class GoodsDescController extends BladeController {
|
|
|
return R.data(iPage);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/findById")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "分页", notes = "传入goodsDesc")
|
|
|
+ public R list(@RequestParam(name = "id", required = true) String id)
|
|
|
+ {
|
|
|
+ GoodsDesc goodsDesc = goodsDescService.getById(id);
|
|
|
+ LambdaQueryWrapper<GoodsPrice> lambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(GoodsPrice::getPid,id);
|
|
|
+ List<GoodsPrice> priceList = goodsPriceService.list(lambdaQueryWrapper);
|
|
|
+ if(!CollectionUtils.isEmpty(priceList))
|
|
|
+ {
|
|
|
+ List<GoodsPrice> sale = priceList.stream().filter(e -> e.getBillType().equals("0")).collect(Collectors.toList());
|
|
|
+ List<GoodsPrice> buy = priceList.stream().filter(e -> e.getBillType().equals("1")).collect(Collectors.toList());
|
|
|
+ goodsDesc.setSaleGoodsPrice(sale);
|
|
|
+ goodsDesc.setBugGoodsPrice(buy);
|
|
|
+ }
|
|
|
+ return R.data(goodsDesc);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 分页 商品详情表
|
|
|
*/
|
|
|
@@ -116,6 +144,19 @@ public class GoodsDescController extends BladeController {
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
+ @DeleteMapping("delete")
|
|
|
+ public R delete(@RequestParam(name = "id", required = true) String id)
|
|
|
+ {
|
|
|
+ goodsDescService.removeById(id);
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("priceDelete")
|
|
|
+ public R priceDelete(@RequestParam(name = "id", required = true) String id)
|
|
|
+ {
|
|
|
+ goodsPriceService.removeById(id);
|
|
|
+ return R.success("操作成功");
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 自定义分页 商品详情表
|