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.bz.PassengerEquipmentMapper;
import com.zhiqiyun.open.core.mapper.bz.PassengerEquipmentPeopleMapper;
import com.zhiqiyun.open.core.models.bz.PassengerEquipment;
import com.zhiqiyun.open.core.models.bz.PassengerEquipmentPeople;
import com.zhiqiyun.open.core.service.PassengerEquipmentPeopleService;
import com.zhiqiyun.open.core.service.PassengerEquipmentService;
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 PassengerEquipmentServiceImpl extends ServiceImpl<PassengerEquipmentMapper, PassengerEquipment> implements PassengerEquipmentService {
	@Autowired
	private PassengerEquipmentPeopleMapper passengerEquipmentPeopleMapper;

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