Beispiel #1
0
class Device(BaseModel2):
    __tablename__ = 'devices'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    devName = db.Column(db.String(100), nullable=False)
    dpTotal = db.Column(db.Integer)
    dataTotal = db.Column(db.Integer)
    devPosition = db.Column(db.String(30))
    deviceId = db.Column(db.String(30), nullable=False)
    devDesc = db.Column(db.Text)
    gId = db.Column(db.Integer, db.ForeignKey('groups.id'))
Beispiel #2
0
class HistoryData(BaseModel2):
    __tablename__ = 'historydatas'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    devName = db.Column(db.String(100), nullable=False)
    devId = db.Column(db.String(30), nullable=False)
    dataPointName = db.Column(db.String(30), nullable=False)
    createTime = db.Column(db.DateTime, default=datetime.now)
    value = db.Column(db.Float)
    regGroup = db.Column(db.String(30), nullable=False)
Beispiel #3
0
class DataPoint(BaseModel2):
    __tablename__ = 'datapoints'
    dpName = db.Column(db.String(100), nullable=False)
    dpPosition = db.Column(db.String(30))
    type = db.Column(db.Boolean)
    dpValue = db.Column(db.Float)
    dpDesc = db.Column(db.Text)
    createTime = db.Column(db.DateTime, default=datetime.now)
    devId = db.Column(db.Integer, db.ForeignKey('devices.id'))
Beispiel #4
0
class Plot(BaseModel2):
    __tablename__ = 'plots'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    bounds = db.Column(db.String(60), nullable=False)
    # exterior = db.Column(db.String(30))
    plotsName = db.Column(db.String(100))
    lotRange = db.Column(db.Integer)
    layerUrl = db.Column(db.String(100))
    plotsDesc = db.Column(db.Text)
    regId = db.Column(db.Integer, db.ForeignKey('regions.id'))
Beispiel #5
0
class CMSUser(BaseModel2):
    __tablename__ = 'cms_user'

    username = db.Column(db.String(50), nullable=False, unique=True)
    _password = db.Column(db.String(100), nullable=False)
    is_deleted = db.Column(db.Boolean, default=False)
    is_super = db.Column(db.Boolean, default=False)
    permission = db.Column(db.Integer, default=PERMISSION_COMMON)
    join_time = db.Column(db.DateTime, default=datetime.now)

    def __init__(self, username):
        self.username = username

    @property
    def password(self):
        # return self._password
        raise Exception("cannot access")

    @password.setter
    def password(self, raw_password):
        self._password = generate_password_hash(raw_password)

    def check_password(self, raw_password):
        result = check_password_hash(self._password, raw_password)
        return result

    def check_permission(self, permission):
        return self.is_super or permission & self.permission == permission
Beispiel #6
0
class Region(BaseModel2):
    __tablename__ = 'regions'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    regName = db.Column(db.String(20), nullable=False)
    regPosition = db.Column(db.String(30))
    regLocation = db.Column(db.Text)
    regRange = db.Column(db.Integer)
    regDesc = db.Column(db.Text)
Beispiel #7
0
class BaseModel2(BaseModel):
    __abstract__ = True
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)