package com.yc.ship.module.trade.service.order.impl;

import com.yc.ship.framework.common.pojo.CommonResult;
import com.yc.ship.framework.common.util.object.BeanUtils;
import com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO;
import com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO;
import com.yc.ship.module.trade.dal.mysql.order.TradeOrderMapper;
import com.yc.ship.module.trade.service.order.TradeOrderQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * &#064;Description ：订单查询service实现
 * &#064;Date ：2025/6/4 16:18
 * @author qsl
 */
@Service
@Slf4j
public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {

    @Resource
    private TradeOrderMapper tradeOrderMapper;

    @Override
    public CommonResult<?> orderByIdCard(String idCard) {
        List<TradeOrderDO> orderList = tradeOrderMapper.getOrderByCardNo(idCard);
        return CommonResult.success(orderList);
    }

    @Override
    public CommonResult<List<TradeOrderRespVO>> orderListByOta(Long tenantId, String travelDate, String credentialNo, String mobile) {
        List<TradeOrderDO> orderList = tradeOrderMapper.orderListByOta(tenantId, travelDate, credentialNo, mobile);
        return CommonResult.success(BeanUtils.toBean(orderList, TradeOrderRespVO.class));
    }

    @Override
    public CommonResult<List<TradeOrderRespVO>> orderList(Long tenantId,List<Integer> orderStatus, String travelDate, String credentialNo, String mobile) {
        List<TradeOrderDO> orderList = tradeOrderMapper.orderList(tenantId,orderStatus, travelDate, credentialNo, mobile,credentialNo);
        return CommonResult.success(BeanUtils.toBean(orderList, TradeOrderRespVO.class));
    }

}
