From a4c5058a264a03d847bee17c11f2699a54c52abe Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 26 Dec 2023 08:44:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=202023=E5=B9=B4=E5=8F=AA=E7=BB=9F?= =?UTF-8?q?=E8=AE=A13,4,5=E5=91=A8=E6=9C=9F=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/apps/supervision/views2.py | 4 ++++ 1 file changed, 4 insertions(+) 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,