文档
测试

查询N条记录

POST
{{host}}/api/device_type/query

请求参数

参数名
类型
描述
必填
parent_type_code
string
父类型代码
可选
parent_type_id
int
父类型ID
可选
is_traversal
boolean
是否遍历子层级,默认:true
可选
data_format
enum
tree:返回树节点形式,list:返回集合形式;默认:tree
可选

响应参数

参数名
类型
描述
必填
ret
int
返回码:0-正常,非0-失败
必填
msg
string
返回消息
必填
result
array
返回数据
必填
type_id
int
类型ID
必填
type_name
string
类型名称
必填
parent_type_id
int
父类型ID
必填
type_code
string
类型代码
必填

说明 / 示例

###### 示例代码 ```javascript //请求 let res = await post("api/device_type/query",{ parent_type_id:0 }) //返回 res = { "ret": 0, "msg": "查询成功", "result": [{ "type_id": 1, "parent_type_id": 0, "type_code": "Light", "parent_type_code": null, "parent_type_name": null, "type_name": "照明设备", "commands": [], "icon_content": {}, "children": [{ "type_id": 2, "parent_type_id": 1, "type_code": "LEDLight", "parent_type_code": "Light", "parent_type_name": "照明设备", "type_name": "LED照明灯", "commands": [], "icon_content": { "icon": ["/static/icons/light_0.png", "/static/icons/light_1.png", "/static/icons/light_error.png" ], "width": 24, "height": 24 } }, { "type_id": 3, "parent_type_id": 1, "type_code": "LEDDimmingLight", "parent_type_code": "Light", "parent_type_name": "照明设备", "type_name": "LED调光照明灯", "commands": [], "icon_content": { "icon": ["/static/icons/Dimming_0.png", "/static/icons/Dimming_1.png", "/static/icons/Dimming_2.png", "/static/icons/Dimming_3.png", "/static/icons/Dimming_4.png", "/static/icons/Dimming_5.png", "/static/icons/Dimming_6.png", "/static/icons/Dimming_7.png", "/static/icons/Dimming_8.png", "/static/icons/Dimming_9.png", "/static/icons/Dimming_10.png", "/static/icons/Dimming_error.png" ], "width": 24, "height": 24 } }] }, { "type_id": 5, "parent_type_id": 0, "type_code": "Mesh", "parent_type_code": null, "parent_type_name": null, "type_name": "蓝牙设备", "commands": [], "icon_content": {}, "children": [{ "type_id": 6, "parent_type_id": 5, "type_code": "MeshGateway", "parent_type_code": "Mesh", "parent_type_name": "蓝牙设备", "type_name": "Mesh物联网关", "commands": [], "icon_content": {} }, { "type_id": 7, "parent_type_id": 5, "type_code": "MeshSwitchController", "parent_type_code": "Mesh", "parent_type_name": "蓝牙设备", "type_name": "Mesh开关控制器", "commands": ["switch_query === {bt_address} 8201", "switch_ack === {bt_address} 8202 {onoff}", "switch === {bt_address} 8203 {onoff}" ], "icon_content": {} }, { "type_id": 8, "parent_type_id": 5, "type_code": "MeshDimmingController", "parent_type_code": "Mesh", "parent_type_name": "蓝牙设备", "type_name": "Mesh调光控制器", "commands": ["switch_query === {bt_address} 8201", "switch_ack === {bt_address} 8202 {onoff}", "switch === {bt_address} 8203 {onoff}", "dimming_query === {bt_address} 824B", "dimming_ack === {bt_address} 824C {lightness} 00", "dimming === {bt_address} 824D {lightness} 00" ], "icon_content": {} }, { "type_id": 9, "parent_type_id": 5, "type_code": "MeshMicrowaveSensor", "parent_type_code": "Mesh", "parent_type_name": "蓝牙设备", "type_name": "Mesh微波传感器", "commands": ["microwave_query === {bt_address} CC 5D00 0103", "microwave === {bt_address} C9 5D00 0103 {delay} 0103 {high_level}{low_level}" ], "icon_content": { "icon": ["/static/icons/microwave_0.png", "/static/icons/microwave_1.png", "/static/icons/microwave_error.png" ], "width": 32, "height": 32 } }, { "type_id": 10, "parent_type_id": 5, "type_code": "MeshMicrowaveSensor-SupportSwitch", "parent_type_code": "Mesh", "parent_type_name": "蓝牙设备", "type_name": "Mesh微波传感器-支持开关", "commands": ["microwave_query === {bt_address} CC 5D00 0103", "microwave === {bt_address} C9 5D00 0103 {delay} 0103 {high_level}{low_level}" ], "icon_content": { "icon": ["/static/icons/microwave_0.png", "/static/icons/microwave_1.png", "/static/icons/microwave_error.png" ], "width": 32, "height": 32 } }, { "type_id": 11, "parent_type_id": 5, "type_code": "MeshMultiFunctionConverter", "parent_type_code": "Mesh", "parent_type_name": "蓝牙设备", "type_name": "Mesh多功能信号转换器", "commands": ["bqs_get === {bt_address} CC 5D00 0104", "bqs_set === {bt_address} C7 5D00 0104 {bps}", "control_ack === {bt_address} C3 5D00 {device_command}", "control === {bt_address} C4 5D00 {device_command}", "convert === {bt_address} C9 5D00 {device_command}" ], "icon_content": {} }] }, { "type_id": 12, "parent_type_id": 0, "type_code": "Power", "parent_type_code": null, "parent_type_name": null, "type_name": "电力设备", "commands": [], "icon_content": {}, "children": [{ "type_id": 13, "parent_type_id": 12, "type_code": "LoopController_6", "parent_type_code": "Power", "parent_type_name": "电力设备", "type_name": "六路照明控制器", "commands": [ "switch === 0117 {device_address} {loop_01} {loop_02} {loop_03} {loop_04} {loop_05} {loop_06}", "query === FE 55 05 00 16 {device_address} 51" ], "icon_content": {} }] }, { "type_id": 14, "parent_type_id": 0, "type_code": "ElectricityMeter", "parent_type_code": null, "parent_type_name": null, "type_name": "电表设备", "commands": [], "icon_content": {}, "children": [{ "type_id": 15, "parent_type_id": 14, "type_code": "SinglePhase_DistributionRoom", "parent_type_code": "ElectricityMeter", "parent_type_name": "电表设备", "type_name": "单相电表_配电间", "commands": ["query === {device_address} 03 0000 0025 {crc}", "query_result === {U}{_}{_}{I}{_}{_}{_}{P}{_}{_}{_}{S}{_}{_}{_}{Pf}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{Fr}{_}{_}{P+high}{P+low}{P-high}{P-low}{Q+high}{Q+low}{Q-high}{Q-low}" ], "icon_content": {} }, { "type_id": 16, "parent_type_id": 14, "type_code": "ThreePhase_DistributionRoom", "parent_type_code": "ElectricityMeter", "parent_type_name": "电表设备", "type_name": "三相电表_配电间", "commands": ["query === {device_address} 03 0000 0025 {crc}", "query_result === {Ua}{Ub}{_}{I}{_}{_}{_}{P}{_}{_}{_}{S}{_}{_}{_}{Pf}{_}{_}{_}{_}{_}{_}{_}{_}{_}{_}{Fr}{_}{_}{P+high}{P+low}{P-high}{P-low}{Q+high}{Q+low}{Q-high}{Q-low}" ], "icon_content": {} }] }, { "type_id": 17, "parent_type_id": 0, "type_code": "Sensor", "parent_type_code": null, "parent_type_name": null, "type_name": "传感器", "commands": [], "icon_content": {}, "children": [{ "type_id": 18, "parent_type_id": 17, "type_code": "LightnessSensor", "parent_type_code": "Sensor", "parent_type_name": "传感器", "type_name": "光照度传感器", "commands": ["query === {device_address} 03 0000 0007 {crc}", "query_result === {humidity}{temperature}{illuminance2}{illuminance3}{_}{_}{illuminance6}" ], "icon_content": { "width": 240, "height": 50 } }, { "type_id": 19, "parent_type_id": 17, "type_code": "AirQualitySensor", "parent_type_code": "Sensor", "parent_type_name": "传感器", "type_name": "空气质量传感器", "commands": ["query === {device_address} 03 0000 0009 {crc}", "query_result === {PM2.5}{_}{_}{_}{_}{_}{_}{_}{_}{CO2}" ], "icon_content": { "width": 260, "height": 90 } }, { "type_id": 20, "parent_type_id": 17, "type_code": "EnvironmentalDetector", "parent_type_code": "Sensor", "parent_type_name": "传感器", "type_name": "多功能环境检测仪", "commands": ["query === {device_address} 03 0008 000B {crc}", "query_result === {CO2}{_}{_}{_}{H2S}{_}{_}{_}{_}{_}{NH3}" ], "icon_content": { "width": 260, "height": 130 } }, { "type_id": 21, "parent_type_id": 17, "type_code": "TemperatureAndHumiditySensor", "parent_type_code": "Sensor", "parent_type_name": "传感器", "type_name": "温湿度传感器", "commands": ["query === {device_address} 03 0000 0002 {crc}", "query_result === {humidity}{temperature} " ], "icon_content": { "width": 220, "height": 90 } }] }, { "type_id": 22, "parent_type_id": 0, "type_code": "BAS", "parent_type_code": null, "parent_type_name": null, "type_name": "BAS", "commands": [], "icon_content": {}, "children": [{ "type_id": 34, "parent_type_id": 22, "type_code": "HVAC", "parent_type_code": "BAS", "parent_type_name": "BAS", "type_name": "暖通", "commands": [], "icon_content": {}, "children": [{ "type_id": 23, "parent_type_id": 34, "type_code": "BAS_AirConditioningUnit", "parent_type_code": "HVAC", "parent_type_name": "暖通", "type_name": "空调机组", "commands": [], "icon_content": {} }, { "type_id": 24, "parent_type_id": 34, "type_code": "BAS_ExhaustFan", "parent_type_code": "HVAC", "parent_type_name": "暖通", "type_name": "排风机", "commands": [], "icon_content": {} }, { "type_id": 25, "parent_type_id": 34, "type_code": "BAS_AirCurtainMachine", "parent_type_code": "HVAC", "parent_type_name": "暖通", "type_name": "风幕机", "commands": [], "icon_content": {} }] }] }, { "type_id": 35, "parent_type_id": 0, "type_code": "ThirdParty", "parent_type_code": null, "parent_type_name": null, "type_name": "第三方设备", "commands": [], "icon_content": {}, "children": [{ "type_id": 36, "parent_type_id": 35, "type_code": "WaterPump", "parent_type_code": "ThirdParty", "parent_type_name": "第三方设备", "type_name": "水泵", "commands": [], "icon_content": {} }] }, { "type_id": 37, "parent_type_id": 0, "type_code": "CollectionServer", "parent_type_code": null, "parent_type_name": null, "type_name": "采集服务器", "commands": [], "icon_content": {}, "children": [{ "type_id": 38, "parent_type_id": 37, "type_code": "485DataCollectionServer", "parent_type_code": "CollectionServer", "parent_type_name": "采集服务器", "type_name": "485数据采集服务器", "commands": [], "icon_content": {} }] }] } ```