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

/**
 * 设备-检查项目配置 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface DeviceConfigBusinessItemMapper extends BaseMapperX<DeviceConfigBusinessItemDO> {

    default PageResult<DeviceConfigBusinessItemDO> selectPage(DeviceConfigBusinessItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceConfigBusinessItemDO>()
                .eqIfPresent(DeviceConfigBusinessItemDO::getRuleId, reqVO.getRuleId())
                .eqIfPresent(DeviceConfigBusinessItemDO::getItemKey, reqVO.getItemKey())
                .likeIfPresent(DeviceConfigBusinessItemDO::getItemName, reqVO.getItemName())
                .eqIfPresent(DeviceConfigBusinessItemDO::getFrequencyType, reqVO.getFrequencyType())
                .eqIfPresent(DeviceConfigBusinessItemDO::getFrequency, reqVO.getFrequency())
                .eqIfPresent(DeviceConfigBusinessItemDO::getStandard, reqVO.getStandard())
                .eqIfPresent(DeviceConfigBusinessItemDO::getItemMethod, reqVO.getItemMethod())
                .eqIfPresent(DeviceConfigBusinessItemDO::getFrequencyRemark, reqVO.getFrequencyRemark())
                .eqIfPresent(DeviceConfigBusinessItemDO::getDutyRemark, reqVO.getDutyRemark())
                .eqIfPresent(DeviceConfigBusinessItemDO::getWriteWay, reqVO.getWriteWay())
                .eqIfPresent(DeviceConfigBusinessItemDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(DeviceConfigBusinessItemDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DeviceConfigBusinessItemDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeviceConfigBusinessItemDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceConfigBusinessItemDO::getId));
    }

}