package com.sunzee.mvp.alarmrecord;

import com.sunzee.base.BaseApplication;
import com.sunzee.base.BasePresenter;
import com.sunzee.db.WarringBeanDao;
import com.sunzee.model.domain.WarringBean;

import java.util.Collections;
import java.util.List;

/**
 * 报警记录界面 presenter
 */
public class AlarmRecordPresenter extends BasePresenter<AlarmRecordView> {
    public AlarmRecordPresenter(AlarmRecordView view) {
        attachView(view);
    }

    public void getAlarmData() {
        WarringBeanDao warringBeanDao = BaseApplication.getInstances().getDaoSession().getWarringBeanDao();
        List<WarringBean> warringBeans = warringBeanDao.loadAll();
        Collections.reverse(warringBeans);
        mvpView.showData(warringBeans);
    }
    //todo 好像没有销毁。attachview
}
