|
@@ -1,53 +1,46 @@
|
|
|
-package cn.iocoder.yudao.module.crm.controller.admin.productcategory;
|
|
|
+package cn.iocoder.yudao.module.crm.controller.admin.product;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import javax.annotation.Resource;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.module.crm.controller.admin.product.vo.productcategory.CrmProductCategoryCreateReqVO;
|
|
|
+import cn.iocoder.yudao.module.crm.controller.admin.product.vo.productcategory.CrmProductCategoryListReqVO;
|
|
|
+import cn.iocoder.yudao.module.crm.controller.admin.product.vo.productcategory.CrmProductCategoryRespVO;
|
|
|
+import cn.iocoder.yudao.module.crm.controller.admin.product.vo.productcategory.CrmProductCategoryUpdateReqVO;
|
|
|
+import cn.iocoder.yudao.module.crm.convert.product.CrmProductCategoryConvert;
|
|
|
+import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO;
|
|
|
+import cn.iocoder.yudao.module.crm.service.product.CrmProductCategoryService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import javax.validation.constraints.*;
|
|
|
-import javax.validation.*;
|
|
|
-import javax.servlet.http.*;
|
|
|
-import java.util.*;
|
|
|
-import java.io.IOException;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|
|
-import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.module.crm.controller.admin.productcategory.vo.*;
|
|
|
-import cn.iocoder.yudao.module.crm.dal.dataobject.productcategory.ProductCategoryDO;
|
|
|
-import cn.iocoder.yudao.module.crm.convert.productcategory.ProductCategoryConvert;
|
|
|
-import cn.iocoder.yudao.module.crm.service.productcategory.ProductCategoryService;
|
|
|
-
|
|
|
@Tag(name = "管理后台 - 产品分类")
|
|
|
@RestController
|
|
|
@RequestMapping("/crm/product-category")
|
|
|
@Validated
|
|
|
-public class ProductCategoryController {
|
|
|
+public class CrmProductCategoryController {
|
|
|
|
|
|
@Resource
|
|
|
- private ProductCategoryService productCategoryService;
|
|
|
+ private CrmProductCategoryService productCategoryService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建产品分类")
|
|
|
@PreAuthorize("@ss.hasPermission('crm:product-category:create')")
|
|
|
- public CommonResult<Long> createProductCategory(@Valid @RequestBody ProductCategoryCreateReqVO createReqVO) {
|
|
|
+ public CommonResult<Long> createProductCategory(@Valid @RequestBody CrmProductCategoryCreateReqVO createReqVO) {
|
|
|
return success(productCategoryService.createProductCategory(createReqVO));
|
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
|
@Operation(summary = "更新产品分类")
|
|
|
@PreAuthorize("@ss.hasPermission('crm:product-category:update')")
|
|
|
- public CommonResult<Boolean> updateProductCategory(@Valid @RequestBody ProductCategoryUpdateReqVO updateReqVO) {
|
|
|
+ public CommonResult<Boolean> updateProductCategory(@Valid @RequestBody CrmProductCategoryUpdateReqVO updateReqVO) {
|
|
|
productCategoryService.updateProductCategory(updateReqVO);
|
|
|
return success(true);
|
|
|
}
|
|
@@ -65,17 +58,17 @@ public class ProductCategoryController {
|
|
|
@Operation(summary = "获得产品分类")
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
@PreAuthorize("@ss.hasPermission('crm:product-category:query')")
|
|
|
- public CommonResult<ProductCategoryRespVO> getProductCategory(@RequestParam("id") Long id) {
|
|
|
- ProductCategoryDO productCategory = productCategoryService.getProductCategory(id);
|
|
|
- return success(ProductCategoryConvert.INSTANCE.convert(productCategory));
|
|
|
+ public CommonResult<CrmProductCategoryRespVO> getProductCategory(@RequestParam("id") Long id) {
|
|
|
+ CrmProductCategoryDO productCategory = productCategoryService.getProductCategory(id);
|
|
|
+ return success(CrmProductCategoryConvert.INSTANCE.convert(productCategory));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
@Operation(summary = "获得产品分类列表")
|
|
|
@PreAuthorize("@ss.hasPermission('crm:product-category:query')")
|
|
|
- public CommonResult<List<ProductCategoryRespVO>> getProductCategoryList(@Valid ProductCategoryListReqVO treeListReqVO) {
|
|
|
- List<ProductCategoryDO> list = productCategoryService.getProductCategoryList(treeListReqVO);
|
|
|
- return success(ProductCategoryConvert.INSTANCE.convertList(list));
|
|
|
+ public CommonResult<List<CrmProductCategoryRespVO>> getProductCategoryList(@Valid CrmProductCategoryListReqVO treeListReqVO) {
|
|
|
+ List<CrmProductCategoryDO> list = productCategoryService.getProductCategoryList(treeListReqVO);
|
|
|
+ return success(CrmProductCategoryConvert.INSTANCE.convertList(list));
|
|
|
}
|
|
|
|
|
|
}
|