package com.zt.plat.module.qms.resource.device.dal.mapper;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceCalibrationPlanDO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceCalibrationPlanPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 设备-检定校准计划 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface DeviceCalibrationPlanMapper extends BaseMapperX<DeviceCalibrationPlanDO> {

    default PageResult<DeviceCalibrationPlanDO> selectPage(DeviceCalibrationPlanPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceCalibrationPlanDO>()
                .eqIfPresent(DeviceCalibrationPlanDO::getProductId, reqVO.getProductId())
                .eqIfPresent(DeviceCalibrationPlanDO::getCheckYear, reqVO.getCheckYear())
                .likeIfPresent(DeviceCalibrationPlanDO::getApplyUserName, reqVO.getApplyUserName())
                .eqIfPresent(DeviceCalibrationPlanDO::getFlowInstanceId, reqVO.getFlowInstanceId())
                .eqIfPresent(DeviceCalibrationPlanDO::getFlowStatus, reqVO.getFlowStatus())
                .eqIfPresent(DeviceCalibrationPlanDO::getTitle, reqVO.getTitle())
                .eqIfPresent(DeviceCalibrationPlanDO::getBasicSubmitFlag, reqVO.getBasicSubmitFlag())
                .eqIfPresent(DeviceCalibrationPlanDO::getRollbackRemark, reqVO.getRollbackRemark())
                .eqIfPresent(DeviceCalibrationPlanDO::getDataType, reqVO.getDataType())
                .eqIfPresent(DeviceCalibrationPlanDO::getCancelFlag, reqVO.getCancelFlag())
                .eqIfPresent(DeviceCalibrationPlanDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DeviceCalibrationPlanDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeviceCalibrationPlanDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceCalibrationPlanDO::getCreateTime));
    }

}