Commit e631dc9b by gdj

机队修改增加机队用户和设备修改。

parent bd2bf01f
...@@ -169,6 +169,46 @@ public class FleetServiceImpl extends ServiceImpl<IFleetMapper, FleetEntity> imp ...@@ -169,6 +169,46 @@ public class FleetServiceImpl extends ServiceImpl<IFleetMapper, FleetEntity> imp
int update = mapper.updateById(editFleet); int update = mapper.updateById(editFleet);
// todo 机场用户 和 机场设备 // todo 机场用户 和 机场设备
List<FleetDeviceDTO> deviceList = fleetDTO.getDeviceList();
List<FleetUserDTO> userList = fleetDTO.getUserList();
// 直接删除旧的 然后增加新的
// 删除 userList
LambdaQueryWrapper<FleetUserEntity> delUserWrapper = new LambdaQueryWrapper<>();
delUserWrapper.eq(FleetUserEntity::getFleetId, editFleet.getId().toString());
fleetUserService.remove(delUserWrapper);
// 新增 userList
List<FleetUserEntity> addUserList = new ArrayList<>();
if (!CollectionUtils.isEmpty(userList)) {
for (FleetUserDTO fleetUserDTO : userList) {
if (StringUtils.hasText(fleetUserDTO.getUserId())) {
FleetUserEntity newUser = new FleetUserEntity();
newUser.setUserId(fleetUserDTO.getUserId());
newUser.setFleetId(editFleet.getId().toString());
addUserList.add(newUser);
}
}
}
fleetUserService.addFleetUser(addUserList);
// 删除 deviceList
LambdaQueryWrapper<FleetDeviceEntity> delDeviceWrapper = new LambdaQueryWrapper<>();
delDeviceWrapper.eq(FleetDeviceEntity::getFleetId, editFleet.getId().toString());
fleetDeviceService.remove(delDeviceWrapper);
// 新增 deviceList
List<FleetDeviceEntity> addDeviceList = new ArrayList<>();
if (!CollectionUtils.isEmpty(deviceList)) {
for (FleetDeviceDTO fleetDeviceDTO : deviceList) {
if (StringUtils.hasText(fleetDeviceDTO.getDeviceId())) {
FleetDeviceEntity newDevice = new FleetDeviceEntity();
newDevice.setDeviceId(fleetDeviceDTO.getDeviceId());
newDevice.setFleetId(editFleet.getId().toString());
addDeviceList.add(newDevice);
}
}
}
fleetDeviceService.addFleetDevice(addDeviceList);
return update > 0; return update > 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment