fix: 网元主机title唯一导致冲突5002修改失败

This commit is contained in:
TsMask
2025-04-22 14:43:34 +08:00
parent 2e6741829f
commit cb1b0cde55

View File

@@ -257,7 +257,7 @@ func (r NeInfo) Insert(neInfo model.NeInfo) int64 {
uuid := generate.Code(4)
var hostIDs []string
for _, host := range neInfo.Hosts {
host.Title = neInfo.NeName + "_" + uuid
host.Title = fmt.Sprintf("%s_%d_%s", neInfo.NeName, host.Port, uuid)
host.GroupID = "1"
host.CreateBy = neInfo.CreateBy
hostId := r.neHostService.Insert(host)
@@ -283,7 +283,7 @@ func (r NeInfo) Update(neInfo model.NeInfo) int64 {
uuid := generate.Code(4)
for _, host := range neInfo.Hosts {
if host.ID != 0 {
host.Title = fmt.Sprintf("%s_%d_%s", neInfo.NeName, neInfo.Port, uuid)
host.Title = fmt.Sprintf("%s_%d_%s", neInfo.NeName, host.Port, uuid)
host.GroupID = "1"
host.UpdateBy = neInfo.UpdateBy
r.neHostService.Update(host)