1 Star 0 Fork 5

wangjian/PilotGo_rpm

forked from src-openEuler/PilotGo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Modify-the-logic-of-deleting-the-machine.patch 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
From aba5560cb48950b52879ffbe8c0283a81d77b889 Mon Sep 17 00:00:00 2001
From: wubijie <wubijie@kylinos.cn>
Date: Mon, 15 Apr 2024 14:53:12 +0800
Subject: [PATCH] Modify the logic of deleting the machine
---
src/app/server/service/internal/dao/batchmanagerdao.go | 5 +++++
src/app/server/service/machine/machinemanager.go | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/src/app/server/service/internal/dao/batchmanagerdao.go b/src/app/server/service/internal/dao/batchmanagerdao.go
index e861c509..54d9e007 100644
--- a/src/app/server/service/internal/dao/batchmanagerdao.go
+++ b/src/app/server/service/internal/dao/batchmanagerdao.go
@@ -84,3 +84,8 @@ func GetMachineID(BatchID int) ([]uint, error) {
err := mysqlmanager.MySQL().Model(BatchMachines{}).Select("machine_node_id").Where("batch_id=?", BatchID).Find(&machineids).Error
return machineids, err
}
+
+func DeleteMachineBatch(NodeID int) error {
+ var bm BatchMachines
+ return mysqlmanager.MySQL().Where("machine_node_id=?", NodeID).Delete(&bm).Error
+}
diff --git a/src/app/server/service/machine/machinemanager.go b/src/app/server/service/machine/machinemanager.go
index 8a87ba36..2bf2ca35 100644
--- a/src/app/server/service/machine/machinemanager.go
+++ b/src/app/server/service/machine/machinemanager.go
@@ -76,6 +76,11 @@ func DeleteMachine(Deluuid []string) map[string]string {
machinelist[machinedeluuid] = err.Error()
}
if node.ID != 0 {
+ //删除机器批次关系表数据
+ if err := dao.DeleteMachineBatch(node.ID); err != nil {
+ machinelist[machinedeluuid] = err.Error()
+ continue
+ }
if err := dao.DeleteMachine(machinedeluuid); err != nil {
machinelist[machinedeluuid] = err.Error()
}
--
Gitee
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangjian_code/PilotGo_rpm.git
git@gitee.com:wangjian_code/PilotGo_rpm.git
wangjian_code
PilotGo_rpm
PilotGo_rpm
master

搜索帮助