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

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.rechargeconfig.RechargeConfigDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.order.controller.admin.rechargeconfig.vo.*;

/**
 * 充值配置 Mapper
 *
 * @author admin
 */
@Mapper
public interface RechargeConfigMapper extends BaseMapperX<RechargeConfigDO> {

    default PageResult<RechargeConfigDO> selectPage(RechargeConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RechargeConfigDO>()
                .eqIfPresent(RechargeConfigDO::getCustomSwitch, reqVO.getCustomSwitch())
                .eqIfPresent(RechargeConfigDO::getCustomMin, reqVO.getCustomMin())
                .eqIfPresent(RechargeConfigDO::getContent, reqVO.getContent())
                .betweenIfPresent(RechargeConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(RechargeConfigDO::getId));
    }

    default List<RechargeConfigDO> selectList(RechargeConfigExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<RechargeConfigDO>()
                .eqIfPresent(RechargeConfigDO::getCustomSwitch, reqVO.getCustomSwitch())
                .eqIfPresent(RechargeConfigDO::getCustomMin, reqVO.getCustomMin())
                .eqIfPresent(RechargeConfigDO::getContent, reqVO.getContent())
                .betweenIfPresent(RechargeConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(RechargeConfigDO::getId));
    }

}
