-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_class_define.kt
101 lines (92 loc) · 3.02 KB
/
data_class_define.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.example.myapplication.Roomfinal
import androidx.room.Embedded
import androidx.room.Entity
import androidx.room.PrimaryKey
import androidx.room.Relation
import java.time.DayOfWeek
import java.time.LocalDate
class data_class_define {
}
//主信息表--->旅游主信息表
@Entity(tableName = "Main_items")
data class Main_item(
@PrimaryKey(autoGenerate = true)
val id: Int , // 主键
val time_start: String, // 起始时间
val trval_day: Int, // 旅游天数
val weathers_id: Int, // 天气信息主键
val trvals_id : Int, // 旅游事件主键
val name : String, // 事件名称
val other1 : String // 其他简略信息
)
//===============================================================
//定义主信息表和事件表的关系
data class mainwithtravel(
@Embedded val mainItem: Main_item,
@Relation(
parentColumn = "trvals_id",
entityColumn = "main_travel_id"
)
val travelItems: List<Travel_item>
)
//旅游事件表
@Entity(tableName = "Travel_Items")
data class Travel_item(
@PrimaryKey( autoGenerate = true)
val trval_id :Int, // 主键
val main_travel_id: Int, // 外键,
val model : Int, //事件性质
val Detail_travel : Int, // 详细事件
val trval_name : String, // 事件名称
val time: String, // 事件时间
val abbreviate_thing : String, // 事件内容
val detailthings : String, // 事件详细内容
val travel_location : String, // 事件地点
)
//====================================================================
//定义主信息表和天气的关系
data class mainwithweather(
@Embedded val mainItem: Main_item,
@Relation(
parentColumn = "weathers_id",
entityColumn = "main_weather_id"
)
val weatherItems: List<Weather_item>
)
//天气事件表
@Entity(tableName = "Weather_Items")
data class Weather_item(
@PrimaryKey( autoGenerate = true)
val weather_id: Int, //
val main_weather_id: Int, // 外键
val number_day : Int, //
val where : String,
val date : String,
val week: String,
val day_weather: String,
val dat_temp: Int,
val night_weather: String,
val night_temp: Int,
val attention: String,
)
//=====================================================================
//定义旅游表和详细事件的关系
data class travelwithdetail(
@Embedded val travelitem: Travel_item,
@Relation(
parentColumn = "Detail_travel",
entityColumn = "travel_detail_id"
)
val detailthingsItem: List<Detailthings_item>
)
//详细事件表
@Entity(tableName = "Detailthings_Items")
data class Detailthings_item(
@PrimaryKey( autoGenerate = true)
val detail_id: Int, //
val travel_detail_id: Int, // 外键,引用Travel_Items表的Detail_trval
val others: String,
val times: String,
val my_content: String,
)
//=====================================================================