diff --git a/LoveDao.java b/LoveDao.java new file mode 100644 index 0000000..748335e --- /dev/null +++ b/LoveDao.java @@ -0,0 +1,47 @@ +package com.example; + + +import com.example.bean.QuestBean; +import com.example.greendao.QuestBeanDao; + + + +public class LoveDao { + /** + * 添加数据 + * + * @param questBean + */ + public static void insertLove(QuestBean questBean) { + MyApplication.getDaoInstant().getQuestBeanDao().insertOrReplace(questBean); + } + + /** + * 删除数据 + * + * @param id + */ +// public static void deleteLove(long id) { +// MyApplication.getDaoInstant().getQuestBeanDao().deleteByKey(id); +// } + + /** + * 更新数据 + * + * @param shop + */ + public static void updateLove(QuestBean shop) { + MyApplication.getDaoInstant().getQuestBeanDao().update(shop); + } + + /** + * 查询条件为id=id的数据 + * + * @return + */ + public static QuestBean queryLove(String id) { + + return MyApplication.getDaoInstant().getQuestBeanDao().queryBuilder().where(QuestBeanDao.Properties.Id.eq(id)).list().get(0); + } + +}