package com.zt.plat.module.qms.business.bus.dal.mapper;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessBaseSamplePageReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessBaseSampleDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 主样业务 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessBaseSampleMapper extends BaseMapperX<BusinessBaseSampleDO> {

    default PageResult<BusinessBaseSampleDO> selectPage(BusinessBaseSamplePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessBaseSampleDO>()
                .likeIfPresent(BusinessBaseSampleDO::getSampleName, reqVO.getSampleName())
                .likeIfPresent(BusinessBaseSampleDO::getBaseSampleName, reqVO.getBaseSampleName())
                .eqIfPresent(BusinessBaseSampleDO::getSampleCode, reqVO.getSampleCode())
                .eqIfPresent(BusinessBaseSampleDO::getConfigBaseSampleId, reqVO.getConfigBaseSampleId())
                .eqIfPresent(BusinessBaseSampleDO::getDictionaryBusinessId, reqVO.getDictionaryBusinessId())
                .betweenIfPresent(BusinessBaseSampleDO::getSampleTime, reqVO.getSampleTime())
                .eqIfPresent(BusinessBaseSampleDO::getPrintCount, reqVO.getPrintCount())
                .betweenIfPresent(BusinessBaseSampleDO::getPrintLastTime, reqVO.getPrintLastTime())
                .eqIfPresent(BusinessBaseSampleDO::getConfigSampleFlowId, reqVO.getConfigSampleFlowId())
                .eqIfPresent(BusinessBaseSampleDO::getSampleFlowNodeKey, reqVO.getSampleFlowNodeKey())
                .betweenIfPresent(BusinessBaseSampleDO::getSampleFlowNodeTime, reqVO.getSampleFlowNodeTime())
                .eqIfPresent(BusinessBaseSampleDO::getSampleStatus, reqVO.getSampleStatus())
                .eqIfPresent(BusinessBaseSampleDO::getOperator, reqVO.getOperator())
                .eqIfPresent(BusinessBaseSampleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessBaseSampleDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessBaseSampleDO::getUpdateCount, reqVO.getUpdateCount())
                .eqIfPresent(BusinessBaseSampleDO::getRemark, reqVO.getRemark())
                .orderByDesc(BusinessBaseSampleDO::getId));
    }

}