6 changed files with 201 additions and 3 deletions
@ -0,0 +1,108 @@
@@ -0,0 +1,108 @@
|
||||
{ |
||||
"formatVersion": 1, |
||||
"database": { |
||||
"version": 3, |
||||
"identityHash": "f2ca61f32434b82ab65889a8d915a3c6", |
||||
"entities": [ |
||||
{ |
||||
"tableName": "t_check_record", |
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER, `check_type` TEXT, `name` TEXT, `check_date` INTEGER, `description` TEXT, `create_date` INTEGER, `deleted` INTEGER, PRIMARY KEY(`id`))", |
||||
"fields": [ |
||||
{ |
||||
"fieldPath": "id", |
||||
"columnName": "id", |
||||
"affinity": "INTEGER", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "checkType", |
||||
"columnName": "check_type", |
||||
"affinity": "TEXT", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "name", |
||||
"columnName": "name", |
||||
"affinity": "TEXT", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "checkDate", |
||||
"columnName": "check_date", |
||||
"affinity": "INTEGER", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "description", |
||||
"columnName": "description", |
||||
"affinity": "TEXT", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "createDate", |
||||
"columnName": "create_date", |
||||
"affinity": "INTEGER", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "deleted", |
||||
"columnName": "deleted", |
||||
"affinity": "INTEGER", |
||||
"notNull": false |
||||
} |
||||
], |
||||
"primaryKey": { |
||||
"autoGenerate": false, |
||||
"columnNames": [ |
||||
"id" |
||||
] |
||||
}, |
||||
"indices": [], |
||||
"foreignKeys": [] |
||||
}, |
||||
{ |
||||
"tableName": "t_check_project", |
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER, `name` TEXT, `create_date` INTEGER, `deleted` INTEGER, PRIMARY KEY(`id`))", |
||||
"fields": [ |
||||
{ |
||||
"fieldPath": "id", |
||||
"columnName": "id", |
||||
"affinity": "INTEGER", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "name", |
||||
"columnName": "name", |
||||
"affinity": "TEXT", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "createDate", |
||||
"columnName": "create_date", |
||||
"affinity": "INTEGER", |
||||
"notNull": false |
||||
}, |
||||
{ |
||||
"fieldPath": "deleted", |
||||
"columnName": "deleted", |
||||
"affinity": "INTEGER", |
||||
"notNull": false |
||||
} |
||||
], |
||||
"primaryKey": { |
||||
"autoGenerate": false, |
||||
"columnNames": [ |
||||
"id" |
||||
] |
||||
}, |
||||
"indices": [], |
||||
"foreignKeys": [] |
||||
} |
||||
], |
||||
"views": [], |
||||
"setupQueries": [ |
||||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", |
||||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f2ca61f32434b82ab65889a8d915a3c6')" |
||||
] |
||||
} |
||||
} |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
package cc.niushuai.didicheck.biz.dao; |
||||
|
||||
import androidx.room.Dao; |
||||
import androidx.room.Delete; |
||||
import androidx.room.Insert; |
||||
import androidx.room.Query; |
||||
|
||||
import java.util.List; |
||||
|
||||
import cc.niushuai.didicheck.biz.entity.CheckProject; |
||||
import io.reactivex.Completable; |
||||
import io.reactivex.Flowable; |
||||
|
||||
@Dao |
||||
public interface CheckProjectDao { |
||||
|
||||
@Query("SELECT * FROM t_check_project where deleted = 0 order by create_date desc") |
||||
Flowable<List<CheckProject>> listAll(); |
||||
|
||||
@Query("SELECT count(*) FROM t_check_project where deleted = 0 and name = :name") |
||||
Flowable<Integer> countByName(String name); |
||||
|
||||
@Insert |
||||
Completable insertAll(CheckProject... projects); |
||||
|
||||
@Delete |
||||
void delete(CheckProject project); |
||||
|
||||
} |
@ -0,0 +1,54 @@
@@ -0,0 +1,54 @@
|
||||
package cc.niushuai.didicheck.biz.entity; |
||||
|
||||
import androidx.room.ColumnInfo; |
||||
import androidx.room.Entity; |
||||
import androidx.room.PrimaryKey; |
||||
|
||||
@Entity(tableName = "t_check_project") |
||||
public class CheckProject { |
||||
|
||||
@PrimaryKey |
||||
private Long id; |
||||
|
||||
@ColumnInfo(name = "name") |
||||
private String name; |
||||
|
||||
@ColumnInfo(name = "create_date") |
||||
private Long createDate; |
||||
|
||||
@ColumnInfo(name = "deleted") |
||||
private Integer deleted; |
||||
|
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public Long getCreateDate() { |
||||
return createDate; |
||||
} |
||||
|
||||
public void setCreateDate(Long createDate) { |
||||
this.createDate = createDate; |
||||
} |
||||
|
||||
public Integer getDeleted() { |
||||
return deleted; |
||||
} |
||||
|
||||
public void setDeleted(Integer deleted) { |
||||
this.deleted = deleted; |
||||
} |
||||
} |
Loading…
Reference in new issue