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

import java.sql.*;
import java.util.*;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.xytjjg.XytjjgDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.xytjjg.vo.*;

/**
 * HIS项目 Mapper
 *
 * @author admin
 */
@Mapper
public interface XytjjgMapper extends BaseMapperX<XytjjgDO> {

    default PageResult<XytjjgDO> selectPage(XytjjgPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<XytjjgDO>()
                .eqIfPresent(XytjjgDO::getItemno, reqVO.getItemno())
                .likeIfPresent(XytjjgDO::getItemname, reqVO.getItemname())
                .eqIfPresent(XytjjgDO::getItemprice, reqVO.getItemprice())
                .eqIfPresent(XytjjgDO::getItemflag, reqVO.getItemflag())
                .betweenIfPresent(XytjjgDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(XytjjgDO::getId));
    }

    default List<XytjjgDO> selectList(XytjjgExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<XytjjgDO>()
                .eqIfPresent(XytjjgDO::getItemno, reqVO.getItemno())
                .likeIfPresent(XytjjgDO::getItemname, reqVO.getItemname())
                .eqIfPresent(XytjjgDO::getItemprice, reqVO.getItemprice())
                .eqIfPresent(XytjjgDO::getItemflag, reqVO.getItemflag())
                .betweenIfPresent(XytjjgDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(XytjjgDO::getId));
    }

    default List<XytjjgDO> selectFilterList(XytjjgExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapper<XytjjgDO>()
                .like(XytjjgDO::getItemno, reqVO.getItemno())
                .or().like(XytjjgDO::getItemname, reqVO.getItemname())
                .orderByAsc(XytjjgDO::getItemno));
    }



}
