From 552f6cbb49ac27b02ae095e05ea78b043aa15620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Mon, 17 Mar 2025 10:01:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=92=E8=89=B2bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/account/service/impl/SysRoleServiceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/SysRoleServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/SysRoleServiceImpl.java index 8904c8d1..be466c70 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/SysRoleServiceImpl.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/SysRoleServiceImpl.java @@ -92,7 +92,9 @@ public class SysRoleServiceImpl extends ServiceImpl imp @Override @Transactional(rollbackFor = Exception.class) public Boolean add(RoleAddDTO roleAddDTO) { - long roleCount = queryChain().eq(SysRole::getName, roleAddDTO.name()).count(); + long roleCount = queryChain().eq(SysRole::getName, roleAddDTO.name()) + .eq(SysRole::getShopId, StpKit.USER.getShopId()) + .count(); if (roleCount > 0) { throw new ApiNotPrintException("此角色名称已存在"); } @@ -120,7 +122,8 @@ public class SysRoleServiceImpl extends ServiceImpl imp throw new ApiNotPrintException("角色不存在"); } - long roleCount = queryChain().eq(SysRole::getName, roleEditDTO.getName()).ne(SysRole::getId, roleEditDTO.getId()).count(); + long roleCount = queryChain().eq(SysRole::getName, roleEditDTO.getName()).ne(SysRole::getId, roleEditDTO.getId()) + .eq(SysRole::getShopId, StpKit.USER.getShopId()).count(); if (roleCount > 0) { throw new ApiNotPrintException("此角色名称已存在"); }