package com.example.iot_controlhost.utils.database;


import com.example.iot_controlhost.MyApp;
import com.example.iot_controlhost.model.AITHMode;
import com.example.iot_controlhost.model.AITHModeDao;

import java.util.List;

public class AITHModeDBManager {
    private static AITHModeDao aithModeDao = MyApp.getDaoSession().getAITHModeDao();

    /**
     * 增加
     */
    public static void insert(AITHMode AITHMode) {
        aithModeDao.insert(AITHMode);
    }

    /**
     * 增加一整个模板
     * 要先情况之前的模板，然后再添加新的
     */
    public static void insert(List<AITHMode> aithModes) {
        aithModeDao.deleteAll();
        aithModeDao.insertInTx(aithModes);
    }

    /**
     * 删除
     */
    public static void remove(Long id) {
        aithModeDao.deleteByKey(id);
    }

    public static void removeAll() {
        aithModeDao.deleteAll();
    }

    /**
     * 根据天数和蚕种名获取AITHMode
     */
    public static List<AITHMode> getAllSilkworms() {
        return aithModeDao.queryBuilder().list();
    }

    /**
     * 改
     */
    public static void update(AITHMode AITHMode) {
        aithModeDao.update(AITHMode);
    }

    /**
     * 删除指定蚕种名的所有数据
     */
    public static void removeBySilkworm(String silkwormName) {

    }
}
