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

/**
 * 维修申请 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface DeviceRepairApplyMapper extends BaseMapperX<DeviceRepairApplyDO> {

    default PageResult<DeviceRepairApplyDO> selectPage(DeviceRepairApplyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceRepairApplyDO>()
                .eqIfPresent(DeviceRepairApplyDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(DeviceRepairApplyDO::getDevicePosition, reqVO.getDevicePosition())
                .likeIfPresent(DeviceRepairApplyDO::getApplyUserName, reqVO.getApplyUserName())
                .betweenIfPresent(DeviceRepairApplyDO::getApplyTime, reqVO.getApplyTime())
                .eqIfPresent(DeviceRepairApplyDO::getTitle, reqVO.getTitle())
                .eqIfPresent(DeviceRepairApplyDO::getFlowStatus, reqVO.getFlowStatus())
                .eqIfPresent(DeviceRepairApplyDO::getFlowInstanceId, reqVO.getFlowInstanceId())
                .eqIfPresent(DeviceRepairApplyDO::getFaultDescription, reqVO.getFaultDescription())
                .eqIfPresent(DeviceRepairApplyDO::getConclusion, reqVO.getConclusion())
                .eqIfPresent(DeviceRepairApplyDO::getRepairFlag, reqVO.getRepairFlag())
                .eqIfPresent(DeviceRepairApplyDO::getRepairAnalysis, reqVO.getRepairAnalysis())
                .eqIfPresent(DeviceRepairApplyDO::getRepairSolution, reqVO.getRepairSolution())
                .eqIfPresent(DeviceRepairApplyDO::getRepairType, reqVO.getRepairType())
                .eqIfPresent(DeviceRepairApplyDO::getCancelFlag, reqVO.getCancelFlag())
                .eqIfPresent(DeviceRepairApplyDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DeviceRepairApplyDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeviceRepairApplyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceRepairApplyDO::getId));
    }

}