diff --git a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java index db83452..8e3cf8c 100644 --- a/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java +++ b/muyu-modules/muyu-product/muyu-product-server/src/main/java/com/muyu/product/controller/CategoryInfoController.java @@ -3,6 +3,8 @@ package com.muyu.product.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.muyu.common.security.utils.SecurityUtils; +import com.muyu.product.domain.resp.CategoryParentCommonElementResp; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -20,7 +22,6 @@ import com.muyu.common.log.annotation.Log; import com.muyu.common.log.enums.BusinessType; import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.product.domain.CategoryInfo; -import com.muyu.product.domain.req.CategoryInfoQueryReq; import com.muyu.product.domain.req.CategoryInfoSaveReq; import com.muyu.product.domain.req.CategoryInfoEditReq; import com.muyu.product.service.CategoryInfoService; @@ -76,12 +77,15 @@ public class CategoryInfoController extends BaseController { /** * 新增品类信息 */ + @RequiresPermissions("product:category:add") @Log(title = "品类信息", businessType = BusinessType.INSERT) @PostMapping @ApiOperation("新增品类信息") public Result add(@RequestBody CategoryInfoSaveReq categoryInfoSaveReq) { - return toAjax(categoryInfoService.save(CategoryInfo.saveBuild(categoryInfoSaveReq))); + return toAjax(categoryInfoService.save( + CategoryInfo.saveModelBuild(categoryInfoSaveReq) + )); } /** @@ -106,4 +110,18 @@ public class CategoryInfoController extends BaseController { public Result remove(@PathVariable List ids) { return toAjax(categoryInfoService.removeBatchByIds(ids)); } + + /** + * 通过品类ID获取父级以上的属性、属性组、品牌集合 + * @param categoryId 品类ID + * @return 父级以上的属性、属性组、品牌集合 + */ + @GetMapping("/parentCommonElement/{categoryId}") + @ApiOperation("通过品类ID获取父级以上的属性集合") + @ApiImplicitParam(name = "categoryId", value = "categoryId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class, example = "1") + public Result parentCommonElement( + @PathVariable(value = "categoryId") Long categoryId + ) { + return Result.success(categoryInfoService.parentCommonElement(categoryId)); + } }