From 28c5cf41c5064579dd62f79fd40dc5990e9565b2 Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期一, 09 九月 2024 20:52:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 db/repository.go |   53 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/db/repository.go b/db/repository.go
index 48b4757..ca159f7 100644
--- a/db/repository.go
+++ b/db/repository.go
@@ -4,6 +4,7 @@
 	"basic.com/valib/logger.git"
 	"errors"
 	"gorm.io/gorm"
+	"strconv"
 )
 
 // 鏌ヨ灏忓尯琛�
@@ -29,6 +30,17 @@
 		return nil, result.Error
 	}
 	return device, nil
+}
+
+func GetPublicHouseData() ([]PublicHouse, error) {
+	// 鏌ヨ鏁版嵁
+	var db = DB
+	var ph []PublicHouse
+	result := db.Table("public_house").Where("1 = 1").Find(&ph)
+	if result.Error != nil {
+		return nil, result.Error
+	}
+	return ph, nil
 }
 
 // 鏌ヨ鍏ㄩ儴鏁版嵁
@@ -88,18 +100,17 @@
 }
 
 // 鏌ヨ浜虹墿灞炴��
-func GetDBPersonStatusData(id string) ([]PersonStatus, error) {
+func GetDBPersonStatus(id, communityId string) string {
 	var db = DB
-	// 鏌ヨ鏁版嵁
-	var personStatusList []PersonStatus
-	if err := db.Table("person_status").
-		Select("documentNumber, status, frequentAddress").
-		Where("communityID = ?", id).
-		Find(&personStatusList).Error; err != nil {
-		return nil, err
-	}
 
-	return personStatusList, nil
+	// 鏌ヨ鏁版嵁
+	var personStatus string
+	db.Table("snapshot_count_summary").
+		Select("status").
+		Where("community_id = ? and document_number = ?", communityId, id).
+		Find(&personStatus)
+
+	return personStatus
 }
 
 // 鏌ヨ灏忓尯妗f琛� (鍘熸煡璇换鍔″睘鎬�)
@@ -120,7 +131,7 @@
 func GetAgeById(id string) (int, error) {
 	var db = DB
 	// 鏌ヨ鏁版嵁
-	var age int
+	var age string
 	if err := db.Table("dbtablepersons").
 		Select("age").
 		Where("id = ?", id).
@@ -128,7 +139,20 @@
 		return 0, err
 	}
 
-	return age, nil
+	return strconv.Atoi(age)
+}
+
+// 鏌ヨ浜虹墿韬唤璇佸彿
+func GetIdCardById(id string) string {
+	var db = DB
+	// 鏌ヨ鏁版嵁
+	var idCard string
+	db.Table("dbtablepersons").
+		Select("idCard").
+		Where("id = ?", id).
+		Find(&idCard)
+
+	return idCard
 }
 
 //// 鏍规嵁绀惧尯id鍜屼綇鎴峰睘鎬ф煡璇綇鎴锋。妗堢紪鍙�
@@ -169,7 +193,7 @@
 // 鏍规嵁dbtablepersons琛╥d鏌ヨ鐩爣妗f骞撮緞
 func QueryAgeById(id string) (int, error) {
 	var db = DB
-	var age int
+	var age string
 	err := db.Table("dbtablepersons").
 		Select("age").
 		Where("id = ?", id).
@@ -177,7 +201,8 @@
 	if err != nil {
 		return 0, err
 	}
-	return age, nil
+
+	return strconv.Atoi(age)
 }
 
 // UpdatePersonInfo 鏇存柊鎴栨彃鍏ュ涓汉鍛樹俊鎭�

--
Gitblit v1.8.0