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

import com.aircraft.modules.order.domain.SettlementDetail;
import com.aircraft.modules.order.mapper.SettlementDetailMapper;
import com.aircraft.modules.order.service.ISettlementDetailService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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 SettlementDetailServiceImpl extends ServiceImpl<SettlementDetailMapper, SettlementDetail> implements ISettlementDetailService {

    @Override
    public void batchInsert(List<SettlementDetail> settlementDetailList) {
        this.saveBatch(settlementDetailList);
    }

    @Override
    public List<SettlementDetail> obtainDetailBySettlementOrderId(Long settlementOrderId) {
        return this.list(Wrappers.lambdaQuery(SettlementDetail.class)
                .eq(SettlementDetail::getSettlementMainId, settlementOrderId)
                .orderByDesc(SettlementDetail::getId));
    }

    @Override
    public void updateSettlementOrderStatus(List<Long> ids, Integer updateStatus) {
        this.update(Wrappers.lambdaUpdate(SettlementDetail.class)
                .set(SettlementDetail::getSettlementStatus, updateStatus)
                .in(SettlementDetail::getId, ids));
    }
}
