From d55278560d29562b341aafa1652209a8aae0af33 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期四, 30 四月 2026 17:08:16 +0800
Subject: [PATCH] 计量器具台账附件修改
---
src/main/java/com/ruoyi/project/system/controller/SysMenuController.java | 44 +++++++++++++++++++-------------------------
1 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/system/controller/SysMenuController.java b/src/main/java/com/ruoyi/project/system/controller/SysMenuController.java
index 9f4d81b..865e8a4 100644
--- a/src/main/java/com/ruoyi/project/system/controller/SysMenuController.java
+++ b/src/main/java/com/ruoyi/project/system/controller/SysMenuController.java
@@ -1,17 +1,5 @@
package com.ruoyi.project.system.controller;
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
@@ -20,6 +8,12 @@
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.SysMenu;
import com.ruoyi.project.system.service.ISysMenuService;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
/**
* 鑿滃崟淇℃伅
@@ -28,9 +22,9 @@
*/
@RestController
@RequestMapping("/system/menu")
+@AllArgsConstructor
public class SysMenuController extends BaseController
{
- @Autowired
private ISysMenuService menuService;
/**
@@ -41,7 +35,7 @@
public AjaxResult list(SysMenu menu)
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
- return AjaxResult.success(menus);
+ return success(menus);
}
/**
@@ -51,7 +45,7 @@
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId)
{
- return AjaxResult.success(menuService.selectMenuById(menuId));
+ return success(menuService.selectMenuById(menuId));
}
/**
@@ -61,7 +55,7 @@
public AjaxResult treeselect(SysMenu menu)
{
List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());
- return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
+ return success(menuService.buildMenuTreeSelect(menus));
}
/**
@@ -85,13 +79,13 @@
@PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu)
{
- if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
+ if (!menuService.checkMenuNameUnique(menu))
{
- return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
+ return error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
- return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
+ return error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
}
menu.setCreateBy(getUsername());
return toAjax(menuService.insertMenu(menu));
@@ -105,17 +99,17 @@
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
{
- if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
+ if (!menuService.checkMenuNameUnique(menu))
{
- return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
+ return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
}
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
{
- return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
+ return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
}
else if (menu.getMenuId().equals(menu.getParentId()))
{
- return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介�夋嫨鑷繁");
+ return error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屼笂绾ц彍鍗曚笉鑳介�夋嫨鑷繁");
}
menu.setUpdateBy(getUsername());
return toAjax(menuService.updateMenu(menu));
@@ -131,11 +125,11 @@
{
if (menuService.hasChildByMenuId(menuId))
{
- return AjaxResult.error("瀛樺湪瀛愯彍鍗�,涓嶅厑璁稿垹闄�");
+ return warn("瀛樺湪瀛愯彍鍗�,涓嶅厑璁稿垹闄�");
}
if (menuService.checkMenuExistRole(menuId))
{
- return AjaxResult.error("鑿滃崟宸插垎閰�,涓嶅厑璁稿垹闄�");
+ return warn("鑿滃崟宸插垎閰�,涓嶅厑璁稿垹闄�");
}
return toAjax(menuService.deleteMenuById(menuId));
}
--
Gitblit v1.9.3