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

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.partitionson.PartitionSonDO;
import org.apache.ibatis.annotations.Mapper;
import cn.newfeifan.mall.module.distri.controller.admin.partitionson.vo.*;

/**
 * 后代分区 Mapper
 *
 * @author 非繁人
 */
@Mapper
public interface PartitionSonMapper extends BaseMapperX<PartitionSonDO> {

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

}