|
|
@@ -13,8 +13,11 @@ import com.ydtech.modules.admin.service.SysRoleService;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.lang.reflect.Array;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -85,8 +88,14 @@ public class SysRoleController extends BaseController {
|
|
|
LambdaQueryWrapper<SysRole> lqw = new LambdaQueryWrapper<>();
|
|
|
//获取角色的配置信息
|
|
|
RoleConstants roleConstants = RoleConstants.getRoleConstants(user.getRoleId());
|
|
|
- if (!"".equals(roleConstants.getRoleIds())) {
|
|
|
- lqw.in(SysRole::getId, roleConstants.getRoleIds().split(","));
|
|
|
+
|
|
|
+ if (!user.getId().equals("admin")) {
|
|
|
+ if(ObjectUtils.isEmpty(roleConstants)){
|
|
|
+ lqw.eq(SysRole::getId, RoleConstants.R22.getCode());
|
|
|
+ }else if (!"".equals(roleConstants.getRoleIds())) {
|
|
|
+ String[] split = roleConstants.getRoleIds().split(",");
|
|
|
+ lqw.in(SysRole::getId, Arrays.asList(split));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
lqw.eq(SysRole::getDelFlag, "0");
|
|
|
@@ -105,7 +114,7 @@ public class SysRoleController extends BaseController {
|
|
|
@PostMapping(value = "/saveRoleMenus")
|
|
|
public HttpResult saveRoleMenus(@RequestBody List<SysRoleMenu> records) {
|
|
|
|
|
|
- if (null == records || records.size() < 1) {
|
|
|
+ if (null == records || records.isEmpty()) {
|
|
|
return HttpResult.error("参数空");
|
|
|
}
|
|
|
SysRole sysRole = sysRoleService.getById(records.get(0).getRoleId());
|