58 lines
2.9 KiB
Markdown
58 lines
2.9 KiB
Markdown
|
|
1. 房间即时状态表
|
|||
|
|
- 这张表需要时刻更新,以反映房间的最新状态
|
|||
|
|
- 这张表的查询频率较高,需要建立索引以提高查询效率
|
|||
|
|
- 这张表的写入频率较高,需要考虑写入性能
|
|||
|
|
- 这张表的数据量较大,预计会有十万条左右的记录总数(可以根据hotel_id进行分片存储)
|
|||
|
|
- 这张表可能会被同时查询和写入,需要考虑并发性能
|
|||
|
|
- 这张表的写入操作主要是INSERT和UPDATE操作,根据主键进行写入
|
|||
|
|
- 这张表的查询操作主要是SELECT操作,根据主键进行查询
|
|||
|
|
- 这张表的写入操作可能会由多个线程同时进行,设计表的时候需要考虑并发性能和写入冲突问题
|
|||
|
|
|
|||
|
|
|
|||
|
|
2. 数据表规划 (如果没有特殊说明,所有字段均为可空)
|
|||
|
|
- 数据库属性:
|
|||
|
|
- 库名:log_platform
|
|||
|
|
- 模式:room_status
|
|||
|
|
- 表名:room_status_moment
|
|||
|
|
- 数据库字段:
|
|||
|
|
- 主键 guid uuid 32位无符号UUID (不可为空)
|
|||
|
|
- 最后更新时间 ts_ms int8 (Unix时间戳ms) (不可为空)
|
|||
|
|
- 酒店 hotel_id int2 (索引) (不可为空)
|
|||
|
|
- 房间 room_id text (索引) (不可为空)
|
|||
|
|
- 设备编号 device_id text (索引) (不可为空)
|
|||
|
|
- 系统锁状态 sys_lock_status int2 (索引)
|
|||
|
|
- 设备在线状态 online_status int2 (索引)
|
|||
|
|
- 设备launcher版本 launcher_version text
|
|||
|
|
- 设备App版本 app_version text
|
|||
|
|
- 设备配置版本 config_version text
|
|||
|
|
- 最后一次注册时间 register_ts_ms int8 (Unix时间戳ms)
|
|||
|
|
- 最后一次升级时间 upgrade_ts_ms int8 (Unix时间戳ms)
|
|||
|
|
- 最后一次下发配置时间 config_ts_ms int8 (Unix时间戳ms)
|
|||
|
|
- 当前公网IP地址 ip text
|
|||
|
|
- PMS状态 pms_status int2 (索引)
|
|||
|
|
- 取电状态 power_state int2 (索引)
|
|||
|
|
- 有、无人状态 cardless_state int2 (索引)
|
|||
|
|
- 服务状态 service_mask int8
|
|||
|
|
- 插卡状态 insert_card int2 (索引)
|
|||
|
|
- 空调地址 air_address text[]
|
|||
|
|
- 空调状态 air_state int2
|
|||
|
|
- 空调模型 air_model int2
|
|||
|
|
- 空调风速 air_speed int2
|
|||
|
|
- 空调设置温度 air_set_temp int2
|
|||
|
|
- 房间当前温度 air_now_temp int2
|
|||
|
|
- 空调电磁阀状态 air_solenoid_valve int2
|
|||
|
|
- 能耗表地址 elec_address text[]
|
|||
|
|
- 能耗表电压 elec_voltage double precision
|
|||
|
|
- 能耗表电流 elec_ampere double precision
|
|||
|
|
- 能耗表功率 elec_power double precision
|
|||
|
|
- 当前相位 elec_phase text
|
|||
|
|
- 能耗表能耗 elec_energy double precision
|
|||
|
|
- 能耗表累计能耗 elec_sum_energy double precision
|
|||
|
|
- 碳达人状态 carbon_state int2 (索引)
|
|||
|
|
- 回路状态 dev_loops jsonb
|
|||
|
|
- 碳达人节能累计 energy_carbon_sum double precision
|
|||
|
|
- 无卡节能累计 energy_nocard_sum double precision
|
|||
|
|
- 外设设备管理(数组) external_device jsonb (预留字段,暂时为空json)
|
|||
|
|
- 故障设备数量 faulty_device_count jsonb (预留字段,暂时为空json)
|
|||
|
|
|
|||
|
|
主键:hotel_id, room_id, device_id, guid
|