|
@@ -35,7 +35,7 @@ public class SysRoleController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SysRoleMenuService sysRoleMenuService;
|
|
private SysRoleMenuService sysRoleMenuService;
|
|
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('sys:role:add') AND hasAuthority('sys:role:edit')")
|
|
|
|
|
|
|
+ // @PreAuthorize("hasAuthority('sys:role:add') AND hasAuthority('sys:role:edit')")
|
|
|
@PostMapping(value = "/save")
|
|
@PostMapping(value = "/save")
|
|
|
public HttpResult save(@RequestBody SysRole record) {
|
|
public HttpResult save(@RequestBody SysRole record) {
|
|
|
SysRole role = sysRoleService.getById(record.getId());
|
|
SysRole role = sysRoleService.getById(record.getId());
|
|
@@ -52,7 +52,7 @@ public class SysRoleController extends BaseController {
|
|
|
return HttpResult.ok(sysRoleService.saveOrUpdate(record));
|
|
return HttpResult.ok(sysRoleService.saveOrUpdate(record));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('sys:role:delete')")
|
|
|
|
|
|
|
+ // @PreAuthorize("hasAuthority('sys:role:delete')")
|
|
|
@PostMapping(value = "/delete")
|
|
@PostMapping(value = "/delete")
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public HttpResult delete(@RequestBody List<SysRole> records) {
|
|
public HttpResult delete(@RequestBody List<SysRole> records) {
|
|
@@ -63,17 +63,17 @@ public class SysRoleController extends BaseController {
|
|
|
// return HttpResult.ok(sysRoleService.delete(records));
|
|
// return HttpResult.ok(sysRoleService.delete(records));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('sys:role:view')")
|
|
|
|
|
|
|
+ // @PreAuthorize("hasAuthority('sys:role:view')")
|
|
|
@PostMapping(value = "/findPage")
|
|
@PostMapping(value = "/findPage")
|
|
|
public HttpResult findPage(@RequestBody PageRequest pageRequest) {
|
|
public HttpResult findPage(@RequestBody PageRequest pageRequest) {
|
|
|
return HttpResult.ok(sysRoleService.findPage(pageRequest));
|
|
return HttpResult.ok(sysRoleService.findPage(pageRequest));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('sys:role:view')")
|
|
|
|
|
|
|
+ // @PreAuthorize("hasAuthority('sys:role:view')")
|
|
|
@GetMapping(value = "/findAll")
|
|
@GetMapping(value = "/findAll")
|
|
|
public HttpResult findAll() {
|
|
public HttpResult findAll() {
|
|
|
LambdaQueryWrapper<SysRole> lqw = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<SysRole> lqw = new LambdaQueryWrapper<>();
|
|
|
- lqw.eq(SysRole::getDelFlag,"0");
|
|
|
|
|
|
|
+ lqw.eq(SysRole::getDelFlag, "0");
|
|
|
List<SysRole> list = sysRoleService.list(lqw);
|
|
List<SysRole> list = sysRoleService.list(lqw);
|
|
|
return HttpResult.ok(list);
|
|
return HttpResult.ok(list);
|
|
|
}
|
|
}
|
|
@@ -84,28 +84,28 @@ public class SysRoleController extends BaseController {
|
|
|
SysUser user = getUser();
|
|
SysUser user = getUser();
|
|
|
LambdaQueryWrapper<SysRole> lqw = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<SysRole> lqw = new LambdaQueryWrapper<>();
|
|
|
//获取角色的配置信息
|
|
//获取角色的配置信息
|
|
|
- RoleConstants roleConstants = RoleConstants. getRoleConstants(user.getRoleId());
|
|
|
|
|
- if(!"".equals(roleConstants.getRoleIds())){
|
|
|
|
|
- lqw.in(SysRole::getId,roleConstants.getRoleIds().split(","));
|
|
|
|
|
|
|
+ RoleConstants roleConstants = RoleConstants.getRoleConstants(user.getRoleId());
|
|
|
|
|
+ if (!"".equals(roleConstants.getRoleIds())) {
|
|
|
|
|
+ lqw.in(SysRole::getId, roleConstants.getRoleIds().split(","));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- lqw.eq(SysRole::getDelFlag,"0");
|
|
|
|
|
|
|
+ lqw.eq(SysRole::getDelFlag, "0");
|
|
|
List<SysRole> list = sysRoleService.list(lqw);
|
|
List<SysRole> list = sysRoleService.list(lqw);
|
|
|
return HttpResult.ok(list);
|
|
return HttpResult.ok(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('sys:role:view')")
|
|
|
|
|
|
|
+ // @PreAuthorize("hasAuthority('sys:role:view')")
|
|
|
@GetMapping(value = "/findRoleMenus")
|
|
@GetMapping(value = "/findRoleMenus")
|
|
|
public HttpResult findRoleMenus(@RequestParam Long roleId) {
|
|
public HttpResult findRoleMenus(@RequestParam Long roleId) {
|
|
|
return HttpResult.ok(sysRoleService.findRoleMenus(roleId));
|
|
return HttpResult.ok(sysRoleService.findRoleMenus(roleId));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @PreAuthorize("hasAuthority('sys:role:view')")
|
|
|
|
|
|
|
+ // @PreAuthorize("hasAuthority('sys:role:view')")
|
|
|
@PostMapping(value = "/saveRoleMenus")
|
|
@PostMapping(value = "/saveRoleMenus")
|
|
|
public HttpResult saveRoleMenus(@RequestBody List<SysRoleMenu> records) {
|
|
public HttpResult saveRoleMenus(@RequestBody List<SysRoleMenu> records) {
|
|
|
|
|
|
|
|
- if(null == records || records.size() < 1){
|
|
|
|
|
|
|
+ if (null == records || records.size() < 1) {
|
|
|
return HttpResult.error("参数空");
|
|
return HttpResult.error("参数空");
|
|
|
}
|
|
}
|
|
|
SysRole sysRole = sysRoleService.getById(records.get(0).getRoleId());
|
|
SysRole sysRole = sysRoleService.getById(records.get(0).getRoleId());
|