Browse Source

@task: Space add strOutline

bai 3 years ago
parent
commit
63767028d1

+ 3 - 1
demo/src/main/java/com/framework/mvvm/model/db/AdmDatabase.kt

@@ -28,7 +28,8 @@ import com.framework.mvvm.model.db.entity.*
         RelationEntity::class,
         ProblemArchEntity::class,
         ProblemEquipEntity::class,
-        ComponentEntity::class
+        ComponentEntity::class,
+        PipeEntity::class
     ], version = 1, exportSchema = true
 )
 @TypeConverters(JsonConverter::class)
@@ -51,6 +52,7 @@ abstract class AdmDatabase : RoomDatabase() {
     abstract fun spaceDao(): SpaceDao
     abstract fun systemDao(): SystemDao
     abstract fun componentDao(): ComponentDao
+    abstract fun pipeDao(): PipeDao
 
     companion object {
         @Volatile

+ 29 - 0
demo/src/main/java/com/framework/mvvm/model/db/dao/PipeDao.kt

@@ -0,0 +1,29 @@
+package com.framework.mvvm.model.db.dao
+
+import androidx.room.*
+import com.framework.mvvm.model.db.entity.PipeConfigEntity
+import com.framework.mvvm.model.db.entity.PipeEntity
+
+/**
+ * 管道表 Dao
+ */
+@Dao
+interface PipeDao {
+    @Query("select * from pipe")
+    suspend fun getPipes(): List<PipeEntity>
+
+    @Query("select * from pipe where id = :id")
+    suspend fun getPipeById(id: String): PipeEntity
+
+    @Insert(onConflict = OnConflictStrategy.REPLACE)
+    suspend fun insPipe(vararg pipe: PipeEntity)
+
+    @Insert(onConflict = OnConflictStrategy.REPLACE)
+    suspend fun insPipes(configs: List<PipeEntity>)
+
+    @Update
+    suspend fun upPipe(pipe: PipeEntity)
+
+    @Delete
+    suspend fun delConfig(config: PipeConfigEntity)
+}

+ 33 - 0
demo/src/main/java/com/framework/mvvm/model/db/entity/PipeEntity.kt

@@ -0,0 +1,33 @@
+package com.framework.mvvm.model.db.entity
+
+import androidx.room.ColumnInfo
+import androidx.room.Entity
+import androidx.room.PrimaryKey
+
+/**
+ * 管道表
+ */
+@Entity(tableName = "pipe")
+data class PipeEntity(
+    @PrimaryKey val id: String,
+    @ColumnInfo(name = "floor_id") val floorId: String?,              // 楼层id
+    @ColumnInfo(name = "project_id") val projectId: String?,          // 项目id
+    @ColumnInfo(name = "building_id") val buildingId: String?,        // 建筑id
+    @ColumnInfo(name = "obj_from") val objFrom: String?,              // 管道的from端对象
+    @ColumnInfo(name = "type_from") val typeFrom: String?,            // from端对象类型(equipment:设备;pipe:管道)
+    @ColumnInfo(name = "obj_to") val objTo: String?,                  // 管道的to端对象
+    @ColumnInfo(name = "type_to") val typeTo: String?,                // to端对象类型(equipment:设备;pipe:管道)
+    @ColumnInfo(name = "direction") val direction: Int?,              // 管道方向(1:正向from->to;-1:反向to->from;0:无方向
+    @ColumnInfo(name = "pipe_type") val pipeType: String?,            // 管道的数据字典类型(OTLAPL: 液体管道|OTAAPL: 气体管道)'
+    @ColumnInfo(name = "pipe_sub_type") val pipeSubType: String?,     // 管道用途
+    @ColumnInfo(name = "route") val route: String?,                   // 管道路由(坐标列表格式:[{x:1,y:1,z:1}])
+    @ColumnInfo(name = "infos") val infos: String?,                   // 管道的信息点
+    @ColumnInfo(name = "creator") val creator: String?,               // 创建人
+    @ColumnInfo(name = "creation_time") val creationTime: Long?,      // 创建时间
+    @ColumnInfo(name = "modifier") val modifier: String?,             // 修改人
+    @ColumnInfo(name = "modified_time") val modifiedTime: Long?,      // 修改时间
+    @ColumnInfo(name = "valid") val valid: Int?,                      // 合法标识
+    @ColumnInfo(name = "upload_flag") val uploadFlag: String?,        // app端上传数据标记
+    @ColumnInfo(name = "d2m_state") val d2mState: String?,            // 逆向数据的数模同步状态(0:未同步;1:已同步)
+    @ColumnInfo(name = "delivery_state") val deliveryState: String?,  // 交付BDTP状态:1已交付,0待交付
+)

+ 8 - 6
demo/src/main/java/com/framework/mvvm/model/db/entity/RelConfigEntity.kt

@@ -12,10 +12,12 @@ import kotlinx.serialization.Serializable
 @Serializable
 data class RelConfigEntity(
     @PrimaryKey val id: String,
-    @ColumnInfo(name = "obj_type_from") val objTypeFrom: String,      // from 端对象类型(space|equipment)
-    @ColumnInfo(name = "obj_type_to") val objTypeTo: String,          //  to  端对象类型(space|equipment)
-    @ColumnInfo(name = "class_code_from") val classCodeFrom: String,  // from 端对象class_code
-    @ColumnInfo(name = "class_code_to") val classCodeTo: String,      //  to  端对象class_code
-    @ColumnInfo(name = "graph_code") val graphCode: String,           // 关系的图类型代码
-    @ColumnInfo(name = "rel_code") val relCode: String,               // 关系的边类型代码
+    @ColumnInfo(name = "obj_type_from") val objTypeFrom: String?,      // from 端对象类型(space|equipment)
+    @ColumnInfo(name = "obj_type_to") val objTypeTo: String?,          //  to  端对象类型(space|equipment)
+    @ColumnInfo(name = "class_code_from") val classCodeFrom: String?,  // from 端对象class_code
+    @ColumnInfo(name = "class_code_to") val classCodeTo: String?,      //  to  端对象class_code
+    @ColumnInfo(name = "graph_code") val graphCode: String?,           // 关系的图类型代码
+    @ColumnInfo(name = "graph_name") val graphName: String?,           // 关系的图类型名称
+    @ColumnInfo(name = "rel_code") val relCode: String?,               // 关系的边类型代码
+    @ColumnInfo(name = "rel_name") val relName: String?,               // 关系的边类型代码
 )

+ 6 - 1
demo/src/main/java/com/framework/mvvm/model/db/entity/SpaceEntity.kt

@@ -3,7 +3,9 @@ package com.framework.mvvm.model.db.entity
 import androidx.room.ColumnInfo
 import androidx.room.Entity
 import androidx.room.PrimaryKey
+import kotlinx.serialization.Contextual
 import kotlinx.serialization.Serializable
+import org.json.JSONObject
 
 /**
  * 工作空间表
@@ -27,7 +29,10 @@ data class SpaceEntity(
     @ColumnInfo(name = "modified_time") val modifiedTime: String?,    // 修改时间
     @ColumnInfo(name = "valid") val valid: Int?,                      // 合法标识
     @ColumnInfo(name = "upload_flag") val uploadFlag: Int?,           // app端上传数据标记
-    @ColumnInfo(name = "outline") val outline: String?,               // 空间边界,模型更新空间变化时,用来做匹配计算
+    @ColumnInfo(name = "outline")
+    @Contextual
+    val outline: JSONObject?,               // 空间边界,模型更新空间变化时,用来做匹配计算
+    @ColumnInfo(name = "strOutline") val strOutline: String?,         // 空间边界,模型更新空间变化时,用来做匹配计算
 )
 
 /*