| package com.doumee.lib_coremodel.base.room; | 
|   | 
| import androidx.room.Dao; | 
| import androidx.room.Delete; | 
| import androidx.room.Insert; | 
| import androidx.room.OnConflictStrategy; | 
| import androidx.room.Update; | 
|   | 
| import java.util.List; | 
|   | 
| @Dao | 
| public interface BaseDao<T> { | 
|     /** | 
|      * 添加单个对象,返回插入行号 | 
|      */ | 
|     @Insert(onConflict = OnConflictStrategy.REPLACE) | 
|     abstract Long insert(T t); | 
|   | 
|     /** | 
|      * 添加数组对象数据 | 
|      */ | 
|     @Insert(onConflict = OnConflictStrategy.REPLACE) | 
|     abstract Long[] insert(T[] ts); | 
|   | 
|     /** | 
|      * 添加对象集合 | 
|      */ | 
|     @Insert(onConflict = OnConflictStrategy.REPLACE) | 
|     abstract List<Long> insert(List<T> ts); | 
|   | 
|     /** | 
|      * 根据对象中的主键删除(主键是自动增长的,无需手动赋值) | 
|      */ | 
|     @Delete | 
|     abstract void delete(T t); | 
|   | 
|     /** | 
|      * 根据对象中的主键更新(主键是自动增长的,无需手动赋值) | 
|      */ | 
|     @Update | 
|     abstract int update(T t); | 
| } |