table_vacuate_detail.py
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# author: 4N
# createtime: 2021/1/27
# email: nheweijun@sina.com
from ..models import Table,TableVacuate,Task
from app.util.component.ApiTemplate import ApiTemplate
from app.util.component.VacuateConf import VacuateConf
import copy
class Api(ApiTemplate):
api_name = "抽稀Detail"
def process(self):
res = {}
try:
res["data"] = []
table_guids = self.para.get("table_guids")
for table_guid in table_guids.split(","):
detail = {"table_guid":table_guid}
table: Table = Table.query.filter_by(guid=table_guid).one_or_none()
if table:
tvs = TableVacuate.query.filter_by(table_guid=table_guid).all()
detail["table_name"] = table.name
detail["vacuate_count"] = len(tvs)
detail["table_vacuate"] = [{"name":tv.name,"pixel_distance":tv.pixel_distance,"connectstr":tv.connectstr} for tv in tvs]
res["data"].append(detail)
res["result"] = True
except Exception as e:
raise e
return res
api_doc = {
"tags": ["管理接口"],
"parameters": [
{"name": "table_guids",
"in": "formData",
"type": "string",
"description": "表guid", "required": "true"},
],
"responses": {
200: {
"schema": {
"properties": {
}
}
}
}
}