fix:飞行员用户判断

This commit is contained in:
sugus 2025-07-15 14:05:00 +08:00
parent bd11c5384a
commit a8175c6883
2 changed files with 6 additions and 4 deletions

View File

@ -9,7 +9,6 @@ import com.aircraft.modules.aircraft.mapper.AircraftDeviceMapper;
import com.aircraft.modules.aircraft.service.AircraftDeviceService; import com.aircraft.modules.aircraft.service.AircraftDeviceService;
import com.aircraft.modules.system.domain.AttachmentMaterial; import com.aircraft.modules.system.domain.AttachmentMaterial;
import com.aircraft.modules.system.service.AttachmentMaterialService; import com.aircraft.modules.system.service.AttachmentMaterialService;
import com.aircraft.utils.PageUtil;
import com.aircraft.utils.SecurityUtils; import com.aircraft.utils.SecurityUtils;
import com.aircraft.utils.enums.UserTypeEnum; import com.aircraft.utils.enums.UserTypeEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -45,6 +44,10 @@ public class AircraftDeviceServiceImpl extends ServiceImpl<AircraftDeviceMapper,
@Override @Override
public IPage<AircraftDevicePageVO> page(AircraftDevicePageDTO dto, Page page) { public IPage<AircraftDevicePageVO> page(AircraftDevicePageDTO dto, Page page) {
//飞行端用户只能看到自己名下
if (UserTypeEnum.EMPLOYEES.equals(SecurityUtils.getCurrentUserType())) {
dto.setEmployeesId(SecurityUtils.getCurrentUserId());
}
return baseMapper.page(dto, page); return baseMapper.page(dto, page);
} }
@ -128,7 +131,6 @@ public class AircraftDeviceServiceImpl extends ServiceImpl<AircraftDeviceMapper,
/** /**
* 检查型号是否重复 * 检查型号是否重复
*
*/ */
private void checkModelRepeat(AircraftDevice aircraftDevice) { private void checkModelRepeat(AircraftDevice aircraftDevice) {
LambdaQueryWrapper<AircraftDevice> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<AircraftDevice> queryWrapper = new LambdaQueryWrapper<>();

View File

@ -34,7 +34,7 @@ public class AircraftMaintenanceServiceImpl extends ServiceImpl<AircraftMaintena
@Override @Override
public void create(AircraftMaintenance aircraftMaintenance) { public void create(AircraftMaintenance aircraftMaintenance) {
if (!UserTypeEnum.EMPLOYEES.equals(SecurityUtils.getCurrentUserType())){ if (!UserTypeEnum.EMPLOYEES.equals(SecurityUtils.getCurrentUserType())){
throw new BadRequestException("非飞行用户!"); throw new BadRequestException("非飞行用户!");
} }
aircraftMaintenance.setEmployeesId(SecurityUtils.getCurrentUserId()); aircraftMaintenance.setEmployeesId(SecurityUtils.getCurrentUserId());
save(aircraftMaintenance); save(aircraftMaintenance);