Commit 9f80a08f authored by wang.wenrong's avatar wang.wenrong

search-scope

parent c21ef2cd
......@@ -75,17 +75,17 @@ async def get_search_scope(cid, pid, start, end):
where_list = [f"pid = {pid}"]
if cid:
where_list.append(f"cid in {cid}")
where_list.append(f"cid in %s")
if start and end:
where_list.append(f"event_datetime>={start} and event_datetime<={end}")
where_str = "and".join(where_list)
where_list.append(f"event_datetime >= '{start}' and event_datetime <='{end}' ")
where_str = " and ".join(where_list)
sql = f"select * from point_1min_event where {where_str} " \
f"ORDER BY event_datetime desc limit 5000"
async with MysqlUtil() as conn:
data = await conn.fetchall(sql)
data = await conn.fetchall(sql, args=(cid,))
return data
################
async def query_search_scope(cid, pid, page_num, page_size,
start, end):
query_body = {
......@@ -156,7 +156,7 @@ async def get_scope_pids(pids, start, end):
data = await conn.fetchall(sql)
return data
################################
async def query_search_scope_pids(pids, page_num, page_size, start, end):
query_body = {
"from": (page_num - 1) * page_size,
......
......@@ -10,7 +10,7 @@ from unify_api.constants import EVENT_TYPE_UNIT_MAP
async def alarm_setting_pds(pid, locations):
"""获取报警设置"""
sql_point = f"""
sql_point = """
SELECT
sd.id,
sd.etype,
......
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