diff --git a/server/apps/supervision/views2.py b/server/apps/supervision/views2.py index 96e8225..e7956a2 100644 --- a/server/apps/supervision/views2.py +++ b/server/apps/supervision/views2.py @@ -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,