From 3244b550596e0330031b3f4547356927df83b0ad Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期一, 19 五月 2025 11:48:35 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TCarportController.java |   29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TCarportController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TCarportController.java
index 0149ad4..66a452d 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TCarportController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TCarportController.java
@@ -8,14 +8,18 @@
 import com.ruoyi.chargingPile.service.TCarportService;
 import com.ruoyi.chargingPile.service.TVehicleRampService;
 import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.core.web.domain.BaseDelete;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.log.enums.OperatorType;
+import com.ruoyi.common.security.annotation.Logical;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -43,6 +47,7 @@
     /**
      * 通过停车场id查询车库及车道信息
      */
+    @RequiresPermissions(value = {"/parkingLot"}, logical = Logical.OR)
     @ApiOperation(tags = {"后台-车库"},value = "通过停车场id查询车库及车道信息")
     @GetMapping(value = "/queryCarportByParkId")
     public AjaxResult<List<TCarportVO>> queryCarportByParkId(@RequestParam(value = "parkingLotId", required = true) Integer parkingLotId) {
@@ -53,7 +58,8 @@
     /**
      * 添加车库管理
      */
-    @Log(title = "添加车库", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
+    @RequiresPermissions(value = {"/parkingLot/add_garage"}, logical = Logical.OR)
+    @Log(title = "【车库】添加车库", businessType = BusinessType.INSERT)
     @ApiOperation(tags = {"后台-车库"},value = "添加车库")
     @PostMapping(value = "/add")
     public AjaxResult<Boolean> add(@RequestBody TCarport dto) {
@@ -63,7 +69,8 @@
     /**
      * 修改车库
      */
-    @Log(title = "修改车库", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE)
+    @RequiresPermissions(value = {"/parkingLot/update_garage"}, logical = Logical.OR)
+    @Log(title = "【车库】修改车库", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE)
     @ApiOperation(tags = {"后台-车库"},value = "修改车库")
     @PostMapping(value = "/update")
     public AjaxResult<Boolean> update(@RequestBody TCarport dto) {
@@ -73,19 +80,21 @@
     /**
      * 查看车库详情
      */
+    @RequiresPermissions(value = {"/parkingLot/update_garage"}, logical = Logical.OR)
     @ApiOperation(tags = {"后台-车库"},value = "查看车库详情")
     @GetMapping(value = "/getDetailById")
-    public AjaxResult<TCarport> getDetailById(@RequestParam Integer id) {
+    public AjaxResult<TCarport> getDetailById(@RequestParam("id") Integer id) {
         return AjaxResult.ok(carportService.getById(id));
     }
 
     /**
      * 删除车库
      */
-    @Log(title = "删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
+    @RequiresPermissions(value = {"/parkingLot/del_garage"}, logical = Logical.OR)
+    @Log(title = "【车库】删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
     @ApiOperation(tags = {"后台-车库"},value = "删除车库")
     @DeleteMapping(value = "/deleteById")
-    public AjaxResult<Boolean> deleteById(@RequestParam Integer id) {
+    public AjaxResult<Boolean> deleteById(@RequestParam("id") Integer id) {
         // 刪除车道信息
         vehicleRampService.remove(Wrappers.lambdaQuery(TVehicleRamp.class)
                 .eq(TVehicleRamp::getCarportId, id));
@@ -95,14 +104,16 @@
     /**
      * 批量删除车库
      */
-    @Log(title = "批量删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
+    @RequiresPermissions(value = {"/parkingLot/del_garage"}, logical = Logical.OR)
+    @Log(title = "【车库】批量删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE)
     @ApiOperation(tags = {"后台-车库"},value = "批量删除车库")
     @DeleteMapping(value = "/deleteByIds")
-    public AjaxResult<Boolean> deleteByIds(@RequestBody List<Integer> ids) {
+    public AjaxResult<Boolean> deleteByIds(@RequestParam String ids) {
+        String[] split = ids.split(",");
         // 刪除车道信息
         vehicleRampService.remove(Wrappers.lambdaQuery(TVehicleRamp.class)
-                .in(TVehicleRamp::getCarportId, ids));
-        return AjaxResult.ok(carportService.removeByIds(ids));
+                .in(TVehicleRamp::getCarportId, Arrays.asList(split)));
+        return AjaxResult.ok(carportService.removeByIds(Arrays.asList(split)));
     }
     
 }

--
Gitblit v1.7.1