package cn.iocoder.yudao.module.bpm.dal.mysql.oa.purchase;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.purchase.vo.OaPurchasePageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.purchase.OaPurchaseDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 采购流程信息 Mapper
 *
 * @author dp
 */
@Mapper
public interface OaPurchaseMapper extends BaseMapperX<OaPurchaseDO> {

    default PageResult<OaPurchaseDO> selectPage(OaPurchasePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaPurchaseDO>()
                .likeIfPresent(OaPurchaseDO::getEmployeeName, reqVO.getEmployeeName())
                .eqIfPresent(OaPurchaseDO::getEmployeePhone, reqVO.getEmployeePhone())
                .eqIfPresent(OaPurchaseDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(OaPurchaseDO::getPosition, reqVO.getPosition())
                .likeIfPresent(OaPurchaseDO::getSupplierName, reqVO.getSupplierName())
                .eqIfPresent(OaPurchaseDO::getAuditStatus, reqVO.getAuditStatus())
                .likeIfPresent(OaPurchaseDO::getApplyEmployeeName, reqVO.getApplyEmployeeName())
                .betweenIfPresent(OaPurchaseDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OaPurchaseDO::getId));
    }

}