package cn.iocoder.yudao.module.member.dal.mysql.storediscount;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.storediscount.StoreDiscountDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.storediscount.vo.*;

/**
 * 门店超市折扣 Mapper
 *
 * @author 我是秦俊旗
 */
@Mapper
public interface StoreDiscountMapper extends BaseMapperX<StoreDiscountDO> {

    default PageResult<StoreDiscountDO> selectPage(StoreDiscountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StoreDiscountDO>()
                .eqIfPresent(StoreDiscountDO::getStoreId, reqVO.getStoreId())
                .likeIfPresent(StoreDiscountDO::getDiscountName, reqVO.getDiscountName())
                .eqIfPresent(StoreDiscountDO::getDiscountNum, reqVO.getDiscountNum())
                .betweenIfPresent(StoreDiscountDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(StoreDiscountDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(StoreDiscountDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(StoreDiscountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StoreDiscountDO::getId));
    }

}