package cn.newfeifan.mall.module.distri.dal.mysql.partitionbrothers;

import java.util.*;

import cn.newfeifan.mall.framework.common.pojo.PageResult;
import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
import cn.newfeifan.mall.module.distri.dal.dataobject.partitionbrothers.PartitionBrothersDO;
import org.apache.ibatis.annotations.Mapper;
import cn.newfeifan.mall.module.distri.controller.admin.partitionbrothers.vo.*;

/**
 * 兄弟分区 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface PartitionBrothersMapper extends BaseMapperX<PartitionBrothersDO> {

    default PageResult<PartitionBrothersDO> selectPage(PartitionBrothersPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PartitionBrothersDO>()
                .eqIfPresent(PartitionBrothersDO::getUserId, reqVO.getUserId())
                .eqIfPresent(PartitionBrothersDO::getPartNo, reqVO.getPartNo())
                .eqIfPresent(PartitionBrothersDO::getPrice, reqVO.getPrice())
                .eqIfPresent(PartitionBrothersDO::getHasHit, reqVO.getHasHit())
                .eqIfPresent(PartitionBrothersDO::getAfterHitQuota, reqVO.getAfterHitQuota())
                .eqIfPresent(PartitionBrothersDO::getSize, reqVO.getSize())
                .betweenIfPresent(PartitionBrothersDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PartitionBrothersDO::getId));
    }

}