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

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.spacecapsule.vo.SpaceCapsulePageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.spacecapsule.SpaceCapsuleDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 太空舱 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface SpaceCapsuleMapper extends BaseMapperX<SpaceCapsuleDO> {

    default PageResult<SpaceCapsuleDO> selectPage(SpaceCapsulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SpaceCapsuleDO>()
                .eqIfPresent(SpaceCapsuleDO::getPayNum, reqVO.getPayNum())
                .eqIfPresent(SpaceCapsuleDO::getMachineNum, reqVO.getMachineNum())
                .eqIfPresent(SpaceCapsuleDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SpaceCapsuleDO::getCarteenId, reqVO.getCarteenId())
                .betweenIfPresent(SpaceCapsuleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(SpaceCapsuleDO::getRemark, reqVO.getRemark())
                .likeIfPresent(SpaceCapsuleDO::getSpaceName, reqVO.getSpaceName())
                .orderByDesc(SpaceCapsuleDO::getId));
    }
}