From 00e260c734f09aeb2749289c39a386cbe53e2d15 Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Mon, 23 Nov 2020 16:36:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flow/service/impl/StaffRoleServiceImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java index d8b76b8c..b09deed9 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java @@ -33,12 +33,10 @@ import com.lz.modules.sys.entity.SysRoleEntity; import com.lz.modules.sys.service.app.ResultRecordService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; -import org.apache.ibatis.annotations.Param; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.lang.reflect.Array; import java.util.*; import java.util.stream.Collectors; @@ -425,9 +423,11 @@ public class StaffRoleServiceImpl extends ServiceImpl masterPMs = staffRoleMapper.selectStaffRolesByDepartmentLevelList(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()})); - if(CollectionUtils.isNotEmpty(masterPMs)){ - return R.error("主管理员只能设置一个,如果想添加,只能更改管理员。"); + if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) { + List masterPMs = staffRoleMapper.selectStaffRolesByDepartmentLevelList(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()})); + if (CollectionUtils.isNotEmpty(masterPMs)) { + return R.error("主管理员只能设置一个,如果想添加,只能更改管理员。"); + } } staffRoleMapper.insertStaffRole(staffRole); }