package com.yc.ship.module.otc.dal.mysql.storecreditlog;

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.otc.controller.admin.storecreditlog.vo.StoreCreditLogPageReqVO;
import com.yc.ship.module.otc.dal.dataobject.storecreditlog.StoreCreditLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 旅行社门店授信额度变更 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface StoreCreditLogMapper extends BaseMapperX<StoreCreditLogDO> {

    default PageResult<StoreCreditLogDO> selectPage(StoreCreditLogPageReqVO reqVO) {
        LambdaQueryWrapperX<StoreCreditLogDO> queryWrapperX = new LambdaQueryWrapperX<>();
        queryWrapperX.eqIfPresent(StoreCreditLogDO::getStoreId, reqVO.getStoreId());
        queryWrapperX.likeIfPresent(StoreCreditLogDO::getCreditName, reqVO.getCreditName());
        queryWrapperX.eqIfPresent(StoreCreditLogDO::getBeforeCredit, reqVO.getBeforeCredit());
        queryWrapperX.eqIfPresent(StoreCreditLogDO::getAfterCredit, reqVO.getAfterCredit());
        queryWrapperX.eqIfPresent(StoreCreditLogDO::getCreditAmount, reqVO.getCreditAmount());
        queryWrapperX.eqIfPresent(StoreCreditLogDO::getCreditMode, reqVO.getCreditMode());
        queryWrapperX.eqIfPresent(StoreCreditLogDO::getRemark, reqVO.getRemark());
        queryWrapperX.betweenIfPresent(StoreCreditLogDO::getCreateTime, reqVO.getCreateTime());
        queryWrapperX.orderByDesc(StoreCreditLogDO::getId);

        return selectPage(reqVO, queryWrapperX);
    }

}
