From bacae991458fb59107942886b46692ecc3e49483 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 12 十二月 2024 18:34:56 +0800
Subject: [PATCH] 保存结果增加字段

---
 models/gather_model.go |    2 ++
 db/task_results.go     |    7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/db/task_results.go b/db/task_results.go
index 3e656bd..b90a943 100644
--- a/db/task_results.go
+++ b/db/task_results.go
@@ -3,6 +3,7 @@
 import (
 	"fmt"
 	"gorm.io/gorm"
+	"time"
 )
 
 type ModelTaskResults struct {
@@ -11,10 +12,12 @@
 	Event       string `json:"event" gorm:"type:varchar(255)"`                                           //棰勮浜嬩欢
 	ModelID     string `json:"modelID" gorm:"type:varchar(255)"`                                         //妯″瀷ID
 	ModelTaskID string `json:"modelTaskID" gorm:"type:varchar(255)"`                                     //妯″瀷浠诲姟ID
-	CommunityId string `json:"communityID" gorm:"index;column:community_id;type:varchar(299);not null;"` //灏忓尯ID
 	OrgID       string `json:"orgID" gorm:"index;column:org_id;type:varchar(299);not null;"`             //娲惧嚭鎵� domain unit ID
+	CommunityId string `json:"communityID" gorm:"index;column:community_id;type:varchar(299);not null;"` //灏忓尯ID
 	ObjectIds   string `json:"objectIds" gorm:"type:text"`                                               //浜嬩欢瀵硅薄锛屽彲浠ユ槸浜猴紝澶氫釜鐢ㄩ�楀彿鍒嗛殧
 	Location    string `json:"location" gorm:"type:varchar(255)"`                                        //鍙戠敓鍦扮偣
+	Building    string `json:"building" gorm:"type:varchar(255);"`                                       //妤兼爧
+	Floor       string `json:"floor"       gorm:"type:varchar(255);"`                                    //妤煎眰
 }
 
 func (m *ModelTaskResults) TableName() string {
@@ -161,7 +164,7 @@
 
 func (slf *ModelTaskResultsSearch) Save(record *ModelTaskResults) error {
 	var db = slf.build()
-
+	record.UpdatedAt = time.Now()
 	if err := db.Omit("CreatedAt").Save(record).Error; err != nil {
 		return fmt.Errorf("save err: %v, record: %+v", err, record)
 	}
diff --git a/models/gather_model.go b/models/gather_model.go
index 54e7626..fc55b84 100644
--- a/models/gather_model.go
+++ b/models/gather_model.go
@@ -99,6 +99,8 @@
 			OrgID:       location.OrgId,
 			ObjectIds:   strings.Join(persons.Elements(), ","),
 			Location:    location.Location,
+			Building:    location.Building,
+			Floor:       location.Floor,
 		}
 		results = append(results, result)
 	}

--
Gitblit v1.8.0