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.DevicePeriodCheckPlanDO;
import com.zt.plat.module.qms.resource.device.controller.vo.DevicePeriodCheckPlanPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 设备-期间核查计划 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface DevicePeriodCheckPlanMapper extends BaseMapperX<DevicePeriodCheckPlanDO> {

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

}