添加角色bug修复
This commit is contained in:
parent
00da05c32d
commit
552f6cbb49
|
|
@ -92,7 +92,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean add(RoleAddDTO roleAddDTO) {
|
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) {
|
if (roleCount > 0) {
|
||||||
throw new ApiNotPrintException("此角色名称已存在");
|
throw new ApiNotPrintException("此角色名称已存在");
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +122,8 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
||||||
throw new ApiNotPrintException("角色不存在");
|
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) {
|
if (roleCount > 0) {
|
||||||
throw new ApiNotPrintException("此角色名称已存在");
|
throw new ApiNotPrintException("此角色名称已存在");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue