From a7d2a73c1b35af72c7d43ea8cfcfc9c1cda2b5f2 Mon Sep 17 00:00:00 2001
From: zepengdev <lzpsmith@outlook.com>
Date: Tue, 17 Jun 2025 16:00:42 +0800
Subject: [PATCH] feat(product): 优化商品图片功能 refactor(store): 重构店铺-商户关联 fix(api): 标准化接口字段

---
 oying-system/src/main/java/com/oying/modules/pc/category/rest/PlatformCategoryAdminController.java |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/pc/category/rest/PlatformCategoryAdminController.java b/oying-system/src/main/java/com/oying/modules/pc/category/rest/PlatformCategoryAdminController.java
index fd2668e..a840d1a 100644
--- a/oying-system/src/main/java/com/oying/modules/pc/category/rest/PlatformCategoryAdminController.java
+++ b/oying-system/src/main/java/com/oying/modules/pc/category/rest/PlatformCategoryAdminController.java
@@ -1,5 +1,6 @@
 package com.oying.modules.pc.category.rest;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.oying.annotation.Log;
 import com.oying.modules.pc.category.converter.PlatformCategoryViewAssembler;
@@ -9,13 +10,14 @@
 import com.oying.modules.pc.category.domain.dto.PlatformCategoryUpdateDto;
 import com.oying.modules.pc.category.domain.dto.PlatformCategoryUpdateRequest;
 import com.oying.modules.pc.category.service.PlatformCategoryService;
-import com.oying.modules.pc.category.view.PlatformCategoryView;
+import com.oying.modules.pc.category.view.PlatformCategoryAdminView;
 import com.oying.utils.R;
 import com.oying.utils.PageResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -41,14 +43,14 @@
     private final PlatformCategoryService categoryService;
     private final PlatformCategoryViewAssembler assembler;
 
-    @GetMapping
+    @GetMapping(value = "/list")
     @ApiOperation("查询平台类目(支持分页)")
-    @PreAuthorize("@el.check('admin:platformCategory:list')")
+    //@PreAuthorize("@el.check('admin:platformCategory:list')")
     public ResponseEntity<?> queryPlatformCategory(PlatformCategoryQueryCriteria criteria) {
         Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
         PageResult<PlatformCategory> pageResult = categoryService.queryAll(criteria, page);
-        List<PlatformCategoryView> responseList = Optional.ofNullable(pageResult.getContent()).orElse(new ArrayList<>()).stream().map(assembler::toPlatformCategoryResponse).collect(Collectors.toList());
-        PageResult<PlatformCategoryView> responsePageResult = new PageResult<>(responseList, pageResult.getTotalElements());
+        List<PlatformCategoryAdminView> responseList = Optional.ofNullable(pageResult.getContent()).orElse(new ArrayList<>()).stream().map(assembler::toPlatformCategoryResponse).collect(Collectors.toList());
+        PageResult<PlatformCategoryAdminView> responsePageResult = new PageResult<>(responseList, pageResult.getTotalElements());
         return ResponseEntity.ok(R.success(responsePageResult));
     }
 
@@ -60,14 +62,14 @@
         return ResponseEntity.status(HttpStatus.CREATED).build();
     }
 
-    @PutMapping("/{categoryId}")
+    @PutMapping(value = "/{categoryId}")
     @ApiOperation("修改平台类目")
     //@PreAuthorize("@el.check('admin:platformCategory:updateById')")
     public ResponseEntity<?> updateById(@PathVariable Long categoryId,
                        @Validated @RequestBody PlatformCategoryUpdateRequest request) {
+        request.setCategoryId(ObjectUtils.defaultIfNull(request.getCategoryId(), categoryId));
         PlatformCategoryUpdateDto updateDto = new PlatformCategoryUpdateDto();
         BeanUtils.copyProperties(request, updateDto);
-        updateDto.setCategoryId(categoryId);
         categoryService.update(updateDto);
         return ResponseEntity.noContent().build();
     }

--
Gitblit v1.9.3