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

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.alarm.model.auto.ProBasicDeviceModelMetrics;
import com.gyee.alarm.mapper.auto.ProBasicDeviceModelMetricsMapper;
import com.gyee.alarm.model.auto.ProBasicEquipmentPoint;
import com.gyee.alarm.service.auto.IProBasicDeviceModelMetricsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gyee.common.model.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 设备模型指标 服务实现类
 * </p>
 *
 * @author shilin
 * @since 2023-08-01
 */
@Service
public class ProBasicDeviceModelMetricsServiceImpl extends ServiceImpl<ProBasicDeviceModelMetricsMapper, ProBasicDeviceModelMetrics> implements IProBasicDeviceModelMetricsService {

    @Resource
    private ProBasicDeviceModelMetricsMapper proBasicDeviceModelMetricsMapper;
    @Override
    public List<ProBasicDeviceModelMetrics> getDeviceModelMetrics(List<String> collect, String modelId) {
        QueryWrapper<ProBasicDeviceModelMetrics> qw = new QueryWrapper<>();

        if (StringUtils.isNotEmpty(modelId)){
            qw.like("device_model",modelId);
        }
        if (collect != null && !collect.isEmpty()) {
            qw.in("uniform_code", collect);
        }
        List<ProBasicDeviceModelMetrics> list = baseMapper.selectList(qw);
        return list;
    }

    @Override
    public List<ProBasicDeviceModelMetrics> getAll() {
        List<ProBasicDeviceModelMetrics> list = baseMapper.selectList(null);
        return list;
    }
    @Override
   public List<ProBasicDeviceModelMetrics> getDeviceModelMetricsById(String metriccode) {
        List<ProBasicDeviceModelMetrics> list =proBasicDeviceModelMetricsMapper.getDeviceModelMetricsById(metriccode);
        return list;
    }
}
