package com.aircraft.modules.order.service.impl;

import com.aircraft.modules.order.domain.OrderOperator;
import com.aircraft.modules.order.mapper.OrderOperatorMapper;
import com.aircraft.modules.order.service.IOrderOperatorService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 订单主单操作人关系表 服务实现类
 * </p>
 *
 * @author cli
 * @since 2025-07-10
 */
@Service
public class OrderOperatorServiceImpl extends ServiceImpl<OrderOperatorMapper, OrderOperator> implements IOrderOperatorService {

    @Override
    public List<OrderOperator> queryAllByOrderIds(List<Long> orderIds) {

        LambdaQueryWrapper<OrderOperator> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(OrderOperator::getOrderId, orderIds);
        return list(queryWrapper);
    }

    @Override
    public boolean batchAddOrderOperator(List<OrderOperator> orderOperatorList) {
        return this.saveBatch(orderOperatorList);
    }

    @Override
    public void deleteOrderOperatorByOrderId(Long orderId) {
        // 根据订单ID 删除
        LambdaQueryWrapper<OrderOperator> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(OrderOperator::getOrderId, orderId);
        this.remove(queryWrapper);
    }
}
