Merge branch 'version_performance_2.0' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_performance_2.0

This commit is contained in:
wulin 2020-11-23 16:37:18 +08:00
commit ece12b0b16

View File

@ -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<StaffRoleMapper, StaffRole
com.lz.modules.app.utils.BeanUtils.copyProperty(staffRole, roleModel);
staffRole.setStaffName(staffEntity.getName());
List<StaffRole> 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<StaffRole> masterPMs = staffRoleMapper.selectStaffRolesByDepartmentLevelList(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()}));
if (CollectionUtils.isNotEmpty(masterPMs)) {
return R.error("主管理员只能设置一个,如果想添加,只能更改管理员。");
}
}
staffRoleMapper.insertStaffRole(staffRole);
}