| | |
| | | package com.aps.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | import com.aps.system.api.domain.SysDept; |
| | | import com.aps.system.mapper.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import com.aps.system.domain.SysRoleDept; |
| | | import com.aps.system.domain.SysRoleMenu; |
| | | import com.aps.system.domain.SysUserRole; |
| | | import com.aps.system.mapper.SysRoleDeptMapper; |
| | | import com.aps.system.mapper.SysRoleMapper; |
| | | import com.aps.system.mapper.SysRoleMenuMapper; |
| | | import com.aps.system.mapper.SysUserRoleMapper; |
| | | import com.aps.system.service.ISysRoleService; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private SysRoleDeptMapper roleDeptMapper; |
| | | |
| | | @Autowired |
| | | private SysDeptMapper deptMapper; |
| | | /** |
| | | * 根据条件分页查询角色数据 |
| | | * |
| | |
| | | int rows = 1; |
| | | // 新增角色与部门(数据权限)管理 |
| | | List<SysRoleDept> list = new ArrayList<SysRoleDept>(); |
| | | for (Long deptId : role.getDeptIds()) |
| | | Long[] deptIds = role.getDeptIds(); |
| | | List<SysDept> sysDepts = deptMapper.selectDeptListByIdList(Arrays.asList(deptIds)); |
| | | |
| | | for (Long deptId : deptIds) |
| | | { |
| | | Optional<SysDept> first = sysDepts.stream().filter(sysDept -> sysDept.getDeptId().equals(deptId)).findFirst(); |
| | | if(first.isPresent()){ |
| | | SysDept sysDept = first.get(); |
| | | SysRoleDept rd = new SysRoleDept(); |
| | | rd.setRoleId(role.getRoleId()); |
| | | rd.setDeptId(deptId); |
| | | rd.setDeptOrgCode(sysDept.getOrgCode()); |
| | | list.add(rd); |
| | | } |
| | | |
| | | } |
| | | if (list.size() > 0) |
| | | { |
| | | rows = roleDeptMapper.batchRoleDept(list); |