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.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 设备-设备信息 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface DeviceInfomationMapper extends BaseMapperX<DeviceInfomationDO> {

    default PageResult<DeviceInfomationDO> selectPage(DeviceInfomationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceInfomationDO>()
                .eqIfPresent(DeviceInfomationDO::getProductId, reqVO.getProductId())
                .inIfPresent(DeviceInfomationDO::getProductId, reqVO.getProductIds())
                .likeIfPresent(DeviceInfomationDO::getProductName, reqVO.getProductName())
                .eqIfPresent(DeviceInfomationDO::getAlias, reqVO.getAlias())
                .eqIfPresent(DeviceInfomationDO::getDeviceStatus, reqVO.getDeviceStatus())
                .eqIfPresent(DeviceInfomationDO::getRepairFlag, reqVO.getRepairFlag())
                .eqIfPresent(DeviceInfomationDO::getDemoteFlag, reqVO.getDemoteFlag())
                .eqIfPresent(DeviceInfomationDO::getScrapFlag, reqVO.getScrapFlag())
                .eqIfPresent(DeviceInfomationDO::getDisableFlag, reqVO.getDisableFlag())
                .eqIfPresent(DeviceInfomationDO::getAcceptanceFlag, reqVO.getAcceptanceFlag())
                .eqIfPresent(DeviceInfomationDO::getLendFlag, reqVO.getLendFlag())
                .eqIfPresent(DeviceInfomationDO::getInUseFlag, reqVO.getInUseFlag())
                .eqIfPresent(DeviceInfomationDO::getGradeCategory, reqVO.getGradeCategory())
                .eqIfPresent(DeviceInfomationDO::getDeviceNumber, reqVO.getDeviceNumber())
                .eqIfPresent(DeviceInfomationDO::getDeviceCode, reqVO.getDeviceCode())
                .eqIfPresent(DeviceInfomationDO::getAssetCode, reqVO.getAssetCode())
                .eqIfPresent(DeviceInfomationDO::getFactoryCode, reqVO.getFactoryCode())
                .eqIfPresent(DeviceInfomationDO::getPosition, reqVO.getPosition())
                .eqIfPresent(DeviceInfomationDO::getPurchasePrice, reqVO.getPurchasePrice())
                .betweenIfPresent(DeviceInfomationDO::getPurchaseDate, reqVO.getPurchaseDate())
                .betweenIfPresent(DeviceInfomationDO::getProductiveDate, reqVO.getProductiveDate())
                .betweenIfPresent(DeviceInfomationDO::getDeployDate, reqVO.getDeployDate())
                .eqIfPresent(DeviceInfomationDO::getDeployEngineer, reqVO.getDeployEngineer())
                .eqIfPresent(DeviceInfomationDO::getDeployLocation, reqVO.getDeployLocation())
                .eqIfPresent(DeviceInfomationDO::getAcceptanceUserId, reqVO.getAcceptanceUserId())
                .likeIfPresent(DeviceInfomationDO::getAcceptanceUserName, reqVO.getAcceptanceUserName())
                .eqIfPresent(DeviceInfomationDO::getManagerUserId, reqVO.getManagerUserId())
                .likeIfPresent(DeviceInfomationDO::getManagerUserName, reqVO.getManagerUserName())
                .eqIfPresent(DeviceInfomationDO::getCustomFormData, reqVO.getCustomFormData())
                .eqIfPresent(DeviceInfomationDO::getPhoto, reqVO.getPhoto())
                .eqIfPresent(DeviceInfomationDO::getDeviceParameter, reqVO.getDeviceParameter())
                .eqIfPresent(DeviceInfomationDO::getStateShow, reqVO.getStateShow())
                .eqIfPresent(DeviceInfomationDO::getStateStack, reqVO.getStateStack())
                .eqIfPresent(DeviceInfomationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DeviceInfomationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeviceInfomationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceInfomationDO::getId));
    }

}