| | |
| | | * @throws VciBaseException 参数为空的时候会抛出异常 |
| | | */ |
| | | @Override |
| | | public DataGrid<SmRoleVO> gridRoles(Map<String, String> queryMap, |
| | | PageHelper pageHelper) throws VciBaseException { |
| | | public DataGrid<SmRoleVO> gridRoles(Map<String, String> queryMap, PageHelper pageHelper) throws VciBaseException { |
| | | if(pageHelper == null){ |
| | | pageHelper = new PageHelper(-1); |
| | | } |
| | | pageHelper.addDefaultAsc("plname"); |
| | | VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(queryMap,SmRoleForPlatform1.class,pageHelper); |
| | | //我们不能显示三员和管理员的角色 |
| | | queryWrapper.eq("pltype","2"); |
| | | //queryWrapper.eq("pltype","2"); |
| | | List<SmRoleForPlatform1> roleForPlatform1s = boService.selectByQueryWrapper(queryWrapper, SmRoleForPlatform1.class); |
| | | DataGrid<SmRoleVO> dataGrid = new DataGrid<>(); |
| | | if(!CollectionUtils.isEmpty(roleForPlatform1s)){ |
| | |
| | | public boolean saveRights(String userOid, String[] roleIds) throws PLException { |
| | | VciBaseUtil.alertNotNull(userOid,"用户主键"); |
| | | //roleIds允许为空,为空时清空当前用户的权限 |
| | | //先查重 |
| | | if(Func.isNotEmpty(roleIds)){ |
| | | List<String> repeatRoleOidList = new ArrayList<>(); |
| | | //循环进行查重,避免in大于1000 |
| | | WebUtil.switchCollectionForOracleIn(Arrays.asList(roleIds)).stream().forEach(deptoids->{ |
| | | String sql = "select pluseruid,plroleuid from pluserrole where pluseruid = '" + userOid |
| | | + "' and " + "plroleuid in ("+WebUtil.toInSql(deptoids.toArray(new String[0]))+")"; |
| | | List<BusinessObject> cbos = boService.queryBySql(sql, null); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | repeatRoleOidList.add(ObjectTool.getNewBOAttributeValue(cbo,"plroleuid")); |
| | | }); |
| | | } |
| | | }); |
| | | //移除重复的 |
| | | List<String> tempList = new ArrayList<>(Arrays.asList(roleIds)); |
| | | tempList.removeAll(repeatRoleOidList); |
| | | roleIds = tempList.toArray(new String[tempList.size()]); |
| | | } |
| | | return platformClientUtil.getFrameworkService().saveRights(roleIds,new String[]{userOid},new UserEntityInfo()); |
| | | } |
| | | |