Android 架構師之路18 面向對象數據庫架構設計

Android 架構師之路 目錄

前言

原來在項目中經常使用SqliteopenHelper這個類來實現數據庫的增刪改查,但是使用它非常的繁瑣,需要寫很多啰嗦的代碼。所以面向對象數據庫框架的設計是解決上述問題的辦法。

1.OOP數據庫設計UML類圖

角色:
  • BaseDaoFactory: 用來創建數據庫和初始化數據庫
  • IBaseDao: 增刪改查方法接口
  • BaseDao: 實現增刪改查方法的抽象模板類(子類方法UserDao增刪改查方法在該類實現)
  • Bean: 使用注解方式來定義表中相關字段名和類型,如UserBean
  • ConcreteDao: 創建表,定相關義字段及其長度,(UserDao)和UserBean中的字段對應
  • Client: 調用類,如Activity

2.各角色實現

BaseDaoFactory:
public class BaseDaoFactory {

    private static BaseDaoFactory instance = new BaseDaoFactory();

    private String sqliteDatabasePath;

    private SQLiteDatabase sqLiteDatabase;

    public BaseDaoFactory() {
        sqliteDatabasePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/teacher.db";
        openDatabase();
    }

    public static BaseDaoFactory getInstance() {
        return instance;
    }

    public synchronized <T extends BaseDao<M>, M> T getDataHelper(Class<T> clazz, Class<M> entityClass) {
        BaseDao baseDao = null;
        try {
            baseDao = clazz.newInstance();
            baseDao.init(entityClass, sqLiteDatabase);
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return (T) baseDao;
    }
    /**
     *  targetSdkVersion  大于22時 要申請存儲讀寫權限
     */
    //打開數據庫操作
    private void openDatabase() {

        this.sqLiteDatabase = SQLiteDatabase.openOrCreateDatabase(sqliteDatabasePath, null);
    }
}
IBaseDao:
public interface IBaseDao<T>{
    /**
     * @param entity
     * @return
     */
    Long insert(T entity);

    /**
     * 更新數據
     * @param entity
     * @param where
     * @return
     */
    int update(T entity,T where);

    /**
     * 刪除數據
     * @param where
     * @return
     */
    int delete(T where);

    List<T> query(T where);

    List<T> query(T where,String orderBy,Integer startIndex,Integer limit);
}

BaseDao:
/**
 * Created by Xionghu on 2018/2/2.
 * Desc: 真正和底層打交道
 *
 * @param <T>
 */

public abstract class BaseDao<T> implements IBaseDao<T> {

    /**
     * 持有數據庫操作類的引用
     */
    private SQLiteDatabase database;

    /**
     * 保證實例化一次
     */
    private boolean isInit = false;

    /**
     * 持有操作數據表所對應的Java類型
     * User
     */
    private Class<T> entityClass;

    /**
     * 維護這表名與成員變量名的映射關系
     * key ---->表名
     * value ---->Field
     */
    private HashMap<String, Field> cacheMap;

    private String tableName;

    /**
     * @param entity
     * @param sqLiteDatabase
     * @return 實例化一次
     */
    protected synchronized boolean init(Class<T> entity, SQLiteDatabase sqLiteDatabase) {
        if (!isInit) {
            entityClass = entity;
            Log.d("sqlite", entityClass.getSimpleName());
            database = sqLiteDatabase;
            if (entity.getAnnotation(DbTable.class) == null) {
                tableName = entity.getClass().getSimpleName();
            } else {
                tableName = entity.getAnnotation(DbTable.class).value();
            }
            if (!database.isOpen()) {
                return false;
            }
            if (!TextUtils.isEmpty(createTable())) {
                database.execSQL(createTable());

            }
            cacheMap = new HashMap<>();
            initCacheMap();
            isInit = true;
        }
        return isInit;
    }

    /**
     * 維護映射關系
     */
    private void initCacheMap() {
        String sql = "select * from " + this.tableName + " limit 1 , 0 ";
        Cursor cursor = null;
        try {

            cursor = database.rawQuery(sql, null);
            /**
             * 表的列名數組
             */
            String[] columnNames = cursor.getColumnNames();
            /**
             * 拿到Field數組
             */
            Field[] colmunFields = entityClass.getFields();
            for (Field field : colmunFields) {
                field.setAccessible(true);
            }
            /**
             * 開始找對應關系
             */
            for (String colmunName : columnNames) {
                /**
                 * 如果找到對應的Filed就賦值給他
                 * User
                 */
                Field colmunFiled = null;
                for (Field field : colmunFields) {
                    String fileName = null;
                    if (field.getAnnotation(DbFiled.class) != null) {
                        fileName = field.getAnnotation(DbFiled.class).value();
                    } else {
                        fileName = field.getName();
                    }
                    /**
                     * 如果表的名字 等于 成員變量的注解名字
                     */
                    if (colmunName.equals(fileName)) {
                        colmunFiled = field;
                        break;
                    }
                }
                //找到了對應關系
                if (colmunFiled != null) {
                    cacheMap.put(colmunName, colmunFiled);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            cursor.close();
        }
    }

    @Override
    public Long insert(T entity) {
        Map<String, String> map = getValues(entity);
        ContentValues values = getContentValues(map);
        Long result = database.insert(tableName, null, values);
        return result;
    }

    /**
     * @param entity
     * @param where
     * @return
     */
    @Override
    public int update(T entity, T where) {
        int result = -1;
        Map values = getValues(entity);

        /**
         *講條件對象轉換map
         */
        Map whereClause = getValues(where);
        Condition condition = new Condition(whereClause);
        ContentValues contentValues = getContentValues(values);
        result = database.update(tableName, contentValues, condition.getWhereClause(), condition.getWhereArgs());

        return result;
    }

    @Override
    public int delete(T where) {
        Map map = getValues(where);
        Condition condition = new Condition(map);

        /**
         * id=1 數據
         * id=? new String[]{ String.value(1)}
         */
        int result = database.delete(tableName, condition.getWhereClause(), condition.getWhereArgs());
        return result;
    }

    //查詢所有數據
    @Override
    public List<T> query(T where) {
        return query(where, null, null, null);
    }

    @Override
    public List<T> query(T where, String orderBy, Integer startIndex, Integer limit) {
        Map map = getValues(where);
        String limitString = null;
        if (startIndex != null && limit != null) {
            limitString = startIndex + " , " + limit;
        }
        Condition condition = new Condition(map);
        Cursor cursor = database.query(tableName, null, condition.getWhereClause(), condition.getWhereArgs(),
                null, null, orderBy, limitString);
        List<T> result = getResult(cursor, where);
        cursor.close();
        return result;
    }


    private List<T> getResult(Cursor cursor, T where) {
        ArrayList list = new ArrayList();
        Object item;
        while (cursor.moveToNext()) {
            try {
                item = where.getClass().newInstance();
                /**
                 * 列名 name
                 * 成員變量名 Filed
                 */
                Iterator iterator = cacheMap.entrySet().iterator();
                while (iterator.hasNext()) {
                    Map.Entry entry = (Map.Entry) iterator.next();
                    /**
                     * 得到列名
                     */
                    String colomunName = (String) entry.getKey();
                    /**
                     * 然后以列名 拿到列名在游標的位置
                     */
                    Integer colmunIndex = cursor.getColumnIndex(colomunName);

                    Field field = (Field) entry.getValue();
                    Class type = field.getType();
                    if (colmunIndex != -1) {
                        if (type == String.class) {
                            //反射方式賦值
                            field.set(item, cursor.getString(colmunIndex));
                        } else if (type == Double.class) {
                            field.set(item, cursor.getDouble(colmunIndex));
                        } else if (type == Integer.class) {
                            field.set(item, cursor.getInt(colmunIndex));
                        } else if (type == Long.class) {
                            field.set(item, cursor.getLong(colmunIndex));
                        } else if (type == Float.class) {
                            field.set(item, cursor.getFloat(colmunIndex));
                        } else if (type == byte[].class) {
                            field.set(item, cursor.getBlob(colmunIndex));
                        } else {
                            continue;
                        }

                    }


                }
                list.add(item);
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return list;
    }

    /**
     * 轉換成ContentValues
     *
     * @param map
     * @return
     */
    private ContentValues getContentValues(Map<String, String> map) {
        ContentValues contentValues = new ContentValues();
        Set keys = map.keySet();
        Iterator<String> iterator = keys.iterator();
        while (iterator.hasNext()) {
            String key = iterator.next();
            String value = map.get(key);
            if (value != null) {
                contentValues.put(key, value);
            }
        }
        return contentValues;
    }


    private Map<String, String> getValues(T entity) {
        HashMap<String, String> result = new HashMap<>();
        Iterator<Field> fieldsIterator = cacheMap.values().iterator();
        /**
         * 循環遍歷 映射map的 Field
         */
        while (fieldsIterator.hasNext()) {
            Field columnToField = fieldsIterator.next();
            String cacheKey = null;
            String cacheValue = null;
            if (columnToField.getAnnotation(DbFiled.class) != null) {
                cacheKey = columnToField.getAnnotation(DbFiled.class).value();
            } else {
                cacheKey = columnToField.getName();
            }
            try {
                if (null == columnToField.get(entity)) {
                    continue;
                }
                cacheValue = columnToField.get(entity).toString();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
            result.put(cacheKey, cacheValue);
        }
        return result;
    }


    /**
     * 創建表
     *
     * @return
     */
    protected abstract String createTable();

    /**
     * 封裝修改語句
     */
    class Condition {


        /**
         * 查詢條件
         * name= ?&& password = ?
         */
        private String whereClause;

        private String[] whereArgs;


        public Condition(Map<String, String> whereClause) {
            ArrayList list = new ArrayList();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.append(" 1=1 ");

            Set keys = whereClause.keySet();
            Iterator iterator = keys.iterator();
            while (iterator.hasNext()) {
                String key = (String) iterator.next();
                String value = whereClause.get(key);

                if (value != null) {
                    /**
                     * 拼接條件查詢語句
                     * 1=1 and name =? and password = ?
                     */
                    stringBuilder.append(" and " + key + " =?");
                    list.add(value);
                }
            }
            this.whereClause = stringBuilder.toString();
            this.whereArgs = (String[]) list.toArray(new String[list.size()]);
        }

        public String getWhereClause() {
            return whereClause;
        }

        public void setWhereClause(String whereClause) {
            this.whereClause = whereClause;
        }

        public String[] getWhereArgs() {
            return whereArgs;
        }

        public void setWhereArgs(String[] whereArgs) {
            this.whereArgs = whereArgs;
        }
    }
}

Bean:
@DbTable("tb_user")
public class User {

    /**
     * 數據字段支持注解和非注解
     * 非注解:
     *     public Integer userId;
     * 數據保存的字段名為 userId
     * 注解:
     *     @DbFiled("teacher_id")
     *     public Integer userId;
     *  數據保存的字段名為 teacher_id
     *
     *  要用Integer型 不要用int型,負責查詢不到
     */
    public Integer userId;

    @DbFiled("name")
    public String name;
    @DbFiled("password")
    public String password;

    public User(Integer userId, String name, String password) {
        this.userId = userId;
        this.name = name;
        this.password = password;
    }

    public User() {
    }


    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
@Target(ElementType.FIELD) //字段、枚舉的常量
@Retention(RetentionPolicy.RUNTIME) //注解會在class字節碼文件中存在,在運行時可以痛過反射獲取到
public @interface DbFiled {
    String value();
}
@Target(ElementType.TYPE) //運用在接口、類枚舉、注解
@Retention(RetentionPolicy.RUNTIME) //注解會在class字節碼文件中存在,在運行時可以痛過反射獲取到
public @interface DbTable {
    String value();
}
ConcreteDao:
public class UserDao extends BaseDao {

    @Override
    protected String createTable() {
        return "create table if not exists tb_user(userId int,name varchar(20),password varchar(20))";
    }
}
public class FileDao extends BaseDao {
    @Override
    protected String createTable() {
        return "create table if not exists tb_file(time varchar(20),path varchar(20),description varchar(20))";
    }
}
Client:
public class MainActivity extends AppCompatActivity {
    private static final String TAG = "Main";
    IBaseDao<User> baseDao;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        baseDao = BaseDaoFactory.getInstance().getDataHelper(UserDao.class, User.class);

    }


}

3.增刪改查測試

Step1:增
    public void save(View view) {

        for (int i = 0; i < 20; i++) {
            User user = new User(i, "teacher", "123456");
            baseDao.insert(user);
        }

/**
 *寫入文件數據
 */
//        BaseDao<FileBean> fileBeanBaseDao = BaseDaoFactory.getInstance().getDataHelper(FileDao.class, FileBean.class);
//        fileBeanBaseDao.insert(new FileBean("2019-12-13", Environment.getExternalStorageDirectory() + "/kpioneer", "asdfg"));

    }

執行queryAll 打印數據

02-06 17:51:06.151 4858-4858/com.haocai.haocaisqlite I/Main: 查詢到 20 條數據
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=0, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=1, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=2, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=3, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=4, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=5, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=6, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=7, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=8, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=9, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=10, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=11, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=12, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=13, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=14, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=15, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=16, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=17, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=18, name='teacher', password='123456'}
02-06 17:51:06.152 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=19, name='teacher', password='123456'}
Step2:改
    public void update(View view) {
        for (int i = 10; i < 20; i++) {
            User where = new User();
            where.setUserId(i);
            User user = new User(i, "kpioneer", "8888");

            //更新原name = teacher的數據
            baseDao.update(user, where);
        }

    }

執行queryAll 打印數據

02-06 17:54:18.650 4858-4858/com.haocai.haocaisqlite I/Main: 查詢到 20 條數據
02-06 17:54:18.650 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=0, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=1, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=2, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=3, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=4, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=5, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=6, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=7, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=8, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=9, name='teacher', password='123456'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=10, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=11, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=12, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=13, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=14, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=15, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=16, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=17, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=18, name='kpioneer', password='8888'}
02-06 17:54:18.651 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=19, name='kpioneer', password='8888'}
Step3:查
    public void query(View view) {
        User where = new User();
        where.setName("teacher");
        List<User> list = baseDao.query(where);

        Log.i(TAG, "查詢到 " + list.size() + " 條數據");
        for (User user : list) {
            Log.i(TAG, user.toString());
        }

        System.out.println("--------查詢某條數據-------");
        User where2 = new User();
        where2.setName("teacher");
        where2.setUserId(5);
        List<User> list2 = baseDao.query(where2);
        Log.i(TAG, "查詢到 " + list2.size() + " 條數據");
    }

打印數據

02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: 查詢到 10 條數據
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=0, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=1, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=2, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=3, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=4, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=5, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=6, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=7, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=8, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=9, name='teacher', password='123456'}
02-06 17:58:49.530 4858-4858/com.haocai.haocaisqlite I/System.out: --------查詢某條數據-------
02-06 17:58:49.533 4858-4858/com.haocai.haocaisqlite I/Main: 查詢到 1 條數據
Step4:刪
    public void delete(View view) {
        User user = new User();
        user.setName("teacher");
        baseDao.delete(user);
    }

執行queryAll 打印數據

02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: 查詢到 10 條數據
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=10, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=11, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=12, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=13, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=14, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=15, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=16, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=17, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=18, name='kpioneer', password='8888'}
02-06 18:00:29.196 4858-4858/com.haocai.haocaisqlite I/Main: User{userId=19, name='kpioneer', password='8888'}
至此,面向對象數據庫架構設計完成。
源碼下載
Github:https://github.com/kpioneer123/OOPSqliteDemo
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 229,698評論 6 539
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 99,202評論 3 426
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 177,742評論 0 382
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,580評論 1 316
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 72,297評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,688評論 1 327
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,693評論 3 444
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,875評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,438評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 41,183評論 3 356
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,384評論 1 372
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,931評論 5 363
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,612評論 3 348
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 35,022評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,297評論 1 292
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 52,093評論 3 397
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,330評論 2 377

推薦閱讀更多精彩內容

  • 1. Java基礎部分 基礎部分的順序:基本語法,類相關的語法,內部類的語法,繼承相關的語法,異常的語法,線程的語...
    子非魚_t_閱讀 31,731評論 18 399
  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 172,701評論 25 708
  • 一、概述 Android數據庫在存儲數據方面很重要,我們項目當中一般用的SQLiteOpenHelper這個類進行...
    臨窗聽雨閱讀 1,374評論 4 4
  • 清明時節雨紛紛,好像每年的清明節都會下雨,今年也不例外,因為今天就是清明,外面還在瀝瀝淅淅的下著,離世的親人我的奶...
    溫潤石閱讀 243評論 0 1
  • 1、獲取所有的產品的接口/supplier/findAllProducts參數:無return : List l...
    西北狂刀閱讀 210評論 0 0