From 6ada2c53c4e28f7524fe9439563bc4adfab2ca41 Mon Sep 17 00:00:00 2001
From: tj <1378534974@qq.com>
Date: 星期二, 01 四月 2025 16:56:38 +0800
Subject: [PATCH] 1.vip续费页面-页面样式优化
---
app/src/main/java/com/example/firstapp/database/AppDatabase.kt | 41 +++++++++++++++++++++++++++++------------
1 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/app/src/main/java/com/example/firstapp/database/AppDatabase.kt b/app/src/main/java/com/example/firstapp/database/AppDatabase.kt
index 2251240..626aae1 100644
--- a/app/src/main/java/com/example/firstapp/database/AppDatabase.kt
+++ b/app/src/main/java/com/example/firstapp/database/AppDatabase.kt
@@ -20,11 +20,21 @@
import com.example.firstapp.utils.TAG_LIST
import com.example.firstapp.database.ext.ConvertersDate
-
+import com.example.firstapp.model.CourierStat
+import com.example.firstapp.model.DailyStat
@Database(
- entities = [ Msg::class, Code::class, KeywordEntity::class, Reminder::class],
+ entities = [
+ Msg::class,
+ Code::class,
+ KeywordEntity::class,
+ Reminder::class
+ ],
+ views = [
+ CourierStat::class,
+ DailyStat::class
+ ],
version = 20,
exportSchema = false
)
@@ -71,16 +81,6 @@
-
-
-
-
-
-
-
-
-
-
private val MIGRATION_MSG = object : Migration(19, 20) {
override fun migrate(database: SupportSQLiteDatabase) {
//database.execSQL("Create table Msg as Select id,type,`from`,content,(case when sim_info like 'SIM1%' then '0' when sim_info like 'SIM2%' then '1' else '-1' end) as sim_slot,sim_info,sub_id,time from Logs where 1 = 1")
@@ -110,6 +110,23 @@
`isEnabled` INTEGER NOT NULL
)
""")
+
+ // 创建 CourierStat 视图
+ database.execSQL("""
+ CREATE VIEW IF NOT EXISTS CourierStat AS
+ SELECT courierName, COUNT(*) as count
+ FROM packages
+ GROUP BY courierName
+ """)
+
+ // 创建 DailyStat 视图
+ database.execSQL("""
+ CREATE VIEW IF NOT EXISTS DailyStat AS
+ SELECT date(receivedTime/1000, 'unixepoch', 'localtime') as date,
+ COUNT(*) as count
+ FROM packages
+ GROUP BY date(receivedTime/1000, 'unixepoch', 'localtime')
+ """)
// database.execSQL("""
// CREATE TABLE IF NOT EXISTS `reminders` (
// id INTEGER PRIMARY KEY AUTOINCREMENT,
--
Gitblit v1.9.3