Commit a43a1bf1 authored by lcn's avatar lcn

bug修复

parent 88908d81
...@@ -56,7 +56,7 @@ async def alarm_setting_pds(pid, locations): ...@@ -56,7 +56,7 @@ async def alarm_setting_pds(pid, locations):
threshold = res.get("threshold", "") threshold = res.get("threshold", "")
duration = res.get("duration", "") duration = res.get("duration", "")
enable = res.get("enable", "") enable = res.get("enable", "")
event_type = res.get("type", "") event_type = res.get("etype", "")
p_dic = { p_dic = {
"id": id_, "id": id_,
"type": name, "type": name,
......
...@@ -32,25 +32,21 @@ async def equipment_operations_service(userid, prod_id, cid, sid, pid, ...@@ -32,25 +32,21 @@ async def equipment_operations_service(userid, prod_id, cid, sid, pid,
if sid and not pid: if sid and not pid:
sql = f"SELECT c.product,c.cid,c.shortname,p.pid,p.name,m.sid,p.mtid" \ sql = f"SELECT c.product,c.cid,c.shortname,p.pid,p.name,m.sid,p.mtid" \
f" FROM `monitor` m LEFT JOIN company c on m.cid=c.cid " \ f" FROM `monitor` m LEFT JOIN company c on m.cid=c.cid " \
f"left join point p on p.mtid=m.mtid where sid='{sid}' " \ f"left join point p on p.mtid=m.mtid where demolished = 0 and " \
f"sid='{sid}' " \
f"limit {current_page}, {page_size}" f"limit {current_page}, {page_size}"
t_sql = f"SELECT count(c.cid) total FROM `monitor` m " \ t_sql = f"SELECT count(c.cid) total FROM `monitor` m " \
f"LEFT JOIN company c " \ f"LEFT JOIN company c " \
f"on m.cid=c.cid left join point p on p.mtid=m.mtid " \ f"on m.cid=c.cid left join point p on p.mtid=m.mtid " \
f"where sid='{sid}'" f"where demolished = 0 and sid='{sid}'"
else: else:
li = [] conn_sql = "where demolished = 0 "
if prod_id: if prod_id:
li.append(f"c.product={prod_id}") conn_sql += f" and c.product={prod_id}"
if cid: if cid:
li.append(f"c.cid={cid}") conn_sql += f" and c.cid={cid}"
if pid: if pid:
li.append(f"p.pid={pid}") conn_sql += f" and p.pid={pid}"
conn_sql = "where "
if li:
conn_sql += " and ".join(li)
else:
conn_sql = ""
sql = f"SELECT c.product,c.cid,c.shortname,p.pid,p.name,m.sid,p.mtid" \ sql = f"SELECT c.product,c.cid,c.shortname,p.pid,p.name,m.sid,p.mtid" \
f" FROM `monitor` m LEFT JOIN company c on m.cid=c.cid " \ f" FROM `monitor` m LEFT JOIN company c on m.cid=c.cid " \
f"left join point p on p.mtid=m.mtid {conn_sql} " \ f"left join point p on p.mtid=m.mtid {conn_sql} " \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment