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

import java.util.*;

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

/**
 * 套餐 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ComboMapper extends BaseMapperX<ComboDO> {

    default PageResult<ComboDO> selectPage(ComboPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ComboDO>()
                .likeIfPresent(ComboDO::getPackageName, reqVO.getPackageName())
                .eqIfPresent(ComboDO::getPrice, reqVO.getPrice())
                .eqIfPresent(ComboDO::getMinutes, reqVO.getMinutes())
                .eqIfPresent(ComboDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ComboDO::getCarteenId, reqVO.getCarteenId())
                .eqIfPresent(ComboDO::getType, reqVO.getType())
                .betweenIfPresent(ComboDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ComboDO::getStatus, reqVO.getStatus())
                .orderByDesc(ComboDO::getId));
    }

}