From 9085071de3b43f0dd70802fe71954b439290f21c Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期四, 26 九月 2024 21:27:11 +0800
Subject: [PATCH] fix db flied name

---
 db/person.go |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/db/person.go b/db/person.go
index eab0654..959862d 100644
--- a/db/person.go
+++ b/db/person.go
@@ -9,7 +9,7 @@
 
 type DbPersons struct {
 	BaseEntity
-	TableId     string `gorm:"column:tableId"`
+	TableId     string `gorm:"column:table_id"`
 	FaceFeature string `gorm:"column:face_feature"`
 	CommunityID string `gorm:"column:community_id"` // 甯镐綇灏忓尯 domain unit ID
 	OrgID       string `gorm:"column:org_id"`       // 甯镐綇娲惧嚭鎵� domain unit ID
@@ -17,7 +17,7 @@
 }
 
 func (dbp *DbPersons) GetPersonTotal() (total int64, err error) {
-	sql := "select id from person where is_delete = 0 and tableId = 'system'"
+	sql := "select id from person where is_delete = 0 and table_id = 'system'"
 
 	err = db.Raw(sql).Count(&total).Error
 
@@ -26,7 +26,7 @@
 
 func (dbp *DbPersons) GetPersonsCacheBase(from int, size int) (arr []*FeatureCacheBase, err error) {
 	var persons []DbPersons
-	sql := "select id, tableId, face_feature, community_id from person where is_delete = 0 and tableId = 'system'"
+	sql := "select id, table_id, face_feature, community_id from person where is_delete = 0 and table_id = 'system'"
 	sql += " order by id asc limit " + strconv.Itoa(from) + "," + strconv.Itoa(size)
 
 	err = db.Raw(sql).Find(&persons).Error
@@ -60,7 +60,7 @@
 	var p DbPersons
 
 	err = db.Table("person").
-		Select("id", "tableId", "face_feature", "community_id").
+		Select("id", "table_id", "face_feature", "community_id").
 		First(&p, "id = ?", id).Error
 	if err != nil {
 		return nil, err

--
Gitblit v1.8.0