From 903bb5c29f30bc8cf7374a3d0580738677d6fca2 Mon Sep 17 00:00:00 2001 From: iSecloud <869820505@qq.com> Date: Thu, 20 Jun 2024 10:41:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(backend):=20=E6=94=AF=E6=8C=81=E5=8F=98?= =?UTF-8?q?=E6=9B=B4SQL=E5=8D=95=E6=8D=AE=E7=9A=84=E9=9D=9E=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E9=85=8D=E7=BD=AE=20#5072?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dbpermission/db_account/handlers.py | 2 +- .../builders/mysql/mysql_import_sqlfile.py | 16 ++++++++++------ .../tendbcluster/tendb_import_sqlfile.py | 16 ++++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/dbm-ui/backend/db_services/dbpermission/db_account/handlers.py b/dbm-ui/backend/db_services/dbpermission/db_account/handlers.py index 3352bde605..c7bef1c7a9 100644 --- a/dbm-ui/backend/db_services/dbpermission/db_account/handlers.py +++ b/dbm-ui/backend/db_services/dbpermission/db_account/handlers.py @@ -168,7 +168,7 @@ def list_account_rules(self, rule_filter: AccountRuleMeta) -> Dict: # 如果是通过id过滤的,则不管集群类型 if rule_filter.rule_ids: rules_list = DBPrivManagerApi.list_account_rules( - {"bk_biz_id": self.bk_biz_id, "ids": rule_filter.rule_ids} + {"bk_biz_id": self.bk_biz_id, "cluster_type": self.account_type, "ids": rule_filter.rule_ids} ) else: rules_list = DBPrivManagerApi.list_account_rules( diff --git a/dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py b/dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py index b96faf932e..8a03a56427 100644 --- a/dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py +++ b/dbm-ui/backend/ticket/builders/mysql/mysql_import_sqlfile.py @@ -178,14 +178,18 @@ def init_ticket_flows(self): details=MysqlSqlImportFlowParamBuilder(self.ticket).get_params(), flow_alias=_("SQL模拟执行状态查询"), ), - Flow( - ticket=self.ticket, - flow_type=FlowType.BK_ITSM.value, - details=MysqlSqlImportItsmParamBuilder(self.ticket).get_params(), - flow_alias=_("单据审批"), - ), ] + if self.need_itsm: + flows.append( + Flow( + ticket=self.ticket, + flow_type=FlowType.BK_ITSM.value, + details=MysqlSqlImportItsmParamBuilder(self.ticket).get_params(), + flow_alias=_("单据审批"), + ) + ) + mode = self.ticket.details["ticket_mode"]["mode"] if mode == SQLExecuteTicketMode.MANUAL.value: flows.append(Flow(ticket=self.ticket, flow_type=FlowType.PAUSE.value, flow_alias=_("人工确认执行"))) diff --git a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_import_sqlfile.py b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_import_sqlfile.py index 77206b75b6..a7d86a4b57 100644 --- a/dbm-ui/backend/ticket/builders/tendbcluster/tendb_import_sqlfile.py +++ b/dbm-ui/backend/ticket/builders/tendbcluster/tendb_import_sqlfile.py @@ -92,14 +92,18 @@ def init_ticket_flows(self): details=TenDBClusterSqlImportFlowParamBuilder(self.ticket).get_params(), flow_alias=_("模拟执行"), ), - Flow( - ticket=self.ticket, - flow_type=FlowType.BK_ITSM.value, - details=TenDBClusterSqlImportItsmParamBuilder(self.ticket).get_params(), - flow_alias=_("单据审批"), - ), ] + if self.need_itsm: + flows.append( + Flow( + ticket=self.ticket, + flow_type=FlowType.BK_ITSM.value, + details=TenDBClusterSqlImportItsmParamBuilder(self.ticket).get_params(), + flow_alias=_("单据审批"), + ) + ) + mode = self.ticket.details["ticket_mode"]["mode"] if mode == SQLExecuteTicketMode.MANUAL.value: flows.append(Flow(ticket=self.ticket, flow_type=FlowType.PAUSE.value, flow_alias=_("人工确认执行")))