package co.yixiang.yshop.module.express.dal.mysql.electronicsorder;

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.express.dal.dataobject.electronicsorder.ElectronicsOrderDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.express.controller.admin.electronicsorder.vo.*;

/**
 * 电子面单 Mapper
 *
 * @author yshop
 */
@Mapper
public interface ElectronicsOrderMapper extends BaseMapperX<ElectronicsOrderDO> {

    default PageResult<ElectronicsOrderDO> selectPage(ElectronicsOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ElectronicsOrderDO>()
                .eqIfPresent(ElectronicsOrderDO::getShipperId, reqVO.getShipperId())
                .eqIfPresent(ElectronicsOrderDO::getPaytype, reqVO.getPaytype())
                .likeIfPresent(ElectronicsOrderDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(ElectronicsOrderDO::getCustomerPwd, reqVO.getCustomerPwd())
                .eqIfPresent(ElectronicsOrderDO::getSendSite, reqVO.getSendSite())
                .eqIfPresent(ElectronicsOrderDO::getSendStaff, reqVO.getSendStaff())
                .eqIfPresent(ElectronicsOrderDO::getMonthCode, reqVO.getMonthCode())
                .eqIfPresent(ElectronicsOrderDO::getIsNotice, reqVO.getIsNotice())
                .eqIfPresent(ElectronicsOrderDO::getIsReturnTemp, reqVO.getIsReturnTemp())
                .eqIfPresent(ElectronicsOrderDO::getIsSendMessage, reqVO.getIsSendMessage())
                .eqIfPresent(ElectronicsOrderDO::getTemplateSize, reqVO.getTemplateSize())
                .eqIfPresent(ElectronicsOrderDO::getOperateRequire, reqVO.getOperateRequire())
                .eqIfPresent(ElectronicsOrderDO::getLogisticCode, reqVO.getLogisticCode())
                .betweenIfPresent(ElectronicsOrderDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(ElectronicsOrderDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(ElectronicsOrderDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ElectronicsOrderDO::getExpType, reqVO.getExpType())
                .eqIfPresent(ElectronicsOrderDO::getIsReturnSignBill, reqVO.getIsReturnSignBill())
                .eqIfPresent(ElectronicsOrderDO::getCompany, reqVO.getCompany())
                .likeIfPresent(ElectronicsOrderDO::getProvinceName, reqVO.getProvinceName())
                .likeIfPresent(ElectronicsOrderDO::getCityName, reqVO.getCityName())
                .likeIfPresent(ElectronicsOrderDO::getExpAreaName, reqVO.getExpAreaName())
                .eqIfPresent(ElectronicsOrderDO::getAddress, reqVO.getAddress())
                .likeIfPresent(ElectronicsOrderDO::getName, reqVO.getName())
                .eqIfPresent(ElectronicsOrderDO::getTel, reqVO.getTel())
                .eqIfPresent(ElectronicsOrderDO::getMobile, reqVO.getMobile())
                .eqIfPresent(ElectronicsOrderDO::getPostCode, reqVO.getPostCode())
                .eqIfPresent(ElectronicsOrderDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(ElectronicsOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ElectronicsOrderDO::getId));
    }

    default List<ElectronicsOrderDO> selectList(ElectronicsOrderExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ElectronicsOrderDO>()
                .eqIfPresent(ElectronicsOrderDO::getShipperId, reqVO.getShipperId())
                .eqIfPresent(ElectronicsOrderDO::getPaytype, reqVO.getPaytype())
                .likeIfPresent(ElectronicsOrderDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(ElectronicsOrderDO::getCustomerPwd, reqVO.getCustomerPwd())
                .eqIfPresent(ElectronicsOrderDO::getSendSite, reqVO.getSendSite())
                .eqIfPresent(ElectronicsOrderDO::getSendStaff, reqVO.getSendStaff())
                .eqIfPresent(ElectronicsOrderDO::getMonthCode, reqVO.getMonthCode())
                .eqIfPresent(ElectronicsOrderDO::getIsNotice, reqVO.getIsNotice())
                .eqIfPresent(ElectronicsOrderDO::getIsReturnTemp, reqVO.getIsReturnTemp())
                .eqIfPresent(ElectronicsOrderDO::getIsSendMessage, reqVO.getIsSendMessage())
                .eqIfPresent(ElectronicsOrderDO::getTemplateSize, reqVO.getTemplateSize())
                .eqIfPresent(ElectronicsOrderDO::getOperateRequire, reqVO.getOperateRequire())
                .eqIfPresent(ElectronicsOrderDO::getLogisticCode, reqVO.getLogisticCode())
                .betweenIfPresent(ElectronicsOrderDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(ElectronicsOrderDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(ElectronicsOrderDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ElectronicsOrderDO::getExpType, reqVO.getExpType())
                .eqIfPresent(ElectronicsOrderDO::getIsReturnSignBill, reqVO.getIsReturnSignBill())
                .eqIfPresent(ElectronicsOrderDO::getCompany, reqVO.getCompany())
                .likeIfPresent(ElectronicsOrderDO::getProvinceName, reqVO.getProvinceName())
                .likeIfPresent(ElectronicsOrderDO::getCityName, reqVO.getCityName())
                .likeIfPresent(ElectronicsOrderDO::getExpAreaName, reqVO.getExpAreaName())
                .eqIfPresent(ElectronicsOrderDO::getAddress, reqVO.getAddress())
                .likeIfPresent(ElectronicsOrderDO::getName, reqVO.getName())
                .eqIfPresent(ElectronicsOrderDO::getTel, reqVO.getTel())
                .eqIfPresent(ElectronicsOrderDO::getMobile, reqVO.getMobile())
                .eqIfPresent(ElectronicsOrderDO::getPostCode, reqVO.getPostCode())
                .eqIfPresent(ElectronicsOrderDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(ElectronicsOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ElectronicsOrderDO::getId));
    }

}
