From d5a8423804d6b5c515e6c6e7ad6cdfee2a9b582f Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期六, 18 五月 2024 13:09:59 +0800
Subject: [PATCH] 修复ape更新时绑定id

---
 vo/ape.go             |    2 +-
 repository/apeRepo.go |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/repository/apeRepo.go b/repository/apeRepo.go
index aa4b846..a5fe8aa 100644
--- a/repository/apeRepo.go
+++ b/repository/apeRepo.go
@@ -78,8 +78,11 @@
 
 func (a *ApeRepository) Save(fromId string, req *vo.Ape) error {
 	var ape models.Ape
-	ape.FromId = fromId
+	_ = ape.FindById(req.ApeID)
+
+	ape.Id = req.ApeID
 	ape.Name = req.Name
+	ape.FromId = fromId
 	ape.Ext = *req
 
 	return ape.Save()
diff --git a/vo/ape.go b/vo/ape.go
index d825df7..cae2ebd 100644
--- a/vo/ape.go
+++ b/vo/ape.go
@@ -8,7 +8,7 @@
 
 // 鐩存帴娉ㄥ唽鐨勯噰闆嗚澶�, Device鍖呭惈杩欎簺璁惧, 鍒嗗紑瀛樺彧鏄负浜嗙骇鑱斾笂鎶�
 type Ape struct {
-	ApeID            string  `json:"ApeID"`
+	ApeID            string  `json:"ApeID" binding:"required"`
 	Name             string  `json:"Name"`
 	Model            string  `json:"Model"`
 	IPAddr           string  `json:"IPAddr"`

--
Gitblit v1.8.0