From bfbb7a34851afd668ee622d5039b13fb9ea3697e Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 14 Jul 2021 13:59:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=8A=82=E7=82=B9=E6=97=B6?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=89=80=E5=9C=A8=E9=9B=86=E7=BE=A4=E7=8A=B6?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/node_dao.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/db/models/node_dao.go b/internal/db/models/node_dao.go index 459c59c2..9fc575d4 100644 --- a/internal/db/models/node_dao.go +++ b/internal/db/models/node_dao.go @@ -223,6 +223,8 @@ func (this *NodeDAO) ListEnabledNodesMatch(tx *dbs.Tx, // 集群 if clusterId > 0 { query.Attr("clusterId", clusterId) + } else { + query.Where("clusterId IN (SELECT id FROM " + SharedNodeClusterDAO.Table + " WHERE state=1)") } // 安装状态 @@ -330,6 +332,8 @@ func (this *NodeDAO) FindAllNodeIdsMatch(tx *dbs.Tx, clusterId int64, isOn confi query.State(NodeStateEnabled) if clusterId > 0 { query.Attr("clusterId", clusterId) + } else { + query.Where("clusterId IN (SELECT id FROM " + SharedNodeClusterDAO.Table + " WHERE state=1)") } if isOn == configutils.BoolStateYes { query.Attr("isOn", true) @@ -387,6 +391,8 @@ func (this *NodeDAO) CountAllEnabledNodesMatch(tx *dbs.Tx, // 集群 if clusterId > 0 { query.Attr("clusterId", clusterId) + } else { + query.Where("clusterId IN (SELECT id FROM " + SharedNodeClusterDAO.Table + " WHERE state=1)") } // 安装状态