From 724607fb9d2ef0ccc2fc0a368b1b908ef180cc97 Mon Sep 17 00:00:00 2001 From: xinfengkun Date: Mon, 8 Dec 2025 11:10:50 +0800 Subject: [PATCH] =?UTF-8?q?[8.3.0][=E7=AB=99=E7=82=B9=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E7=A6=81=E7=94=A8]=20=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=AB=99=E7=82=B9=E6=A0=87=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../8.json | 868 ++++++++++++++++++ .../och/weaknet/repository/db/MyDataBase.kt | 20 +- .../repository/db/bean/SiteDataBean.kt | 8 +- 3 files changed, 893 insertions(+), 3 deletions(-) create mode 100644 OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/8.json diff --git a/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/8.json b/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/8.json new file mode 100644 index 0000000000..c86f6751c1 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/8.json @@ -0,0 +1,868 @@ +{ + "formatVersion": 1, + "database": { + "version": 8, + "identityHash": "50810f785aa35be38cad3a202c2f809f", + "entities": [ + { + "tableName": "contrail_data_table", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT, `source` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "lineId", + "columnName": "line_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "contrailId", + "columnName": "contrail_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "csvFileUrl", + "columnName": "csv_file_url", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "csvFileMd5", + "columnName": "csv_file_md5", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "txtFileUrl", + "columnName": "txt_file_url", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "txtFileMd5", + "columnName": "txt_file_md5", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "contrailSaveTime", + "columnName": "contrail_save_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "md5", + "columnName": "md5", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "source", + "columnName": "source", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_contrail_data_table_line_id", + "unique": false, + "columnNames": [ + "line_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)" + }, + { + "name": "index_contrail_data_table_md5", + "unique": false, + "columnNames": [ + "md5" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "line_data_table", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "lineId", + "columnName": "line_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lineName", + "columnName": "line_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "endStationName", + "columnName": "end_station_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "linegetTime", + "columnName": "line_get_time", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_line_data_table_line_id", + "unique": false, + "columnNames": [ + "line_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "site_data_table", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT, `tag` INTEGER NOT NULL DEFAULT 0)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "siteId", + "columnName": "site_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lineId", + "columnName": "line_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "nameKr", + "columnName": "name_kr", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "seq", + "columnName": "seq", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "gcjLon", + "columnName": "gcj_lon", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "gcjLat", + "columnName": "gcj_lat", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "lon", + "columnName": "lon", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "lat", + "columnName": "lat", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "introduction", + "columnName": "introduction", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "isPlayTts", + "columnName": "is_play_tts", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "md5", + "columnName": "md5", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "videoListDB", + "columnName": "videoList", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "tag", + "columnName": "tag", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_site_data_table_site_id", + "unique": false, + "columnNames": [ + "site_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)" + }, + { + "name": "index_site_data_table_line_id", + "unique": false, + "columnNames": [ + "line_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "task_data_table", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `shifts_id` INTEGER, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "shiftsId", + "columnName": "shifts_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "taskId", + "columnName": "task_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lineId", + "columnName": "line_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "taskDate", + "columnName": "task_data", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "taskStartTime", + "columnName": "task_start_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "startTime", + "columnName": "start_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "endtime", + "columnName": "end_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "taskgetTime", + "columnName": "task_get_time", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "status", + "columnName": "status", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_task_data_table_task_id", + "unique": false, + "columnNames": [ + "task_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)" + }, + { + "name": "index_task_data_table_line_id", + "unique": false, + "columnNames": [ + "line_id" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "used_task_data_table", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `shifts_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "taskId", + "columnName": "task_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "shiftsId", + "columnName": "shifts_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lineId", + "columnName": "line_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "siteId", + "columnName": "site_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lineName", + "columnName": "line_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "nameKr", + "columnName": "name_kr", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "seq", + "columnName": "seq", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "gcjLon", + "columnName": "gcj_lon", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "gcjLat", + "columnName": "gcj_lat", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "lon", + "columnName": "lon", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "lat", + "columnName": "lat", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "drivingStatus", + "columnName": "driving_status", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "leaving", + "columnName": "leaving", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "arrivedTime", + "columnName": "arrived_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "leaveTime", + "columnName": "leave_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "introduction", + "columnName": "introduction", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "isPlayTts", + "columnName": "is_play_tts", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "eventSaveTime", + "columnName": "event_save_time", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "videoList", + "columnName": "videoList", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "event_data_table", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `shifts_id` INTEGER, `lineId` INTEGER, `task_date` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `msg_id` TEXT, `update_time` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "eventType", + "columnName": "event_type", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "shiftsId", + "columnName": "shifts_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lineId", + "columnName": "lineId", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "taskDate", + "columnName": "task_date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lineName", + "columnName": "lineName", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "taskId", + "columnName": "task_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "taskStartTime", + "columnName": "task_start_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "businessTime", + "columnName": "business_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "writeVersion", + "columnName": "write_version", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "siteId", + "columnName": "site_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "seq", + "columnName": "seq", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "driverId", + "columnName": "driver_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "eventSaveTime", + "columnName": "event_save_time", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "updateStatus", + "columnName": "update_status", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "msgId", + "columnName": "msg_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "upDateTime", + "columnName": "update_time", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_event_data_table_event_save_time", + "unique": false, + "columnNames": [ + "event_save_time" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "writeoff_data_table", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `shifts_id` INTEGER, `task_id` INTEGER, `task_date` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "msgId", + "columnName": "msg_id", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "expiryTime", + "columnName": "expiry_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "bookingTime", + "columnName": "booking_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "shiftsId", + "columnName": "shifts_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "taskId", + "columnName": "task_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "taskDate", + "columnName": "task_date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "lineId", + "columnName": "line_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "siteId", + "columnName": "site_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "driverId", + "columnName": "driver_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "availableTimes", + "columnName": "available_times", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "orderNo", + "columnName": "order_no", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "uid", + "columnName": "uid", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "phone", + "columnName": "seq", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "businessTime", + "columnName": "business_time", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "ticketSize", + "columnName": "tick_size", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "ticketName", + "columnName": "tick_name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "eventSaveTime", + "columnName": "event_save_time", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "updateStatus", + "columnName": "update_status", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "upDateTime", + "columnName": "update_time", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_writeoff_data_table_event_save_time", + "unique": false, + "columnNames": [ + "event_save_time" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_writeoff_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "point_data_table", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `site_id` INTEGER, `md5` TEXT, `seq` INTEGER, `point_type` INTEGER, `longitude` REAL, `latitude` REAL, `sub_seq` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "lineId", + "columnName": "line_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "contrailId", + "columnName": "contrail_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "siteId", + "columnName": "site_id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "md5", + "columnName": "md5", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "seq", + "columnName": "seq", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "pointType", + "columnName": "point_type", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "longitude", + "columnName": "longitude", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "latitude", + "columnName": "latitude", + "affinity": "REAL", + "notNull": false + }, + { + "fieldPath": "subSeq", + "columnName": "sub_seq", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": true, + "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, '50810f785aa35be38cad3a202c2f809f')" + ] + } +} \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/MyDataBase.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/MyDataBase.kt index 10d19d4b94..bf12f529b0 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/MyDataBase.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/MyDataBase.kt @@ -39,7 +39,7 @@ import java.util.concurrent.Executors @Database(entities = [ContrailDataBean::class, LineDataBean::class, SiteDataBean::class, TaskDataBean::class, TaskSiteDataBean::class, EventDataBean::class, WriteOffDataBean::class,PointDataBean::class - ], version = 7) + ], version = 8) abstract class MyDataBase : RoomDatabase() { private val dbRepositorys = mutableListOf() @@ -114,7 +114,22 @@ abstract class MyDataBase : RoomDatabase() { database.execSQL("ALTER TABLE ${ContrailDataBean.tableName} ADD COLUMN source INTEGER") } } - + private val MIGRATION_7_8 = object : Migration(7, 8) { + override fun migrate(db: SupportSQLiteDatabase) { + // 获取当前数据库文件名(通过database路径解析) + CallerLogger.d(TAG, "数据库路径:${db.path?: "错误"}") + val dbPath = db.path ?: return + val dbFileName = dbPath.substringAfterLast(File.separator) + // 仅当数据库是shuttle_db时,执行新增tag字段操作 + if (dbFileName == "shuttle_db") { + // 新增tag字段:int类型,非空,默认值0 + db.execSQL("ALTER TABLE ${SiteDataBean.tableName} ADD COLUMN tag INTEGER NOT NULL DEFAULT 0") + CallerLogger.d(TAG, "shuttle_db:给${SiteDataBean.tableName}新增tag字段成功") + } else { + CallerLogger.d(TAG, "非shuttle_db,跳过tag字段新增") + } + } + } fun getDBName():MyDataBase{ @@ -164,6 +179,7 @@ abstract class MyDataBase : RoomDatabase() { .addMigrations(MIGRATION_4_5) .addMigrations(MIGRATION_5_6) .addMigrations(MIGRATION_6_7) + .addMigrations(MIGRATION_7_8) .fallbackToDestructiveMigration() .setQueryCallback({ sqlQuery, bindArgs -> CallerLogger.d(TAG,"sql:$sqlQuery--->参数:$bindArgs") }, Executors.newSingleThreadExecutor()) .build() diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/SiteDataBean.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/SiteDataBean.kt index 2f8858adb9..86711224c1 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/SiteDataBean.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/SiteDataBean.kt @@ -87,6 +87,12 @@ data class SiteDataBean( @ColumnInfo(name = "videoList", typeAffinity = ColumnInfo.TEXT) var videoListDB: String? = null, + /** + * 站点标志 0:未赋值/默认值,与1结果一致 1:正常停靠 2:临时不停靠 + */ + @ColumnInfo(name = "tag", typeAffinity = ColumnInfo.INTEGER, defaultValue = "0") + var tag: Int = 0, + @Ignore var videoList:MutableList?=null ) { @@ -96,7 +102,7 @@ data class SiteDataBean( } override fun toString(): String { - return "SiteDataBean(siteId=$siteId, lineId=$lineId, name=$name, nameKr=$nameKr, seq=$seq, gcjLon=$gcjLon, gcjLat=$gcjLat, lon=$lon, lat=$lat, introduction=$introduction, isPlayTts=$isPlayTts, videoList=$videoListDB)" + return "SiteDataBean(siteId=$siteId, lineId=$lineId, name=$name, nameKr=$nameKr, seq=$seq, gcjLon=$gcjLon, gcjLat=$gcjLat, lon=$lon, lat=$lat, introduction=$introduction, isPlayTts=$isPlayTts, videoList=$videoListDB, tag=$tag)" } override fun equals(other: Any?): Boolean {