| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean saveOrUpdateSer(SysDoctorDto sysDoctor, HttpServletRequest request,SysUser user) { |
| | | String id = request.getHeader(SecurityConstants.USER_ID_HEADER); |
| | | if(null==sysDoctor){ |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ResultBody setAdminDoctor(Map<String, Object> params) { |
| | | Long id = MapUtils.getLong(params, "id"); |
| | | Long adminId = MapUtils.getLong(params, "adminId"); |
| | | if (id>0&&adminId>0) { |
| | | Map<String,Object> map= new HashMap<>(); |
| | | map.put("id",adminId); |
| | | SysDoctor sysDoctor=baseMapper.selectById(adminId); |
| | | map.put("user_id",adminId); |
| | | List<SysDoctor> sysDoctors = baseMapper.selectByMap(map); |
| | | if(sysDoctors==null||sysDoctors.size()<=0){ |
| | | return ResultBody.failed("当前操作用户不是管理员"); |
| | | } |
| | | SysDoctor sysDoctor = sysDoctors.get(0); |
| | | //先检查操作用户是否管理员 |
| | | if(sysDoctor!=null){ |
| | | if (sysDoctor.getIsAdminUser()) { |
| | | //现将操作人员设为非管理 |
| | | sysDoctor=new SysDoctor(); |
| | | // sysDoctor=new SysDoctor(); |
| | | sysDoctor.setIsAdminUser(false); |
| | | if(baseMapper.updateById(sysDoctor)>0) |
| | | { |
| | |
| | | sysDoctor=baseMapper.selectById(id); |
| | | if (sysDoctor != null) { |
| | | if (!sysDoctor.getIsAdminUser()) { |
| | | sysDoctor=new SysDoctor(); |
| | | // sysDoctor=new SysDoctor(); |
| | | sysDoctor.setIsAdminUser(true); |
| | | if (baseMapper.updateById(sysDoctor)>0) { |
| | | return ResultBody.ok().data(true).msg("管理员设置成功!"); |