feat: 2023年只统计3,4,5周期的

This commit is contained in:
caoqianming 2023-12-26 08:44:54 +08:00
parent ab0ff72f1a
commit a4c5058a26
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,9 @@ class AnalyseViewSet(GenericViewSet):
质量目标集团统计
"""
vdata = self.is_valid(request)
cycle_str = ''
if vdata['year'] == 2023:
cycle_str = 'AND task2.cycle in (3,4,5)'
sql_str = f"""select task2.year as 年份,
dept.name as 单位,
dict.name as 单位类型,
@ -67,6 +70,7 @@ left join supervision_pgoaldept pdept5 on pdept5.goal_key = 'pgoal_5' and pdept5
left join supervision_pgoal pgoal on pgoal.year = 2023
left join system_dict dict on dict.id = dept.type_id
where task2.year = {vdata['year']}
{cycle_str}
and (dept.name = '{vdata['dept_name']}' or '{vdata['dept_name']}'='')
and (dict.name = '{vdata['dept_type_name']}' or '{vdata['dept_type_name']}'='')
GROUP BY task2.year, dept.id, dict.name,