You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.7 KiB
Python

from iti.applications.extensions import db
from iti.applications.common.crud import TimeModelMixin, RemarkModelMixin
from iti.applications.common.utils import BaseSchema
from apiflask.fields import String, Integer, DateTime
class IotWorkshop(db.Model, TimeModelMixin, RemarkModelMixin):
"""
车间信息表
"""
__tablename__ = "iot_workshop"
id = db.Column(
db.Integer,
primary_key=True,
autoincrement=True,
comment="标识",
)
workshop_name = db.Column(db.String(255), nullable=False, unique=True, comment="车间名称")
workshop_number = db.Column(db.String(50), nullable=False, comment="车间编号")
total_area = db.Column(db.String(50), nullable=True, comment="总面积(单位:平方米)")
director_name = db.Column(db.String(30), nullable=False, comment="负责人姓名")
director_phone = db.Column(db.String(15), nullable=False, comment="负责人电话")
status = db.Column(db.Integer, nullable=False, default=0, comment="状态 0:已停用 1:生产中")
class IotWorkshopSchema(BaseSchema):
"""
车间信息表响应结构
"""
class Meta:
name = "IotWorkshop"
id = Integer()
workshop_name = String()
workshop_number = String()
total_area = String()
director_name = String()
director_phone = String()
status = Integer()
remark = String()
created_at = DateTime(format="%Y-%m-%d %H:%M:%S")
updated_at = DateTime(format="%Y-%m-%d %H:%M:%S")
class IotWorkshopSimpleSchema(BaseSchema):
"""
车间信息表联合查询响应结构
"""
class Meta:
name = "IotWorkshop"
id = Integer()
workshop_name = String()
workshop_number = String()