提交修改

This commit is contained in:
quyixiao 2020-11-23 16:36:27 +08:00
parent a2f191bec4
commit 00e260c734

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);
}