| | |
| | | import com.kidgrow.common.annotation.LoginUser; |
| | | import com.kidgrow.common.model.*; |
| | | import com.kidgrow.usercenter.dto.SysRoleOrganizationDto; |
| | | import com.kidgrow.usercenter.mapper.SysRoleMapper; |
| | | import com.kidgrow.usercenter.service.ISysOrganizationService; |
| | | import com.kidgrow.usercenter.service.ISysRoleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private ISysRoleService iSysRoleService; |
| | | @Autowired |
| | | private SysOrganizationServiceImpl sysOrganizationService; |
| | | @Autowired |
| | | private SysRoleMapper sysRoleMapper; |
| | | |
| | | /** |
| | | * 列表 |
| | |
| | | } |
| | | return listMap; |
| | | } |
| | | |
| | | /** |
| | | * 将权限 分装到map对像 |
| | | * @param params |
| | | * @param user |
| | | */ |
| | | |
| | | public void getRoleOrg(Map<String, Object> params, SysUser user){ |
| | | List<SysRole> roles = user.getRoles(); |
| | | List<Map<Integer,List<SysRoleOrganization>>> listroleOrg=new ArrayList<>(); |
| | | if (!roles.isEmpty()) { |
| | | roles.forEach(e->{ |
| | | Map<Integer,List<SysRoleOrganization>> rolemap=new HashMap<>(); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("role_id",e.getId()); |
| | | List<SysRoleOrganization> sysRoleOrganizations = baseMapper.selectByMap(map); |
| | | if(sysRoleOrganizations.size()>0){ |
| | | SysRole sysRole = sysRoleMapper.selectById(e.getId()); |
| | | rolemap.put(sysRole.getType(),sysRoleOrganizations); |
| | | listroleOrg.add(rolemap); |
| | | } |
| | | }); |
| | | } |
| | | //添加权限控制 |
| | | params.put("roleOrg",listroleOrg); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getRoleOrgMap(SysUser user) { |
| | | Map<String, Object> map=new HashMap<>(); |
| | | getRoleOrg(map,user); |
| | | return map; |
| | | } |
| | | } |