Greenddao

4740 ワード

public class FrequentlyDao {

    /**
     *  , 
     *
     * @param bean
     */
    public static void insertLove(FrequentlyBean bean) {
        EzvizApplication.getDaoInstant().getFrequentlyBeanDao().insertOrReplace(bean);
    }

    /**
     *  
     *
     * @param id
     */
    public static void deleteLove(long id) {

//        EzvizApplication.getDaoInstant().getFrequentlyBeanDao().deleteByKey(id);
        FrequentlyBean unique = EzvizApplication.getDaoInstant().getFrequentlyBeanDao().queryBuilder().where(FrequentlyBeanDao.Properties.Id.eq(id)).build().unique();

        if (unique != null) {
            EzvizApplication.getDaoInstant().getFrequentlyBeanDao().deleteByKey(unique.getId());

        }
    }

    /**
     *  
     *
     * @param shop
     */
    public static void updateLove(FrequentlyBean shop) {
        EzvizApplication.getDaoInstant().getFrequentlyBeanDao().update(shop);
    }

    /**
     *  Type=TYPE_LOVE 
     *
     * @return
     */
    public static List queryLove(String id) {
        return EzvizApplication.getDaoInstant().getFrequentlyBeanDao().queryBuilder().where(FrequentlyBeanDao.Properties.Userid.eq(id)).list();

    }

    /**
     *  
     */
    public static List queryAll() {
        return EzvizApplication.getDaoInstant().getFrequentlyBeanDao().loadAll();
    }
}