zhaoqingang
2025-02-19 fca319958029fa924308e50cb61202d7d6ff5008
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package db
 
import (
    "gorm.io/gorm"
    "time"
)
 
type KeyPerson struct {
    ID               string `gorm:"column:id;primaryKey"`
    CreatedAt        time.Time
    UpdatedAt        time.Time
    DeletedAt        *time.Time
    Name             string `gorm:"column:name"`
    IDCard           string `gorm:"column:id_card"`
    Phone            string `gorm:"column:phone"`
    Address          string `gorm:"column:address"`
    HouseholdAddress string `gorm:"column:household_address"`
    Age              string `gorm:"column:age"`
    Gender           string `gorm:"column:gender"`
    PersonType       string `gorm:"column:person_type"`
    FaceImage        string `gorm:"column:face_image"`
    Level            string `gorm:"column:level"`
    SrcID            string `gorm:"column:src_id"`
    Provider         string `gorm:"column:provider"`
}
 
type CaptureRecord struct {
    IDCard         string `json:"idCard"`
    PicDate        string `json:"picDate"`
    DocumentNumber string
    CommunityName  string `json:"communityName"`
    CameraLocation struct {
        Building string `json:"building"`
        Floor    string `json:"floor"`
    } `json:"cameraLocation"`
}
 
func QueryKeyPersons(db *gorm.DB, idCards []string, personType string) []KeyPerson {
    var keyPersons []KeyPerson
    db.Where("id_card IN ? AND person_type = ?", idCards, personType).Find(&keyPersons)
    return keyPersons
}