use of vip.mate.system.entity.SysRole in project matecloud by matevip.
the class SysRoleController method allList.
/**
* 所有角色列表
*
* @return List
*/
@PreAuth
@Log(value = "所有角色列表")
@GetMapping("/all-list")
@ApiOperation(value = "所有角色列表")
public Result<?> allList() {
// 设置一个未授权的角色信息,提供给前端使用
SysRole sysRole = new SysRole();
sysRole.setId(NumberUtil.parseLong(SystemConstant.ROLE_DEFAULT_ID));
sysRole.setRoleName(SystemConstant.ROLE_DEFAULT_VALUE);
// 查询所有角色列表
List<SysRole> list = sysRoleService.list();
// 增加未授权角色信息
list.add(sysRole);
// 业务返回
return Result.data(list);
}
use of vip.mate.system.entity.SysRole in project matecloud by matevip.
the class SysRoleServiceImpl method set.
@Override
@Transactional(rollbackFor = Exception.class)
public boolean set(SysRole sysRole) {
this.saveOrUpdate(sysRole);
if (ObjectUtil.isNotEmpty(sysRole.getMenu())) {
List<SysRolePermission> collect = sysRole.getMenu().stream().map(s -> {
SysRolePermission sysRolePermission = new SysRolePermission();
sysRolePermission.setMenuId(Long.valueOf(s));
sysRolePermission.setRoleId(sysRole.getId());
return sysRolePermission;
}).collect(Collectors.toList());
// 根据角色ID删除所有菜单值
sysRolePermissionService.remove(Wrappers.<SysRolePermission>lambdaQuery().eq(SysRolePermission::getRoleId, sysRole.getId()));
// 重新写入角色对应的权限值
sysRolePermissionService.saveBatch(collect);
}
return Boolean.TRUE;
}
use of vip.mate.system.entity.SysRole in project matecloud by matevip.
the class SysRoleServiceImpl method export.
@Override
public List<SysRolePOI> export() {
LambdaQueryWrapper<SysRole> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SysRole::getIsDeleted, 0);
List<SysRole> sysRoles = this.baseMapper.selectList(queryWrapper);
return sysRoles.stream().map(sysRole -> {
SysRolePOI sysRolePOI = new SysRolePOI();
BeanUtils.copyProperties(sysRole, sysRolePOI);
return sysRolePOI;
}).collect(Collectors.toList());
}
Aggregations