package co.yixiang.yshop.module.order.dal.mysql.storeorderelectronics;

import java.util.*;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.module.order.dal.dataobject.storeorderelectronics.StoreOrderElectronicsDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.order.controller.admin.storeorderelectronics.vo.*;

/**
 * 订单电子面单记录 Mapper
 *
 * @author yshop
 */
@Mapper
public interface StoreOrderElectronicsMapper extends BaseMapperX<StoreOrderElectronicsDO> {

    default PageResult<StoreOrderElectronicsDO> selectPage(StoreOrderElectronicsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StoreOrderElectronicsDO>()
                .eqIfPresent(StoreOrderElectronicsDO::getOrderSn, reqVO.getOrderSn())
                .eqIfPresent(StoreOrderElectronicsDO::getPrintTemplate, reqVO.getPrintTemplate())
                .eqIfPresent(StoreOrderElectronicsDO::getLogisticCode, reqVO.getLogisticCode())
                .eqIfPresent(StoreOrderElectronicsDO::getShipperCode, reqVO.getShipperCode())
                .eqIfPresent(StoreOrderElectronicsDO::getOrder, reqVO.getOrder())
                .likeIfPresent(StoreOrderElectronicsDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(StoreOrderElectronicsDO::getCustomerPwd, reqVO.getCustomerPwd())
                .eqIfPresent(StoreOrderElectronicsDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(StoreOrderElectronicsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StoreOrderElectronicsDO::getId));
    }

    default List<StoreOrderElectronicsDO> selectList(StoreOrderElectronicsExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StoreOrderElectronicsDO>()
                .eqIfPresent(StoreOrderElectronicsDO::getOrderSn, reqVO.getOrderSn())
                .eqIfPresent(StoreOrderElectronicsDO::getPrintTemplate, reqVO.getPrintTemplate())
                .eqIfPresent(StoreOrderElectronicsDO::getLogisticCode, reqVO.getLogisticCode())
                .eqIfPresent(StoreOrderElectronicsDO::getShipperCode, reqVO.getShipperCode())
                .eqIfPresent(StoreOrderElectronicsDO::getOrder, reqVO.getOrder())
                .likeIfPresent(StoreOrderElectronicsDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(StoreOrderElectronicsDO::getCustomerPwd, reqVO.getCustomerPwd())
                .eqIfPresent(StoreOrderElectronicsDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(StoreOrderElectronicsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StoreOrderElectronicsDO::getId));
    }

}
