device_info.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter database
  5. name:device_info.py
  6. author:rabin
  7. """
  8. from __load__ import *
  9. class Device_info(Model):
  10. __table__ = 'device_info'
  11. __comment__ = '设备管理'
  12. id = Fields(type='uuid', primaryKey=True, comment='设备ID', uuid='farm_id')
  13. farm_id = Fields(type='int', default='setting.farm', comment='园区ID', match='not')
  14. name = Fields(type='varchar(50)', comment='设备名')
  15. hardware_id = Fields(type='bigint', comment='硬件id', match='number|硬件id必须是数字')
  16. hardware_type = Fields(type='int', comment='硬件类型')
  17. gateway_id = Fields(type='uuid', comment='网关id')
  18. type_id = Fields(type='int', comment='设备类型')
  19. value = Fields(type='varchar(1000)', comment='设备传过来的值')
  20. exp = Fields(type='varchar(500)', comment='表达式')
  21. max = Fields(type='float', comment='最大上限', match='numberFloat|最大上限必须是数字')
  22. min = Fields(type='float', comment='最小下限', match='numberFloat|最小下限必须是数字')
  23. cxnum = Fields(type='int', comment='超限次数')
  24. cxtype = Fields(type='int', comment='超限类型,1为超过上限,2为超过下限')
  25. cxdate = Fields(type='int', comment='首次超限时间')
  26. status = Fields(type='boolean', default='False', comment='设备连接状态')
  27. state = Fields(type='boolean', default='True', comment='数据存在状态')
  28. cdate = Fields(type='int', default='time', comment='创建时间')
  29. udate = Fields(type='int', default='time', comment='接入时间')
  30. inorder = Fields(type='int', default='0', comment='排序', match='number|排序必须是数字')
  31. oper = Fields(type='boolean', default='False', comment='操作类型')
  32. operdate = Fields(type='int', comment='操作时间')
  33. ##ALTER TABLE demeter_device_info ADD exp varchar(500);
  34. #ALTER TABLE demeter_device_info ADD inorder int default 100;
  35. #ALTER TABLE demeter_device_info ADD oper boolean;
  36. #ALTER TABLE demeter_device_info ADD operdate int;
  37. #ALTER TABLE demeter_device_info DROP inorder;