From 6f07ea04d75b664259bb067ddde9e32fd2abbeae Mon Sep 17 00:00:00 2001 From: smallchill Date: Sat, 3 Aug 2019 00:44:37 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BF=AE=E5=A4=8D=E6=9D=83=E9=99=90?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=95=B0=E6=8D=AE=E9=95=BF=E5=BA=A6=E8=BF=87?= =?UTF-8?q?=E5=A4=A7=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../springblade/system/vo/GrantTreeVO.java | 4 +- .../org/springblade/system/vo/GrantVO.java | 46 +++++++++++++++++++ .../system/controller/RoleController.java | 8 ++-- 3 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantVO.java diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantTreeVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantTreeVO.java index 6e58cc26..c802841f 100644 --- a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantTreeVO.java +++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantTreeVO.java @@ -18,6 +18,7 @@ package org.springblade.system.vo; import lombok.Data; +import java.io.Serializable; import java.util.List; /** @@ -26,7 +27,8 @@ import java.util.List; * @author Chill */ @Data -public class GrantTreeVO { +public class GrantTreeVO implements Serializable { + private static final long serialVersionUID = 1L; private List menu; diff --git a/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantVO.java b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantVO.java new file mode 100644 index 00000000..bfb6e170 --- /dev/null +++ b/blade-service-api/blade-system-api/src/main/java/org/springblade/system/vo/GrantVO.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 庄骞 (smallchill@163.com) + */ +package org.springblade.system.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * GrantVO + * + * @author Chill + */ +@Data +public class GrantVO implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "roleIds集合") + private List roleIds; + + @ApiModelProperty(value = "menuIds集合") + private List menuIds; + + @ApiModelProperty(value = "dataScopeIds集合") + private List dataScopeIds; + + @ApiModelProperty(value = "apiScopeIds集合") + private List apiScopeIds; + +} diff --git a/blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java b/blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java index e86ca99c..313b42f1 100644 --- a/blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java +++ b/blade-service/blade-system/src/main/java/org/springblade/system/controller/RoleController.java @@ -30,6 +30,7 @@ import org.springblade.core.tool.node.INode; import org.springblade.core.tool.utils.Func; import org.springblade.system.entity.Role; import org.springblade.system.service.IRoleService; +import org.springblade.system.vo.GrantVO; import org.springblade.system.vo.RoleVO; import org.springblade.system.wrapper.RoleWrapper; import org.springframework.cache.annotation.CacheEvict; @@ -127,11 +128,8 @@ public class RoleController extends BladeController { @ApiOperationSupport(order = 6) @ApiOperation(value = "权限设置", notes = "传入roleId集合以及menuId集合") @CacheEvict(cacheNames = {SYS_CACHE}, allEntries = true) - public R grant(@ApiParam(value = "roleId集合", required = true) @RequestParam String roleIds, - @ApiParam(value = "menuId集合", required = true) @RequestParam String menuIds, - @ApiParam(value = "dataScopeId集合") String dataScopeIds, - @ApiParam(value = "apiScopeId集合") String apiScopeIds) { - boolean temp = roleService.grant(Func.toLongList(roleIds), Func.toLongList(menuIds), Func.toLongList(dataScopeIds), Func.toLongList(apiScopeIds)); + public R grant(@RequestBody GrantVO grantVO) { + boolean temp = roleService.grant(grantVO.getRoleIds(), grantVO.getMenuIds(), grantVO.getDataScopeIds(), grantVO.getApiScopeIds()); return R.status(temp); }