| | |
| | | //更新 |
| | | SysDoctor getOne = baseMapper.selectById(sysDoctor.getId()); |
| | | if (getOne.getDoctorType() != 2 && sysDoctor.getDoctorType() != 2) { |
| | | QueryWrapper queryrole = new QueryWrapper(); |
| | | queryrole.eq("user_id", getOne.getUserId()); |
| | | List<SysRoleUser> list = sysUserRoleMapper.selectList(queryrole); |
| | | //如果是本来是管理员的话,不用走判读管理员的方法 |
| | | if (!list.isEmpty()) { |
| | | List<Long> collect = list.stream().map(e -> e.getRoleId()).collect(Collectors.toList()); |
| | | if (!collect.contains(CommonConstant.HOSPITAL_ADMIN_ID)) { |
| | | /** |
| | | * 管理员只有一个 |
| | | */ |
| | | if (isSupperRole(sysDoctor)) { |
| | | return ResultBody.failed("该部门已经有管理员"); |
| | | } |
| | | } |
| | | } else { |
| | | /** |
| | | * 管理员只有一个 |
| | | */ |
| | | if (isSupperRole(sysDoctor)) { |
| | | return ResultBody.failed("该部门已经有管理员"); |
| | | } |
| | | } |
| | | Map<String, Object> columnMap = new HashMap<>(); |
| | | columnMap.put("user_id", sysDoctor.getUserId()); |
| | |
| | | } |
| | | return ResultBody.ok(); |
| | | } |
| | | |
| | | //是否可以使是超管角色 |
| | | public Boolean isSupperRole(SysDoctorDto sysDoctor){ |
| | | Boolean flag = false; |