package com.yc.ship.module.trade.dal.mysql.invoice;

import com.yc.ship.framework.common.pojo.PageResult;
import com.yc.ship.framework.mybatis.core.mapper.BaseMapperX;
import com.yc.ship.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yc.ship.module.trade.controller.admin.invoicelog.vo.InvoiceLogPageReqVO;
import com.yc.ship.module.trade.dal.dataobject.invoice.InvoiceLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 发票记录 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface InvoiceLogMapper extends BaseMapperX<InvoiceLogDO> {

    default PageResult<InvoiceLogDO> selectPage(InvoiceLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InvoiceLogDO>()
                .eqIfPresent(InvoiceLogDO::getInvoiceId, reqVO.getInvoiceId())
                .eqIfPresent(InvoiceLogDO::getUrl, reqVO.getUrl())
                .eqIfPresent(InvoiceLogDO::getType, reqVO.getType())
                .eqIfPresent(InvoiceLogDO::getState, reqVO.getState())
                .eqIfPresent(InvoiceLogDO::getParams, reqVO.getParams())
                .eqIfPresent(InvoiceLogDO::getReqContent, reqVO.getReqContent())
                .eqIfPresent(InvoiceLogDO::getResContent, reqVO.getResContent())
                .betweenIfPresent(InvoiceLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InvoiceLogDO::getId));
    }

}