package com.jojubanking.boot.module.system.dal.mysql.xyrw;

import java.util.*;

import com.jojubanking.boot.framework.common.pojo.PageResult;
import com.jojubanking.boot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.jojubanking.boot.framework.mybatis.core.mapper.BaseMapperX;
import com.jojubanking.boot.module.system.controller.app.xytjinfo.vo.XyrwListReqVO;
import com.jojubanking.boot.module.system.dal.dataobject.xyrw.XyrwDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.xyrw.vo.*;

/**
 * 批次信息 Mapper
 *
 * @author admin
 */
@Mapper
public interface XyrwMapper extends BaseMapperX<XyrwDO> {

    default PageResult<XyrwDO> selectPage(XyrwPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<XyrwDO>()
                .eqIfPresent(XyrwDO::getBatchno, reqVO.getBatchno())
                .likeIfPresent(XyrwDO::getBatchName, reqVO.getBatchName())
                .eqIfPresent(XyrwDO::getBatchStatus, reqVO.getBatchStatus())
                .eqIfPresent(XyrwDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(XyrwDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(XyrwDO::getId));
    }

    default List<XyrwDO> selectList(XyrwExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<XyrwDO>()
                .eqIfPresent(XyrwDO::getBatchno, reqVO.getBatchno())
                .likeIfPresent(XyrwDO::getBatchName, reqVO.getBatchName())
                .eqIfPresent(XyrwDO::getBatchStatus, reqVO.getBatchStatus())
                .eqIfPresent(XyrwDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(XyrwDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(XyrwDO::getId));
    }

    default List<XyrwDO> selectList(XyrwListReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<XyrwDO>()
                .eqIfPresent(XyrwDO::getBatchno, reqVO.getBatchno())
                .likeIfPresent(XyrwDO::getBatchName, reqVO.getBatchName())
                .eqIfPresent(XyrwDO::getBatchStatus, reqVO.getBatchStatus())
                .eqIfPresent(XyrwDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(XyrwDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(XyrwDO::getId));
    }

}
