ProductCategory改造

This commit is contained in:
zhuyang
2021-10-07 23:45:17 +08:00
parent b5b102d13f
commit 50d8aac20f
11 changed files with 209 additions and 266 deletions

View File

@@ -1,63 +0,0 @@
package cn.iocoder.mall.productservice.rpc.brand;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO;
import java.util.List;
/**
* 商品品牌 Rpc 接口
*/
public interface ProductBrandRpc {
/**
* 创建商品品牌
*
* @param createDTO 创建商品品牌 DTO
* @return 商品品牌编号
*/
CommonResult<Integer> createProductBrand(ProductBrandCreateReqDTO createDTO);
/**
* 更新商品品牌
*
* @param updateDTO 更新商品品牌 DTO
*/
CommonResult<Boolean> updateProductBrand(ProductBrandUpdateReqDTO updateDTO);
/**
* 删除商品品牌
*
* @param productBrandId 商品品牌编号
*/
CommonResult<Boolean> deleteProductBrand(Integer productBrandId);
/**
* 获得商品品牌
*
* @param productBrandId 商品品牌编号
* @return 商品品牌
*/
CommonResult<ProductBrandRespDTO> getProductBrand(Integer productBrandId);
/**
* 获得商品品牌列表
*
* @param productBrandIds 商品品牌编号列表
* @return 商品品牌列表
*/
CommonResult<List<ProductBrandRespDTO>> listProductBrands(List<Integer> productBrandIds);
/**
* 获得商品品牌分页
*
* @param pageDTO 商品品牌分页查询
* @return 商品品牌分页结果
*/
CommonResult<PageResult<ProductBrandRespDTO>> pageProductBrand(ProductBrandPageReqDTO pageDTO);
}

View File

@@ -0,0 +1,68 @@
package cn.iocoder.mall.productservice.rpc.category;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection;
import java.util.List;
@FeignClient(value = "product-service")
public interface ProductCategoryFeign {
/**
* 创建商品分类
*
* @param createDTO 创建商品分类 DTO
* @return 商品分类编号
*/
@PostMapping("/product/category/createProductCategory")
CommonResult<Integer> createProductCategory(@RequestBody ProductCategoryCreateReqDTO createDTO);
/**
* 更新商品分类
*
* @param updateDTO 更新商品分类 DTO
*/
@PostMapping("/product/category/updateProductCategory")
CommonResult<Boolean> updateProductCategory(@RequestBody ProductCategoryUpdateReqDTO updateDTO);
/**
* 删除商品分类
*
* @param productCategoryId 商品分类编号
*/
@GetMapping("/product/category/deleteProductCategory")
CommonResult<Boolean> deleteProductCategory(@RequestParam("productCategoryId") Integer productCategoryId);
/**
* 获得商品分类
*
* @param productCategoryId 商品分类编号
* @return 商品分类
*/
@GetMapping("/product/category/getProductCategory")
CommonResult<ProductCategoryRespDTO> getProductCategory(@RequestParam("productCategoryId")Integer productCategoryId);
/**
* 获得商品分类列表
*
* @param productCategoryIds 商品分类编号列表
* @return 商品分类列表
*/
@GetMapping("/product/category/listProductCategoriesByIds")
CommonResult<List<ProductCategoryRespDTO>> listProductCategoriesByIds(@RequestParam("productCategoryIds")Collection<Integer> productCategoryIds);
/**
* 获得符合条件的商品分类列表
*
* @return 商品分类列表
*/
@PostMapping("/product/category/listProductCategories")
CommonResult<List<ProductCategoryRespDTO>> listProductCategories(@RequestBody ProductCategoryListQueryReqDTO listQueryReqDTO);
}

View File

@@ -1,62 +0,0 @@
package cn.iocoder.mall.productservice.rpc.category;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
import java.util.Collection;
import java.util.List;
/**
* 商品分类 Rpc 接口
*/
public interface ProductCategoryRpc {
/**
* 创建商品分类
*
* @param createDTO 创建商品分类 DTO
* @return 商品分类编号
*/
CommonResult<Integer> createProductCategory(ProductCategoryCreateReqDTO createDTO);
/**
* 更新商品分类
*
* @param updateDTO 更新商品分类 DTO
*/
CommonResult<Boolean> updateProductCategory(ProductCategoryUpdateReqDTO updateDTO);
/**
* 删除商品分类
*
* @param productCategoryId 商品分类编号
*/
CommonResult<Boolean> deleteProductCategory(Integer productCategoryId);
/**
* 获得商品分类
*
* @param productCategoryId 商品分类编号
* @return 商品分类
*/
CommonResult<ProductCategoryRespDTO> getProductCategory(Integer productCategoryId);
/**
* 获得商品分类列表
*
* @param productCategoryIds 商品分类编号列表
* @return 商品分类列表
*/
CommonResult<List<ProductCategoryRespDTO>> listProductCategories(Collection<Integer> productCategoryIds);
/**
* 获得符合条件的商品分类列表
*
* @return 商品分类列表
*/
CommonResult<List<ProductCategoryRespDTO>> listProductCategories(ProductCategoryListQueryReqDTO listQueryReqDTO);
}

View File

@@ -0,0 +1,107 @@
package cn.iocoder.mall.productservice.controller;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.productservice.manager.brand.ProductBrandManager;
import cn.iocoder.mall.productservice.manager.category.ProductCategoryManager;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* Title:
* Description:
*
* @author zhuyang
* @version 1.0 2021/10/7
*/
@RestController
@RequestMapping("/product/category")
@Api("商品品牌")
public class ProductCategoryController {
@Autowired
private ProductCategoryManager productCategoryManager;
/**
* 创建商品分类
*
* @param createDTO 创建商品分类 DTO
* @return 商品分类编号
*/
@PostMapping("createProductCategory")
CommonResult<Integer> createProductCategory(@RequestBody ProductCategoryCreateReqDTO createDTO){
return success(productCategoryManager.createProductCategory(createDTO));
}
/**
* 更新商品分类
*
* @param updateDTO 更新商品分类 DTO
*/
@PostMapping("updateProductCategory")
CommonResult<Boolean> updateProductCategory(@RequestBody ProductCategoryUpdateReqDTO updateDTO){
productCategoryManager.updateProductCategory(updateDTO);
return success(true);
}
/**
* 删除商品分类
*
* @param productCategoryId 商品分类编号
*/
@GetMapping("deleteProductCategory")
CommonResult<Boolean> deleteProductCategory(@RequestParam("productCategoryId") Integer productCategoryId){
productCategoryManager.deleteProductCategory(productCategoryId);
return success(true);
}
/**
* 获得商品分类
*
* @param productCategoryId 商品分类编号
* @return 商品分类
*/
@GetMapping("getProductCategory")
CommonResult<ProductCategoryRespDTO> getProductCategory(@RequestParam("productCategoryId")Integer productCategoryId){
return success(productCategoryManager.getProductCategory(productCategoryId));
}
/**
* 获得商品分类列表
*
* @param productCategoryIds 商品分类编号列表
* @return 商品分类列表
*/
@GetMapping("listProductCategoriesByIds")
CommonResult<List<ProductCategoryRespDTO>> listProductCategoriesByIds(@RequestParam("productCategoryIds")Collection<Integer> productCategoryIds){
return success(productCategoryManager.listProductCategories(productCategoryIds));
}
/**
* 获得符合条件的商品分类列表
*
* @return 商品分类列表
*/
@PostMapping("listProductCategories")
CommonResult<List<ProductCategoryRespDTO>> listProductCategories(@RequestBody ProductCategoryListQueryReqDTO listQueryReqDTO){
return success(productCategoryManager.listProductCategories(listQueryReqDTO));
}
}

View File

@@ -1,58 +0,0 @@
package cn.iocoder.mall.productservice.rpc.brand;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.common.framework.vo.PageResult;
import cn.iocoder.mall.productservice.manager.brand.ProductBrandManager;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO;
import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品品牌 Rpc 实现类
*/
@DubboService
public class ProductBrandRpcImpl implements ProductBrandRpc {
@Autowired
private ProductBrandManager productBrandManager;
@Override
public CommonResult<Integer> createProductBrand(ProductBrandCreateReqDTO createDTO) {
return success(productBrandManager.createProductBrand(createDTO));
}
@Override
public CommonResult<Boolean> updateProductBrand(ProductBrandUpdateReqDTO updateDTO) {
productBrandManager.updateProductBrand(updateDTO);
return success(true);
}
@Override
public CommonResult<Boolean> deleteProductBrand(Integer productBrandId) {
productBrandManager.deleteProductBrand(productBrandId);
return success(true);
}
@Override
public CommonResult<ProductBrandRespDTO> getProductBrand(Integer productBrandId) {
return success(productBrandManager.getProductBrand(productBrandId));
}
@Override
public CommonResult<List<ProductBrandRespDTO>> listProductBrands(List<Integer> productBrandIds) {
return success(productBrandManager.listProductBrands(productBrandIds));
}
@Override
public CommonResult<PageResult<ProductBrandRespDTO>> pageProductBrand(ProductBrandPageReqDTO pageDTO) {
return success(productBrandManager.pageProductBrand(pageDTO));
}
}

View File

@@ -1,58 +0,0 @@
package cn.iocoder.mall.productservice.rpc.category;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.productservice.manager.category.ProductCategoryManager;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO;
import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.common.framework.vo.CommonResult.success;
/**
* 商品分类 Rpc 实现类
*/
@DubboService
public class ProductCategoryRpcImpl implements ProductCategoryRpc {
@Autowired
private ProductCategoryManager productCategoryManager;
@Override
public CommonResult<Integer> createProductCategory(ProductCategoryCreateReqDTO createDTO) {
return success(productCategoryManager.createProductCategory(createDTO));
}
@Override
public CommonResult<Boolean> updateProductCategory(ProductCategoryUpdateReqDTO updateDTO) {
productCategoryManager.updateProductCategory(updateDTO);
return success(true);
}
@Override
public CommonResult<Boolean> deleteProductCategory(Integer productCategoryId) {
productCategoryManager.deleteProductCategory(productCategoryId);
return success(true);
}
@Override
public CommonResult<ProductCategoryRespDTO> getProductCategory(Integer productCategoryId) {
return success(productCategoryManager.getProductCategory(productCategoryId));
}
@Override
public CommonResult<List<ProductCategoryRespDTO>> listProductCategories(Collection<Integer> productCategoryIds) {
return success(productCategoryManager.listProductCategories(productCategoryIds));
}
@Override
public CommonResult<List<ProductCategoryRespDTO>> listProductCategories(ProductCategoryListQueryReqDTO listQueryReqDTO) {
return success(productCategoryManager.listProductCategories(listQueryReqDTO));
}
}