package com.clx.performance.dao.impl;

import com.clx.performance.dao.OrderChildSyncTransportInvoiceRecordDao;
import com.clx.performance.enums.TransportSyncTypeEnum;
import com.clx.performance.mapper.OrderChildSyncTransportInvoiceRecordMapper;
import com.clx.performance.model.OrderChildSyncTransportInvoiceRecord;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author kavin
 * Date 2024-01-03
 * Time 10:17
 */
@Repository
public class OrderChildSyncTransportInvoiceRecordDaoImpl extends BaseDaoImpl<OrderChildSyncTransportInvoiceRecordMapper, OrderChildSyncTransportInvoiceRecord, Integer> implements OrderChildSyncTransportInvoiceRecordDao {

    @Override
    public List<OrderChildSyncTransportInvoiceRecord> selectListForJob() {
        return list(lUdWrapper()
                .le(OrderChildSyncTransportInvoiceRecord::getCreateTime, LocalDateTime.now().minusMinutes(10))
        );
    }

    @Override
    public List<OrderChildSyncTransportInvoiceRecord> selectListForJobOfFirst() {
        return list(lUdWrapper()
                .eq(OrderChildSyncTransportInvoiceRecord::getType, TransportSyncTypeEnum.Type.RESULT.getCode())
                .le(OrderChildSyncTransportInvoiceRecord::getCreateTime, LocalDateTime.now().minusMinutes(3))
        );
    }
}
