|
|
|
@ -1,7 +1,7 @@
|
|
|
|
from iti.applications.extensions import db
|
|
|
|
from iti.applications.extensions import db
|
|
|
|
from iti.applications.common.crud import TimeModelMixin
|
|
|
|
from iti.applications.common.crud import TimeModelMixin
|
|
|
|
from iti.applications.common.utils import BaseSchema
|
|
|
|
from iti.applications.common.utils import BaseSchema
|
|
|
|
from apiflask.fields import String, Integer, DateTime
|
|
|
|
from apiflask.fields import String, Integer, DateTime, Nested
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IotEndpoint(db.Model, TimeModelMixin):
|
|
|
|
class IotEndpoint(db.Model, TimeModelMixin):
|
|
|
|
@ -25,6 +25,11 @@ class IotEndpoint(db.Model, TimeModelMixin):
|
|
|
|
brand_name = db.Column(db.String(255), nullable=False, comment="品牌名称")
|
|
|
|
brand_name = db.Column(db.String(255), nullable=False, comment="品牌名称")
|
|
|
|
specification_model = db.Column(db.String(255), nullable=False, comment="规格型号")
|
|
|
|
specification_model = db.Column(db.String(255), nullable=False, comment="规格型号")
|
|
|
|
status = db.Column(db.Integer, nullable=False, default=0, comment="状态 0:停用 1:运行中 2:维修中")
|
|
|
|
status = db.Column(db.Integer, nullable=False, default=0, comment="状态 0:停用 1:运行中 2:维修中")
|
|
|
|
|
|
|
|
#关系
|
|
|
|
|
|
|
|
device = db.relationship(
|
|
|
|
|
|
|
|
"IotDevice",
|
|
|
|
|
|
|
|
primaryjoin="foreign(IotEndpoint.device_id) == IotDevice.id",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IotEndpointSchema(BaseSchema):
|
|
|
|
class IotEndpointSchema(BaseSchema):
|
|
|
|
@ -46,3 +51,19 @@ class IotEndpointSchema(BaseSchema):
|
|
|
|
status = Integer()
|
|
|
|
status = Integer()
|
|
|
|
created_at = DateTime(format="%Y-%m-%d %H:%M:%S")
|
|
|
|
created_at = DateTime(format="%Y-%m-%d %H:%M:%S")
|
|
|
|
updated_at = DateTime(format="%Y-%m-%d %H:%M:%S")
|
|
|
|
updated_at = DateTime(format="%Y-%m-%d %H:%M:%S")
|
|
|
|
|
|
|
|
#关系
|
|
|
|
|
|
|
|
device = Nested("IotDeviceSimpleSchema")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IotEndpointSimpleSchema(BaseSchema):
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
采集端信息表联合查询响应结构
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
name = "IotEndpoint"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
id = Integer()
|
|
|
|
|
|
|
|
endpoint_name = String()
|
|
|
|
|
|
|
|
endpoint_number = String()
|
|
|
|
|
|
|
|
#关系
|
|
|
|
|
|
|
|
device = Nested("IotDeviceSimpleSchema")
|