From 9a30a3a8d3862a9b2ce898535b7cb51c3ddac816 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期三, 20 五月 2026 16:01:11 +0800
Subject: [PATCH] refactor(controller): 将控制器响应结果统一为R类型并继承BaseController

---
 src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java |   41 +++++++++++++++++++----------------------
 1 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java b/src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java
index 3f82c37..644cea9 100644
--- a/src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java
+++ b/src/main/java/com/ruoyi/warehouse/controller/WarehouseGoodsShelvesController.java
@@ -1,54 +1,51 @@
 package com.ruoyi.warehouse.controller;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
-import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.framework.web.domain.R;
 import com.ruoyi.warehouse.dto.WarehouseGoodsShelvesDto;
 import com.ruoyi.warehouse.pojo.WarehouseGoodsShelves;
 import com.ruoyi.warehouse.service.WarehouseGoodsShelvesService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
 @RestController
-@Api(tags = "鍟嗗搧璐ф灦")
+@Tag(name = "鍟嗗搧璐ф灦")
 @RequestMapping("/warehouse/goodsShelves")
+@AllArgsConstructor
 public class WarehouseGoodsShelvesController extends BaseController {
-    @Autowired
     private WarehouseGoodsShelvesService warehouseGoodsShelvesService;
 
     @GetMapping("/listById")
-    @ApiOperation("鍟嗗搧璐ф灦-鏌ヨ")
+    @Operation(summary = "鍟嗗搧璐ф灦-鏌ヨ")
     @Log(title = "鍟嗗搧璐ф灦-鏌ヨ", businessType = BusinessType.OTHER)
-    public AjaxResult listById(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) {
+    public R<?> listById(WarehouseGoodsShelves warehouseGoodsShelves) {
         List<WarehouseGoodsShelvesDto> list = warehouseGoodsShelvesService.findList(warehouseGoodsShelves);
-        return AjaxResult.success(list);
+        return R.ok(list);
     }
     @PostMapping("/add")
-    @ApiOperation("鍟嗗搧璐ф灦-娣诲姞")
+    @Operation(summary = "鍟嗗搧璐ф灦-娣诲姞")
     @Log(title = "鍟嗗搧璐ф灦-娣诲姞", businessType = BusinessType.INSERT)
-    public AjaxResult add(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) {
-        return AjaxResult.success(warehouseGoodsShelvesService.add(warehouseGoodsShelves));
+    public R<?> add(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) {
+        return R.ok(warehouseGoodsShelvesService.add(warehouseGoodsShelves));
     }
     @PutMapping("/update")
-    @ApiOperation("鍟嗗搧璐ф灦-鏇存柊")
+    @Operation(summary = "鍟嗗搧璐ф灦-鏇存柊")
     @Log(title = "鍟嗗搧璐ф灦-鏇存柊", businessType = BusinessType.UPDATE)
-    public AjaxResult update(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) {
-        return AjaxResult.success(warehouseGoodsShelvesService.updateRowcolById(warehouseGoodsShelves));
+    public R<?> update(@RequestBody WarehouseGoodsShelves warehouseGoodsShelves) {
+        return R.ok(warehouseGoodsShelvesService.updateRowcolById(warehouseGoodsShelves));
     }
     @DeleteMapping("/delete")
-    @ApiOperation("鍟嗗搧璐ф灦-鍒犻櫎")
+    @Operation(summary = "鍟嗗搧璐ф灦-鍒犻櫎")
     @Log(title = "鍟嗗搧璐ф灦-鍒犻櫎", businessType = BusinessType.DELETE)
-    public AjaxResult delete(@RequestBody List<Long> ids) {
-        if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
-        return  AjaxResult.success(warehouseGoodsShelvesService.deleteByIds(ids));
+    public R<?> delete(@RequestBody List<Long> ids) {
+        if(CollectionUtils.isEmpty(ids)) return R.fail("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
+        return  R.ok(warehouseGoodsShelvesService.deleteByIds(ids));
     }
 }

--
Gitblit v1.9.3