From db515d913ca406ebe846f0a990101b45ff16b295 Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Fri, 28 Jun 2024 18:58:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=86=85=E7=BD=AE=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=88=86=E9=85=8D=E7=94=A8=E6=88=B7=E7=9A=84userole=E6=8C=87?= =?UTF-8?q?=E5=90=91=E6=89=80=E9=80=89=E6=9C=BA=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../permission/PermissionServiceImpl.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/PermissionServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/PermissionServiceImpl.java index 804c3d7fe..76c5947eb 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/PermissionServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/permission/PermissionServiceImpl.java @@ -346,19 +346,13 @@ public class PermissionServiceImpl implements PermissionService { } // 前端没传或者查一次后切换了组织导致跟角色组织不一致的统一为角色的组织 Long roleOrganId = role.getOrganId(); - if (Objects.isNull(organId) || ObjectUtil.notEqual(roleOrganId, organId)) { + boolean isOrganRole = Objects.equals(roleId, InternalRoleConstants.ORGAN_ADMIN_ROLE_ID) || Objects.equals(roleId, InternalRoleConstants.ORGAN_STAFF_ROLE_ID); + // 内置角色还是按照机构来存 + if (!isOrganRole && (Objects.isNull(organId) || ObjectUtil.notEqual(roleOrganId, organId))) { organId = roleOrganId; } final Long finalOrganId = organId; - // 当前用户不能操作含有自己的角色 - if (CollectionUtil.isNotEmpty(userIds)) { - Long incloudSelf = userIds.stream().filter(userId -> userId.equals(loginUser.getId())).findAny().orElse(null); - if (incloudSelf != null) { - throw new ServiceException(ROLE_ME_ERROR); - } - } - // 获得角色下的角色用户列表 Set roleUserIds = convertSet(userRoleMapper.selectList(new LambdaQueryWrapperX() .eqIfPresent(UserRoleDO::getOrganId, organId) @@ -378,6 +372,11 @@ public class PermissionServiceImpl implements PermissionService { // 筛选要删除的userRole:前端没有,数据库有 Collection deleteRoleUserIds = CollUtil.subtract(roleUserIds, userIds); if (!CollectionUtil.isEmpty(deleteRoleUserIds)) { + // 当前用户不能移除自身的角色 + Long incloudSelf = deleteRoleUserIds.stream().filter(userId -> userId.equals(loginUser.getId())).findAny().orElse(null); + if (incloudSelf != null) { + throw new ServiceException(ROLE_ME_ERROR); + } userRoleMapper.deleteListByRoleIdAndUserIds(roleId, deleteRoleUserIds); } From 6e1e0307d44a70af970e78ee655f0d2a530bad5d Mon Sep 17 00:00:00 2001 From: liuzhaotian Date: Sat, 29 Jun 2024 10:15:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=89=93=E5=8C=85-=E4=BB=A5=E6=89=93?= =?UTF-8?q?=E5=8C=85=E6=9D=BF=E6=9D=90=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cf/imes/module/manage/dal/mysql/query/OrderItemMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/com/cf/imes/module/manage/dal/mysql/query/OrderItemMapper.xml b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/com/cf/imes/module/manage/dal/mysql/query/OrderItemMapper.xml index 3ee524e11..778694e9d 100644 --- a/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/com/cf/imes/module/manage/dal/mysql/query/OrderItemMapper.xml +++ b/cf-module-prod-manage/cf-module-prod-manage-biz/src/main/resources/com/cf/imes/module/manage/dal/mysql/query/OrderItemMapper.xml @@ -159,7 +159,7 @@ join order_body ob on oi.body_id = ob.id and oi.organ_id = ob.organ_id left join order_group og on oi.group_id = og.id and ob.organ_id = og.organ_id where - oi.order_id = #{orderNo} and oi.organ_id = #{organId} + oi.order_id = #{orderNo} and oi.organ_id = #{organId} and oi.package_id = 0