123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- # -*- coding: utf-8 -*-
- from sqlalchemy import String, Column, Integer,DateTime,Text,Date,Time,ForeignKey
- from database import Base
- from sqlalchemy.orm import relationship
- from datetime import datetime
- class AppInfo(Base):
- """
- 应用表
- """
- __tablename__ = "tp_app_info"
- app_id = Column(String(100), primary_key=True)
- app_secret = Column(String(100))
- hashed_secret = Column(String(100))
- app_name = Column(String(100))
- note = Column(String(100))
- def __repr__(self):
- return "<AppInfo>{}:{}".format(self.app_id, self.app_secret)
- class Config:
- orm_mode = True
- class ApiServiceEntity(Base):
- __tablename__ = "tp_api_service"
- id = Column(String(100), primary_key=True)
- name = Column(String(100))
- status = Column(String(100))
- create_time = Column(DateTime, default=datetime.now)
- class Config:
- orm_mode = True
- class DatasourceEntity(Base):
- __tablename__ = "tp_datasource"
- id = Column(String(100), primary_key=True)
- name = Column(String(100))
- scope = Column(String(100))
- dsn = Column(String(100))
- dbtype = Column(String(100))
- host = Column(String(100))
- user = Column(String(100))
- password = Column(String(100))
- database = Column(String(100))
- port = Column(Integer)
- charset = Column(String(100))
- class Config:
- orm_mode = True
- class CommandEntity(Base):
- __tablename__ = "tp_command"
- id = Column(String(100), primary_key=True)
- sqltext = Column(String(100))
- datasource = Column(String(100))
- scope = Column(String(100))
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now)
- class Config:
- orm_mode = True
- class OprIdxStat(Base):
- """
- 指标统计表
- 统计各项指标
- """
- __tablename__ = "opr_idx_stat"
- id = Column(Integer, primary_key=True, autoincrement=True, comment='id')
- stat_dt = Column(DateTime,comment='统计日期')
- stat_lvl = Column(Integer,comment='统计级别 1地市2市有关单位3区县')
- area_id = Column(String(100),comment='行政区划编码')
- area_nm = Column(String(100),comment='行政区划名称')
- index_no = Column(String(100),comment='指标编号')
- index_nm = Column(String(100),comment='指标名称')
- index_value = Column(String(100),comment='指标度量值')
- index_unit = Column(String(100), comment='指标单位')
- etl_time = Column(DateTime,comment='etl加工时间戳')
-
- class Config:
- orm_mode = True
- class OprIdx(Base):
- """
- 指标表
- 存储各项指标,记录统计sql
- """
- __tablename__ = "opr_idx"
- id = Column(Integer, primary_key=True, autoincrement=True, comment='id')
- index_no = Column(String(100),comment='指标编号')
- index_nm = Column(String(100),comment='指标名称')
- index_sql = Column(Text,comment='指标统计sql')
- index_corn = Column(String(100), comment='执行指标corn表达式')
- create_time = Column(DateTime,comment='创建时间')
-
- class Config:
- orm_mode = True
- class MsgCenter(Base):
- """
- 消息中心
- """
-
- __tablename__ = "msg_center"
- id = Column(Integer, primary_key=True, autoincrement=True, comment='id')
- msg_type = Column(String, comment='消息类型')
- msg_id = Column(String,comment='消息ID')
- recv_time = Column(DateTime, default=datetime.now, comment='接收时间')
- recv_userid = Column(Integer, comment='接收用户ID')
- recv_status = Column(Integer, default="0", comment='接收状态 0 未阅 1 已阅')
- update_time = Column(DateTime, default=datetime.now, onupdate=datetime.now, comment='创建时间')
- del_flag = Column(String, default='0', comment='删除标志(0代表存在 2代表删除)')
- content = Column(String, default='', comment='消息内容')
- foreign_key = Column(String(50), comment='文件外键 --技术字段')
- from_scenario = Column(String(50), comment='对应标识 --技术字段')
- title = Column(String, default='', comment='标题')
- class Config:
- orm_mode = True
- class CzrzEntity(Base):
- __tablename__ = 'tp_czrz'
- id = Column(Integer, autoincrement=True, primary_key=True, index=True)
- user_id = Column(Integer, default=0, server_default="0")
- user_name = Column(String, default='', server_default='')
- nick_name = Column(String, default='', server_default='')
- czrz = Column(String, default='', server_default='')
- gxsj = Column(DateTime, default=0, server_default="0")
- ip = Column(String, default='', server_default='')
- action = Column(String, default='', server_default='')
- sign = Column(String, default='', server_default='')
- class Config:
- orm_mode = True
|