package org.ta.pddserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.ta.pdd.entity.LogsMailScanEntity;
import org.ta.pdd.entity.OutboundRecordEntity;
import org.ta.pddserver.model.api.request.LogsMailScanListVORequest;
import org.ta.pddserver.model.api.request.OutboundRecordRequest;

import java.util.List;

@Mapper
public interface OutboundRecordMapper extends BaseMapper<OutboundRecordEntity> {

//    @Select("SELECT * FROM `outbound_record` WHERE (`mailNo` = #{mailNo} OR #{mailNo}='')  AND (`orderCode` = #{orderCode} OR #{orderCode}='')  AND `created` >= #{createdStart} AND `created` < #{createdEnd} ;")
    @Select("SELECT * FROM `outbound_record` WHERE `mailNo` = #{mailNo};")
    OutboundRecordEntity findByMailNo(@Param("mailNo") String mailNo);

    @Select("SELECT uid,mailNo,orderCode,created,creator FROM `outbound_record` WHERE (`mailNo` = #{mailNo} OR #{mailNo}='')  AND (`orderCode` = #{orderCode} OR #{orderCode}='')  AND `created` >= #{createdStart} AND `created` < #{createdEnd}  ORDER BY `uid` DESC;")
    List<OutboundRecordEntity> outboundRecordList(OutboundRecordRequest param);
}

