|
|
@ -55,7 +55,7 @@ class BllHumitureRecord(Repository):
|
|
|
|
def get_client_day_log(self, client_id, start_time, end_time, page_param):
|
|
|
|
def get_client_day_log(self, client_id, start_time, end_time, page_param):
|
|
|
|
filter_base = ""
|
|
|
|
filter_base = ""
|
|
|
|
if client_id:
|
|
|
|
if client_id:
|
|
|
|
filter_base += f" clint_id='{client_id}'"
|
|
|
|
filter_base += f" client_id='{client_id}'"
|
|
|
|
if start_time and end_time:
|
|
|
|
if start_time and end_time:
|
|
|
|
if filter_base:
|
|
|
|
if filter_base:
|
|
|
|
filter_base += " and "
|
|
|
|
filter_base += " and "
|
|
|
@ -68,8 +68,9 @@ class BllHumitureRecord(Repository):
|
|
|
|
from (
|
|
|
|
from (
|
|
|
|
select client_id, client_name,
|
|
|
|
select client_id, client_name,
|
|
|
|
DATE_FORMAT(record_date,'%Y-%m-%d') day_date,
|
|
|
|
DATE_FORMAT(record_date,'%Y-%m-%d') day_date,
|
|
|
|
avg(temperature) avg_wd, avg(humidity) avg_sd,
|
|
|
|
round(avg(temperature),2) avg_wd,
|
|
|
|
avg(voc_content) avg_voc
|
|
|
|
round(avg(humidity),2) avg_sd,
|
|
|
|
|
|
|
|
round(avg(voc_content),2) avg_voc
|
|
|
|
from rms_humiture_record {filter_base} GROUP BY client_id, DATE_FORMAT(record_date,'%Y-%m-%d')
|
|
|
|
from rms_humiture_record {filter_base} GROUP BY client_id, DATE_FORMAT(record_date,'%Y-%m-%d')
|
|
|
|
) a LEFT JOIN rms_client as b on a.client_id=b.client_id ORDER BY day_date desc
|
|
|
|
) a LEFT JOIN rms_client as b on a.client_id=b.client_id ORDER BY day_date desc
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -90,13 +91,14 @@ class BllHumitureRecord(Repository):
|
|
|
|
if filter_base:
|
|
|
|
if filter_base:
|
|
|
|
filter_base += " and "
|
|
|
|
filter_base += " and "
|
|
|
|
filter_base += f" record_date>= '{start_time}' and record_date<= '{end_time}' "
|
|
|
|
filter_base += f" record_date>= '{start_time}' and record_date<= '{end_time}' "
|
|
|
|
|
|
|
|
if filter_base:
|
|
|
|
|
|
|
|
filter_base = f" where {filter_base}"
|
|
|
|
sql_all = f"""
|
|
|
|
sql_all = f"""
|
|
|
|
select
|
|
|
|
select
|
|
|
|
DATE_FORMAT(record_date,'%H:%i:%s') day_date,
|
|
|
|
DATE_FORMAT(record_date,'%H:%i:%s') day_date,
|
|
|
|
FORMAT(temperature,2) as wd,
|
|
|
|
round(temperature,2) as wd,
|
|
|
|
FORMAT(humidity,2) as sd,
|
|
|
|
round(humidity,2) as sd,
|
|
|
|
FORMAT(voc_content,2) as voc
|
|
|
|
round(voc_content,2) as voc
|
|
|
|
from rms_humiture_record {filter_base} ORDER BY record_date
|
|
|
|
from rms_humiture_record {filter_base} ORDER BY record_date
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|