package com.zhiqiyun.open.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhiqiyun.open.core.mapper.equipment.EquipmentPassengerMapper;
import com.zhiqiyun.open.core.mapper.equipment.EquipmentPassengerPeopleMapper;
import com.zhiqiyun.open.core.models.equipment.EquipmentPassenger;
import com.zhiqiyun.open.core.models.equipment.EquipmentPassengerPeople;
import com.zhiqiyun.open.core.service.EquipmentPassengerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.Collection;

@Service
public class EquipmentPassengerServiceImpl extends ServiceImpl<EquipmentPassengerMapper, EquipmentPassenger> implements EquipmentPassengerService {
	@Autowired
	private EquipmentPassengerPeopleMapper equipmentPassengerPeopleMapper;

	@Override
	@Transactional(rollbackFor = Exception.class)
	public boolean removeByIds(Collection<? extends Serializable> idList) {
		QueryWrapper<EquipmentPassengerPeople> wrapper = new QueryWrapper<>();
		wrapper.in("equipment_id", idList);
		this.equipmentPassengerPeopleMapper.delete(wrapper);
		return super.removeByIds(idList);
	}
}
