You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
752 B
23 lines
752 B
from iot.blueprints.sensor.models import nbiotDevice, nbiotDeviceStatus, nbiotDeviceType, nbiotDeviceArea
|
|
from sqlalchemy import case
|
|
|
|
|
|
|
|
def queryById(id):
|
|
return nbiotDevice.query.filter_by(id=id).first()
|
|
|
|
|
|
def queryStatusChoices(curretnId):
|
|
choices = nbiotDeviceStatus.query.order_by(case((nbiotDeviceStatus.id == curretnId, 0),else_=1),nbiotDeviceStatus.name.asc())
|
|
return choices
|
|
|
|
|
|
def queryTypeChoices(curretnId):
|
|
choices = nbiotDeviceType.query.order_by(case((nbiotDeviceType.id == curretnId, 0),else_=1),nbiotDeviceType.name.asc())
|
|
return choices
|
|
|
|
|
|
def queryAreaChoices(curretnId):
|
|
choices = nbiotDeviceArea.query.order_by(case((nbiotDeviceArea.id == curretnId, 0),else_=1),nbiotDeviceArea.name.asc())
|
|
return choices
|