美文网首页
SQLite数据库 简单使用

SQLite数据库 简单使用

作者: 卐梦卍 | 来源:发表于2020-08-24 10:52 被阅读0次

1.添加依赖

implementation'org.litepal.guolindev:core:3.1.1'

2.配置

3.数据库简单操作

1.增加

val dispatchScreenBean = DispatchScreenBeans()

dispatchScreenBean.order_id = v.order_id

dispatchScreenBean.plate_num = v.plate_num

dispatchScreenBean.status = v.status

dispatchScreenBean.save()//增加保存

dispatchScreenBean.update(id)//替换当前第ID条所有数据

2.删除

LitePal.deleteAll(DispatchScreenBeans::class.java, "status > ?", "4")//删除表内所有status >4的数据

LitePal.delete(DispatchScreenBeans::class.java,id)//删除当前第ID条所有数据

3.查询

LitePal.where("status = ?", 1).order("status").find(BusinessScreenBean::class.java)//查询表内所有status==1的数据

LitePal.where("status=?", 1).find<DispatchScreenBeans>()//查询表内所有status==1的数据

相关文章

网友评论

      本文标题:SQLite数据库 简单使用

      本文链接:https://www.haomeiwen.com/subject/hekcsqtx.html