From 96350be7a8fbfcb1163a5826022a442f8feb5fc9 Mon Sep 17 00:00:00 2001 From: zhuo <2089219845@qq.com> Date: 星期四, 13 二月 2025 14:05:26 +0800 Subject: [PATCH] 修改全局Result字段 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 42d9e8f..03da97c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; @@ -33,7 +33,7 @@ /** * 瑙掕壊淇℃伅 - * + * * @author ruoyi */ @RestController @@ -79,7 +79,7 @@ */ @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping(value = "/{roleId}") - public AjaxResult getInfo(@PathVariable Long roleId) + public Result getInfo(@PathVariable Long roleId) { roleService.checkRoleDataScope(roleId); return success(roleService.selectRoleById(roleId)); @@ -91,7 +91,7 @@ @PreAuthorize("@ss.hasPermi('system:role:add')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@Validated @RequestBody SysRole role) + public Result add(@Validated @RequestBody SysRole role) { if (!roleService.checkRoleNameUnique(role)) { @@ -112,7 +112,7 @@ @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@Validated @RequestBody SysRole role) + public Result edit(@Validated @RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); @@ -125,7 +125,7 @@ return error("淇敼瑙掕壊'" + role.getRoleName() + "'澶辫触锛岃鑹叉潈闄愬凡瀛樺湪"); } role.setUpdateBy(getUsername()); - + if (roleService.updateRole(role) > 0) { // 鏇存柊缂撳瓨鐢ㄦ埛鏉冮檺 @@ -147,7 +147,7 @@ @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/dataScope") - public AjaxResult dataScope(@RequestBody SysRole role) + public Result dataScope(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); @@ -160,7 +160,7 @@ @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") - public AjaxResult changeStatus(@RequestBody SysRole role) + public Result changeStatus(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); @@ -174,7 +174,7 @@ @PreAuthorize("@ss.hasPermi('system:role:remove')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{roleIds}") - public AjaxResult remove(@PathVariable Long[] roleIds) + public Result remove(@PathVariable Long[] roleIds) { return toAjax(roleService.deleteRoleByIds(roleIds)); } @@ -184,7 +184,7 @@ */ @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping("/optionselect") - public AjaxResult optionselect() + public Result optionselect() { return success(roleService.selectRoleAll()); } @@ -219,7 +219,7 @@ @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancel") - public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) + public Result cancelAuthUser(@RequestBody SysUserRole userRole) { return toAjax(roleService.deleteAuthUser(userRole)); } @@ -230,7 +230,7 @@ @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancelAll") - public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) + public Result cancelAuthUserAll(Long roleId, Long[] userIds) { return toAjax(roleService.deleteAuthUsers(roleId, userIds)); } @@ -241,7 +241,7 @@ @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT) @PutMapping("/authUser/selectAll") - public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) + public Result selectAuthUserAll(Long roleId, Long[] userIds) { roleService.checkRoleDataScope(roleId); return toAjax(roleService.insertAuthUsers(roleId, userIds)); @@ -252,9 +252,9 @@ */ @PreAuthorize("@ss.hasPermi('system:role:query')") @GetMapping(value = "/deptTree/{roleId}") - public AjaxResult deptTree(@PathVariable("roleId") Long roleId) + public Result deptTree(@PathVariable("roleId") Long roleId) { - AjaxResult ajax = AjaxResult.success(); + Result ajax = Result.success(); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); return ajax; -- Gitblit v1.9.3