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.*;
import com.zt.plat.module.qms.business.bus.controller.vo.BusinessSampleHandoverPageReqVO;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleHandoverDO;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * 样品交接单业务 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface BusinessSampleHandoverMapper extends BaseMapperX<BusinessSampleHandoverDO> {

    default PageResult<BusinessSampleHandoverDO> selectPage(BusinessSampleHandoverPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BusinessSampleHandoverDO>()
                .eqIfPresent(BusinessSampleHandoverDO::getCode, reqVO.getCode())
                .likeIfPresent(BusinessSampleHandoverDO::getName, reqVO.getName())
                .eqIfPresent(BusinessSampleHandoverDO::getConfigReportTemplateId, reqVO.getConfigReportTemplateId())
                .eqIfPresent(BusinessSampleHandoverDO::getConfigReportTemplateKey, reqVO.getConfigReportTemplateKey())
                .eqIfPresent(BusinessSampleHandoverDO::getConfigSampleFlowId, reqVO.getConfigSampleFlowId())
                .eqIfPresent(BusinessSampleHandoverDO::getSampleFlowNodeKey, reqVO.getSampleFlowNodeKey())
                .eqIfPresent(BusinessSampleHandoverDO::getOperationType, reqVO.getOperationType())
                .betweenIfPresent(BusinessSampleHandoverDO::getOperationTime, reqVO.getOperationTime())
                .eqIfPresent(BusinessSampleHandoverDO::getOperator, reqVO.getOperator())
                .eqIfPresent(BusinessSampleHandoverDO::getOperatorId, reqVO.getOperatorId())
                .eqIfPresent(BusinessSampleHandoverDO::getModelKey, reqVO.getModelKey())
                .eqIfPresent(BusinessSampleHandoverDO::getFlowSerialNumber, reqVO.getFlowSerialNumber())
                .eqIfPresent(BusinessSampleHandoverDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .betweenIfPresent(BusinessSampleHandoverDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(BusinessSampleHandoverDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BusinessSampleHandoverDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BusinessSampleHandoverDO::getId));
    }

}