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阅读 218,036评论 6 506
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,046评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 164,411评论 0 354
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,622评论 1 293
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,661评论 6 392
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,521评论 1 304
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,288评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,200评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,644评论 1 314
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,837评论 3 336
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,953评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,673评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,281评论 3 329
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,889评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,011评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,119评论 3 370
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,901评论 2 355

推荐阅读更多精彩内容

  • 1. Java基础部分 基础部分的顺序:基本语法,类相关的语法,内部类的语法,继承相关的语法,异常的语法,线程的语...
    子非鱼_t_阅读 31,631评论 18 399
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 172,129评论 25 707
  • 一、概述 Android数据库在存储数据方面很重要,我们项目当中一般用的SQLiteOpenHelper这个类进行...
    临窗听雨阅读 1,360评论 4 4
  • 清明时节雨纷纷,好像每年的清明节都会下雨,今年也不例外,因为今天就是清明,外面还在沥沥淅淅的下着,离世的亲人我的奶...
    温润石阅读 236评论 0 1
  • 1、获取所有的产品的接口/supplier/findAllProducts参数:无return : List l...
    西北狂刀阅读 209评论 0 0