[fix]修改商品 增加business层
This commit is contained in:
parent
0a50a160eb
commit
76342416ad
@ -1,10 +1,20 @@
|
||||
package com.wzj.soopin.goods.business;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wzj.soopin.goods.domain.bo.ProductBo;
|
||||
import com.wzj.soopin.goods.domain.entity.Product;
|
||||
import com.wzj.soopin.goods.domain.vo.ProductVO;
|
||||
import org.dromara.common.web.core.IBusiness;
|
||||
|
||||
public interface IProductBusiness extends IBusiness<ProductVO, ProductBo> {
|
||||
boolean audit(Long id, Integer authFlag, String reasons);
|
||||
boolean publish(Long id, Integer publishStatus);
|
||||
/**
|
||||
* 获取推荐商品列表
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<ProductVO> getRecommendPage(Page<Product> page);
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.wzj.soopin.goods.business;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wzj.soopin.goods.convert.ProductConvert;
|
||||
import com.wzj.soopin.goods.convert.SkuConvert;
|
||||
import com.wzj.soopin.goods.domain.bo.ProductBo;
|
||||
@ -22,14 +24,13 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ProductBusinessImpl extends BusinessImpl<ProductService, ProductConvert, ProductVO,ProductBo,Product> implements IProductBusiness {
|
||||
public class ProductBusinessImpl extends BusinessImpl<ProductService, ProductConvert, ProductVO, ProductBo, Product> implements IProductBusiness {
|
||||
|
||||
private final ProductService productService;
|
||||
private final SkuService skuService;
|
||||
private final SkuConvert skuConvert;
|
||||
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean save(ProductBo bo) {
|
||||
@ -74,4 +75,9 @@ public class ProductBusinessImpl extends BusinessImpl<ProductService, ProductCon
|
||||
productService.updateById(product);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ProductVO> getRecommendPage(Page<Product> page) {
|
||||
return productService.getRecommendPage(page);
|
||||
}
|
||||
}
|
||||
|
@ -31,15 +31,12 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class ProductController extends BaseController {
|
||||
|
||||
private final ProductConvert convert;
|
||||
private final ProductService service;
|
||||
|
||||
private final IProductBusiness business;
|
||||
|
||||
@Tag(name ="查询商品信息列表")
|
||||
@PostMapping("list")
|
||||
public R<IPage<ProductVO>> list(@RequestBody ProductBo query, @RequestBody Page<Product> page) {
|
||||
return R.ok(service.getList(query,page));
|
||||
public R<IPage<ProductVO>> list(@RequestBody ProductBo bo) {
|
||||
return R.ok(business.page(bo));
|
||||
}
|
||||
|
||||
|
||||
@ -47,15 +44,15 @@ public class ProductController extends BaseController {
|
||||
@Log(title = "商品信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("export")
|
||||
public R<String> export(ProductBo query) {
|
||||
List<Product> list = service.list(query.toWrapper());
|
||||
List<ProductVO> list = business.list(query);
|
||||
ExcelUtil<ProductVO> util = new ExcelUtil<>(ProductVO.class);
|
||||
return R.ok(util.writeExcel(convert.toVO(list), "商品信息数据"));
|
||||
return R.ok(util.writeExcel(list, "商品信息数据"));
|
||||
}
|
||||
|
||||
@Tag(name ="获取商品信息详细信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") Long id) {
|
||||
return R.ok(service.selectById(id));
|
||||
return R.ok(business.get(id));
|
||||
}
|
||||
|
||||
@Tag(name ="新增商品信息")
|
||||
@ -100,7 +97,7 @@ public class ProductController extends BaseController {
|
||||
@Tag(name ="查询商品信息列表")
|
||||
@PostMapping("/recommend")
|
||||
public R<IPage<ProductVO>> recommend(@RequestBody Page<Product> page) {
|
||||
return R.ok(service.getRecommendPage(page));
|
||||
return R.ok(business.getRecommendPage(page));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,12 +11,7 @@ public interface ProductService extends IService<Product> {
|
||||
|
||||
IPage<ProductVO> getList(ProductBo query, Page<Product> page);
|
||||
|
||||
/**
|
||||
* 获取推荐商品列表
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<ProductVO> getRecommendPage( Page<Product> page);
|
||||
IPage<ProductVO> getRecommendPage(Page<Product> page);
|
||||
|
||||
/**
|
||||
* 不带租户的获取商品信息
|
||||
|
Loading…
x
Reference in New Issue
Block a user