package com.gyee.alarm.service.auto.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.alarm.model.auto.ProBasicDeviceMetrics;
import com.gyee.alarm.mapper.auto.ProBasicDeviceMetricsMapper;
import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
import com.gyee.alarm.service.auto.IProBasicDeviceMetricsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gyee.common.model.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 设备指标 服务实现类
 * </p>
 *
 * @author shilin
 * @since 2023-08-01
 */
@Service
public class ProBasicDeviceMetricsServiceImpl extends ServiceImpl<ProBasicDeviceMetricsMapper, ProBasicDeviceMetrics> implements IProBasicDeviceMetricsService {

    @Override
    public List<ProBasicDeviceMetrics> getDeviceMetricsByStructureCode(String deviceId, String structCode) {
        QueryWrapper<ProBasicDeviceMetrics> qw = new QueryWrapper<>();


        if (StringUtils.isNotEmpty(deviceId)) {
            qw.like("device_id", deviceId);
        }
        if (StringUtils.isNotEmpty(structCode)) {
            qw.like("structure_code", structCode);
        }
            List<ProBasicDeviceMetrics> list = baseMapper.selectList(qw);
            return list;
    }
}
