Commit 0a5140ac authored by lcn's avatar lcn

bug修复

parent a35f83af
...@@ -6,11 +6,11 @@ async def get_sum_by_interval(table_name, time_format, start, end, sql_mid, ...@@ -6,11 +6,11 @@ async def get_sum_by_interval(table_name, time_format, start, end, sql_mid,
sql = f"""SELECT SUM(p) p,sum(charge) charge,sum(kwh) kwh, sql = f"""SELECT SUM(p) p,sum(charge) charge,sum(kwh) kwh,
DATE_FORMAT(create_time, '{time_format}') time_interval FROM DATE_FORMAT(create_time, '{time_format}') time_interval FROM
{table_name} where {sql_mid} and create_time >="{start}" and {table_name} where {sql_mid} and create_time >="{start}" and
create_time <="{end}" GROUP BY time_interval create_time <="{end}" GROUP BY time_interval having sum(kwh) > 0
""" """
async with MysqlUtil() as conn: async with MysqlUtil() as conn:
if point_id == -1: if point_id == -1:
data = await conn.fetchall(sql, args=(cid_list, )) data = await conn.fetchall(sql, args=(cid_list,))
else: else:
data = await conn.fetchall(sql, args=(point_id,)) data = await conn.fetchall(sql, args=(point_id,))
return data return data
......
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