From f26d6d27c5f756c88a2a44f2cf0125f277ff177e Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期四, 10 八月 2023 11:11:14 +0800 Subject: [PATCH] fix --- model/contact.go | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/model/contact.go b/model/contact.go index 43d899a..612fcba 100644 --- a/model/contact.go +++ b/model/contact.go @@ -12,6 +12,7 @@ Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鑱旂郴浜哄鍚�"` Number string `json:"number" gorm:"column:number;type:varchar(255);comment:鑱旂郴浜虹紪鍙�"` ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛ID"` + Client Client `json:"-" gorm:"foreignKey:ClientId"` Position string `json:"position" gorm:"column:position;type:varchar(255);comment:鑱屼綅"` Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:鐢佃瘽"` MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璐熻矗浜篒D"` @@ -80,7 +81,16 @@ } if key == "client_name" { - db = db.Joins("inner join clients on clients.id = contacts.client_id").Where("clients.name LIKE ?", "%"+v+"%") + //db = db.Joins("inner join clients on clients.id = contacts.client_id").Where("clients.name LIKE ?", "%"+v+"%") + db = db.Joins("Client").Where("Client.name LIKE ?", "%"+v+"%") + } + + if key == "is_first" { + if v == "鏄�" { + db = db.Where("is_first = ?", true) + } else if v == "鍚�" { + db = db.Where("is_first = ?", false) + } } case int: } -- Gitblit v1.8.0