彭雪彬
2025-07-14 c1d20b425b10e8ba59f102dd1ab413055883eed0
oying-system/src/main/java/com/oying/modules/system/service/impl/RoleServiceImpl.java
@@ -79,9 +79,6 @@
        }
        save(resources);
        // 判断是否有机构数据,若有,则需创建关联
        if (CollectionUtil.isNotEmpty(resources.getDepts())) {
            roleDeptMapper.insertData(resources.getId(), resources.getDepts());
        }
    }
    @Override
@@ -95,16 +92,13 @@
        role.setName(resources.getName());
        role.setDescription(resources.getDescription());
        role.setDataScope(resources.getDataScope());
        role.setDepts(resources.getDepts());
        role.setLevel(resources.getLevel());
        // 更新
        saveOrUpdate(role);
        // 删除关联机构数据
        roleDeptMapper.deleteByRoleId(resources.getId());
        // 判断是否有机构数据,若有,则需更新关联
        if (CollectionUtil.isNotEmpty(resources.getDepts())) {
            roleDeptMapper.insertData(resources.getId(), resources.getDepts());
        }
        // 更新相关缓存
        delCaches(role.getId(), null);
    }