package com.yc.ship.module.ota.dal.mysql.distributorauditlog;

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.ota.controller.admin.distributorauditlog.vo.DistributorAuditLogPageReqVO;
import com.yc.ship.module.ota.dal.dataobject.distributorauditlog.DistributorAuditLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 分销商授信额度变更 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DistributorAuditLogMapper extends BaseMapperX<DistributorAuditLogDO> {

    default PageResult<DistributorAuditLogDO> selectPage(DistributorAuditLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DistributorAuditLogDO>()
                .eqIfPresent(DistributorAuditLogDO::getDistributorId, reqVO.getDistributorId())
                .likeIfPresent(DistributorAuditLogDO::getCreditName, reqVO.getCreditName())
                .eqIfPresent(DistributorAuditLogDO::getBeforeCredit, reqVO.getBeforeCredit())
                .eqIfPresent(DistributorAuditLogDO::getAfterCredit, reqVO.getAfterCredit())
                .eqIfPresent(DistributorAuditLogDO::getCreditAmount, reqVO.getCreditAmount())
                .eqIfPresent(DistributorAuditLogDO::getCreditMode, reqVO.getCreditMode())
                .eqIfPresent(DistributorAuditLogDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DistributorAuditLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DistributorAuditLogDO::getId));
    }

}
