From 63a66690008a3adbac1d2034e9d060629206cd55 Mon Sep 17 00:00:00 2001
From: wangmengzhao <1036088376@qq.com>
Date: 星期二, 14 十一月 2023 19:02:29 +0800
Subject: [PATCH] 设备安装的代码编写20231114 wmz
---
wumei-smart-master/springboot/wumei-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java | 74 +++++++++++++------------------------
1 files changed, 26 insertions(+), 48 deletions(-)
diff --git a/wumei-smart-master/springboot/wumei-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/wumei-smart-master/springboot/wumei-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
index a5948de..4e1c0c9 100644
--- a/wumei-smart-master/springboot/wumei-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
+++ b/wumei-smart-master/springboot/wumei-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -2,6 +2,7 @@
import java.util.List;
import javax.servlet.http.HttpServletResponse;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -32,29 +33,27 @@
/**
* 瑙掕壊淇℃伅
- *
+ *
* @author ruoyi
*/
@RestController
@RequestMapping("/system/role")
-public class SysRoleController extends BaseController
-{
+public class SysRoleController extends BaseController {
@Autowired
private ISysRoleService roleService;
@Autowired
private TokenService tokenService;
-
+
@Autowired
private SysPermissionService permissionService;
-
+
@Autowired
private ISysUserService userService;
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/list")
- public TableDataInfo list(SysRole role)
- {
+ public TableDataInfo list(SysRole role) {
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
@@ -63,8 +62,7 @@
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:role:export')")
@PostMapping("/export")
- public void export(HttpServletResponse response, SysRole role)
- {
+ public void export(HttpServletResponse response, SysRole role) {
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
util.exportExcel(response, list, "瑙掕壊鏁版嵁");
@@ -75,8 +73,7 @@
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}")
- public AjaxResult getInfo(@PathVariable Long roleId)
- {
+ public AjaxResult getInfo(@PathVariable Long roleId) {
roleService.checkRoleDataScope(roleId);
return AjaxResult.success(roleService.selectRoleById(roleId));
}
@@ -87,14 +84,10 @@
@PreAuthorize("@ss.hasPermi('system:role:add')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.INSERT)
@PostMapping
- public AjaxResult add(@Validated @RequestBody SysRole role)
- {
- if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
- {
+ public AjaxResult add(@Validated @RequestBody SysRole role) {
+ if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
return AjaxResult.error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪");
- }
- else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
- {
+ } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
return AjaxResult.error("鏂板瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪");
}
role.setCreateBy(getUsername());
@@ -108,25 +101,19 @@
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
@PutMapping
- public AjaxResult edit(@Validated @RequestBody SysRole role)
- {
+ public AjaxResult edit(@Validated @RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
- if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
- {
+ if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
return AjaxResult.error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹插悕绉板凡瀛樺湪");
- }
- else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
- {
+ } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
return AjaxResult.error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪");
}
role.setUpdateBy(getUsername());
-
- if (roleService.updateRole(role) > 0)
- {
+
+ if (roleService.updateRole(role) > 0) {
// 鏇存柊缂撳瓨鐢ㄦ埛鏉冮檺
LoginUser loginUser = getLoginUser();
- if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
- {
+ if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) {
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
tokenService.setLoginUser(loginUser);
@@ -142,8 +129,7 @@
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope")
- public AjaxResult dataScope(@RequestBody SysRole role)
- {
+ public AjaxResult dataScope(@RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
return toAjax(roleService.authDataScope(role));
}
@@ -154,8 +140,7 @@
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
- public AjaxResult changeStatus(@RequestBody SysRole role)
- {
+ public AjaxResult changeStatus(@RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
role.setUpdateBy(getUsername());
return toAjax(roleService.updateRoleStatus(role));
@@ -167,8 +152,7 @@
@PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
- public AjaxResult remove(@PathVariable Long[] roleIds)
- {
+ public AjaxResult remove(@PathVariable Long[] roleIds) {
return toAjax(roleService.deleteRoleByIds(roleIds));
}
@@ -177,8 +161,7 @@
*/
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping("/optionselect")
- public AjaxResult optionselect()
- {
+ public AjaxResult optionselect() {
return AjaxResult.success(roleService.selectRoleAll());
}
@@ -187,8 +170,7 @@
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/allocatedList")
- public TableDataInfo allocatedList(SysUser user)
- {
+ public TableDataInfo allocatedList(SysUser user) {
startPage();
List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list);
@@ -199,8 +181,7 @@
*/
@PreAuthorize("@ss.hasPermi('system:role:list')")
@GetMapping("/authUser/unallocatedList")
- public TableDataInfo unallocatedList(SysUser user)
- {
+ public TableDataInfo unallocatedList(SysUser user) {
startPage();
List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list);
@@ -212,8 +193,7 @@
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancel")
- public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
- {
+ public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
return toAjax(roleService.deleteAuthUser(userRole));
}
@@ -223,8 +203,7 @@
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll")
- public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
- {
+ public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
}
@@ -234,8 +213,7 @@
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll")
- public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
- {
+ public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
return toAjax(roleService.insertAuthUsers(roleId, userIds));
}
}
--
Gitblit v1.8.0