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

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.dal.dataobject.orderview.OrderViewDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.orderview.vo.*;

/**
 * VIEW Mapper
 *
 * @author admin
 */
@Mapper
public interface OrderViewMapper extends BaseMapperX<OrderViewDO> {

    default PageResult<OrderViewDO> selectPage(OrderViewPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderViewDO>()
                .eqIfPresent(OrderViewDO::getBatchno, reqVO.getBatchno())
                .eqIfPresent(OrderViewDO::getPatid, reqVO.getPatid())
                .likeIfPresent(OrderViewDO::getName, reqVO.getName())
                .eqIfPresent(OrderViewDO::getNationid, reqVO.getNationid())
                .eqIfPresent(OrderViewDO::getOrderno, reqVO.getOrderno())
                .eqIfPresent(OrderViewDO::getSjh, reqVO.getSjh())
                .eqIfPresent(OrderViewDO::getPackageflag, reqVO.getPackageflag())
                .eqIfPresent(OrderViewDO::getPackageno, reqVO.getPackageno())
                .eqIfPresent(OrderViewDO::getItemflag, reqVO.getItemflag())
                .eqIfPresent(OrderViewDO::getItemno, reqVO.getItemno())
                .likeIfPresent(OrderViewDO::getItemname, reqVO.getItemname())
                .eqIfPresent(OrderViewDO::getItemprice, reqVO.getItemprice())
                .eqIfPresent(OrderViewDO::getPaystatus, reqVO.getPaystatus())
                .betweenIfPresent(OrderViewDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(OrderViewDO::getSchoolName, reqVO.getSchoolName())
                .likeIfPresent(OrderViewDO::getClassName, reqVO.getClassName())
                .orderByDesc(OrderViewDO::getId));
    }

    default List<OrderViewDO> selectList(OrderViewExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<OrderViewDO>()
                .eqIfPresent(OrderViewDO::getBatchno, reqVO.getBatchno())
                .eqIfPresent(OrderViewDO::getPatid, reqVO.getPatid())
                .likeIfPresent(OrderViewDO::getName, reqVO.getName())
                .eqIfPresent(OrderViewDO::getNationid, reqVO.getNationid())
                .eqIfPresent(OrderViewDO::getOrderno, reqVO.getOrderno())
                .eqIfPresent(OrderViewDO::getSjh, reqVO.getSjh())
                .eqIfPresent(OrderViewDO::getPackageflag, reqVO.getPackageflag())
                .eqIfPresent(OrderViewDO::getPackageno, reqVO.getPackageno())
                .eqIfPresent(OrderViewDO::getItemflag, reqVO.getItemflag())
                .eqIfPresent(OrderViewDO::getItemno, reqVO.getItemno())
                .likeIfPresent(OrderViewDO::getItemname, reqVO.getItemname())
                .eqIfPresent(OrderViewDO::getItemprice, reqVO.getItemprice())
                .eqIfPresent(OrderViewDO::getPaystatus, reqVO.getPaystatus())
                .betweenIfPresent(OrderViewDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(OrderViewDO::getSchoolName, reqVO.getSchoolName())
                .likeIfPresent(OrderViewDO::getClassName, reqVO.getClassName())
                .orderByDesc(OrderViewDO::getId));
    }

}
