|
@@ -14,11 +14,14 @@ import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.PrivilegeRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.RolePrivilegeRelationRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.RootOrgPrivilegeRelationRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.UserRoleRelationRepo;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeEntity;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeGroupEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationPK;
|
|
|
+import cn.com.qmth.examcloud.core.basic.dao.entity.RootOrgPrivilegeRelationEntity;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.RolePrivilegeService;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.RoleInfo;
|
|
|
import cn.com.qmth.examcloud.core.basic.service.cache.PrrivilegeRolesCache;
|
|
@@ -46,6 +49,9 @@ public class RolePrivilegeServiceImpl implements RolePrivilegeService {
|
|
|
@Autowired
|
|
|
RolePrivilegeRelationRepo rolePrivilegeRelationRepo;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ RootOrgPrivilegeRelationRepo rootOrgPrivilegeRelationRepo;
|
|
|
+
|
|
|
@Autowired
|
|
|
PrivilegeGroupRepo privilegeGroupRepo;
|
|
|
|
|
@@ -67,6 +73,9 @@ public class RolePrivilegeServiceImpl implements RolePrivilegeService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ GlobalHelper.getPresentEntity(privilegeGroupRepo, privilegeGroupId,
|
|
|
+ PrivilegeGroupEntity.class);
|
|
|
+
|
|
|
for (Long cur : privilegeIdSet) {
|
|
|
PrivilegeEntity privilegeEntity = GlobalHelper.getPresentEntity(privilegeRepo, cur,
|
|
|
PrivilegeEntity.class);
|
|
@@ -87,15 +96,13 @@ public class RolePrivilegeServiceImpl implements RolePrivilegeService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- rolePrivilegeRelationRepo.deleteByRoleIdAndRootOrgId(roleId, rootOrgId);
|
|
|
-
|
|
|
for (Long cur : privilegeIdSet) {
|
|
|
RolePrivilegeRelationEntity bean = new RolePrivilegeRelationEntity();
|
|
|
bean.setRoleId(roleId);
|
|
|
bean.setRootOrgId(rootOrgId);
|
|
|
bean.setPrivilegeId(cur);
|
|
|
|
|
|
- rolePrivilegeRelationRepo.save(bean);
|
|
|
+ rolePrivilegeRelationRepo.saveAndFlush(bean);
|
|
|
}
|
|
|
|
|
|
for (Long cur : privilegeIdSet) {
|
|
@@ -106,6 +113,32 @@ public class RolePrivilegeServiceImpl implements RolePrivilegeService {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void updateRootOrgPrivilegeRelations(Long rootOrgId, Long privilegeGroupId,
|
|
|
+ Set<Long> privilegeIdSet) {
|
|
|
+
|
|
|
+ GlobalHelper.getPresentEntity(privilegeGroupRepo, privilegeGroupId,
|
|
|
+ PrivilegeGroupEntity.class);
|
|
|
+
|
|
|
+ rootOrgPrivilegeRelationRepo.deleteByRootOrgIdAndGroupId(rootOrgId, privilegeGroupId);
|
|
|
+
|
|
|
+ for (Long cur : privilegeIdSet) {
|
|
|
+ PrivilegeEntity privilegeEntity = GlobalHelper.getPresentEntity(privilegeRepo, cur,
|
|
|
+ PrivilegeEntity.class);
|
|
|
+ if (!privilegeEntity.getGroupId().equals(privilegeGroupId)) {
|
|
|
+ throw new StatusException("620158", "权限和权限组不匹配");
|
|
|
+ }
|
|
|
+
|
|
|
+ RootOrgPrivilegeRelationEntity bean = new RootOrgPrivilegeRelationEntity();
|
|
|
+ bean.setRootOrgId(rootOrgId);
|
|
|
+ bean.setPrivilegeId(cur);
|
|
|
+ bean.setGroupId(privilegeGroupId);
|
|
|
+
|
|
|
+ rootOrgPrivilegeRelationRepo.saveAndFlush(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RoleEntity saveRole(RoleInfo info) {
|
|
|
String code = info.getCode();
|