package com.gyee.wisdom.dao.sql.alarm;


import com.gyee.wisdom.common.data.DataUtil;
import com.gyee.wisdom.common.data.alarm.AlertRule;
import com.gyee.wisdom.dao.alarm.AlertRuleDao;
import com.gyee.wisdom.dao.sql.alarm.repository.AlertRuleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class JpaAlertRuleDao implements AlertRuleDao {
    @Autowired
    private AlertRuleRepository alertRuleRepository;
    @Override
    public List<AlertRule> findAll() {
        List<AlertRule> result=DataUtil.convertDataList(alertRuleRepository.findAll());
        return result;
    }

    @Override
    public List<AlertRule>  findByEnabled(boolean enbaled) {
        List<AlertRule> result=DataUtil.convertDataList(alertRuleRepository.findByEnabled(enbaled));
        return result;
    }



}
