bug 修复

dev
周平 11 months ago
parent b2082e0e8b
commit d3bb437a53

@ -88,7 +88,18 @@ class DeviceClassificationHandler(APIHandler):
with self.app_mysql.connect() as conn:
cur = conn.execute(
text(
"SELECT id, suid, name FROM device_classification where del=0 ORDER BY id DESC"
"""
SELECT id, suid, name,
CASE
WHEN EXISTS (
SELECT 1
FROM enterprise_device
WHERE classification = device_classification.suid
) THEN '1'
ELSE '0'
END AS used
FROM device_classification where del=0 ORDER BY id DESC
"""
)
)
res = db_mysql.to_json_list(cur)

Loading…
Cancel
Save