From 360accaf390a8541a325936522ad863ef7b04632 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期三, 27 十二月 2023 16:40:23 +0800
Subject: [PATCH] 密码修改对话框修改,密码修改原密码传参修改
---
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java | 38 +++++++++++++++++++++++++++-----------
1 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java
index d4bb4a0..508ea8d 100644
--- a/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java
+++ b/Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java
@@ -17,32 +17,38 @@
package com.vci.ubcs.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.vci.ubcs.system.cache.NacosConfigCache;
+import com.vci.ubcs.system.cache.SysCache;
+import com.vci.ubcs.system.entity.Role;
import com.vci.ubcs.system.service.IRoleService;
import com.vci.ubcs.system.user.cache.UserCache;
import com.vci.ubcs.system.user.entity.User;
+import com.vci.ubcs.system.vo.GrantVO;
+import com.vci.ubcs.system.vo.RoleVO;
import com.vci.ubcs.system.wrapper.RoleWrapper;
import io.swagger.annotations.*;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.Func;
-import com.vci.ubcs.system.cache.SysCache;
-import com.vci.ubcs.system.entity.Role;
-import com.vci.ubcs.system.vo.GrantVO;
-import com.vci.ubcs.system.vo.RoleVO;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
@@ -60,6 +66,7 @@
public class RoleController extends BladeController {
private final IRoleService roleService;
+ private final NacosConfigCache nacosConfigCache;
/**
* 璇︽儏
@@ -73,19 +80,20 @@
}
/**
- * 鍒楄〃
+ * 鍒嗛〉鍒楄〃
*/
- @GetMapping("/list")
+ @GetMapping("/page")
@ApiImplicitParams({
@ApiImplicitParam(name = "roleName", value = "鍙傛暟鍚嶇О", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "roleAlias", value = "瑙掕壊鍒悕", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "鍒楄〃", notes = "浼犲叆role")
- public R<List<RoleVO>> list(@ApiIgnore @RequestParam Map<String, Object> role, BladeUser bladeUser) {
+ public R<IPage<RoleVO>> list(@ApiIgnore @RequestParam Map<String, Object> role, BladeUser bladeUser, Query query) {
QueryWrapper<Role> queryWrapper = Condition.getQueryWrapper(role, Role.class);
- List<Role> list = roleService.list((!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(Role::getTenantId, bladeUser.getTenantId()) : queryWrapper);
- return R.data(RoleWrapper.build().listNodeVO(list));
+ IPage<Role> page = roleService.page(Condition.getPage(query),
+ (!bladeUser.getTenantId().equals(nacosConfigCache.getAdminUserInfo().getTenantId())) ? queryWrapper.lambda().eq(Role::getTenantId, bladeUser.getTenantId()) : queryWrapper);
+ return R.data(RoleWrapper.build().pageNodeVO(page));
}
/**
@@ -123,7 +131,6 @@
return R.status(roleService.submit(role));
}
-
/**
* 鍒犻櫎
*/
@@ -145,7 +152,16 @@
public R grant(@RequestBody GrantVO grantVO) {
CacheUtil.clear(SYS_CACHE);
CacheUtil.clear(SYS_CACHE, Boolean.FALSE);
- boolean temp = roleService.grant(grantVO.getRoleIds(), grantVO.getMenuIds(), grantVO.getDataScopeIds(), grantVO.getApiScopeIds());
+ boolean temp = false;
+ try {
+ temp = roleService.grant(grantVO.getRoleIds(), grantVO.getMenuIds(), grantVO.getDataScopeIds(), grantVO.getApiScopeIds());
+ // 鎻掑叆鎺堟潈鏃ュ織
+ roleService.grantLog(roleService.getGrantRoleResString(grantVO.getRoleIds()),false);
+ }catch (Exception e){
+ // 澶辫触鏃舵彃鍏ュ紓甯镐俊鎭埌鏃ュ織涓�
+ roleService.grantLog(e.getMessage(),true);
+ throw e;
+ }
return R.status(temp);
}
--
Gitblit v1.9.3