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.
29 lines
948 B
Python
29 lines
948 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from sqlalchemy.ext.declarative import declarative_base
|
|
from sqlalchemy import Column, Integer, String, DateTime, func
|
|
from website.db_mysql import get_session
|
|
|
|
Base = declarative_base()
|
|
|
|
"""
|
|
设备分类表
|
|
"""
|
|
class DeviceClassification(Base):
|
|
__tablename__ = 'device_classification'
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
name = Column(String(255), default='', comment='名称')
|
|
suid = Column(String(10), default='', comment='short uuid')
|
|
delete = Column("del", Integer, default=0)
|
|
create_time = Column(DateTime, default=func.now())
|
|
|
|
class DeviceClassificationReporitory(object):
|
|
|
|
def get_row_by_id(self, cid):
|
|
with get_session() as session:
|
|
return session.query(DeviceClassification).filter_by(id=cid).first()
|
|
|
|
def get_row_by_suid(self, suid):
|
|
with get_session() as session:
|
|
return session.query(DeviceClassification).filter_by(suid=suid).first() |