From 111b3b0a5ae56ef6cffcc800389a5a889b08f8b0 Mon Sep 17 00:00:00 2001 From: jiangyong27 Date: Tue, 11 Mar 2025 17:11:35 +0800 Subject: [PATCH] corp host --- common/dao/corp.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/dao/corp.go b/common/dao/corp.go index f50608f..704bd0a 100644 --- a/common/dao/corp.go +++ b/common/dao/corp.go @@ -2,6 +2,7 @@ package dao import ( "enterprise/common/model" + "fmt" "gorm.io/gorm" "time" ) @@ -53,7 +54,7 @@ func (d *CorpDao) Get(id int64) (*model.Corp, error) { func (d *CorpDao) GetByHost(host string) (*model.Corp, error) { var u model.Corp tx := GetDB().Table(d.TableName()) - tx = tx.Where("host = ?", host) + tx = tx.Where("host LIKE ?", fmt.Sprintf("%%%s%%", host)) res := tx.First(&u) if res.Error == gorm.ErrRecordNotFound { return nil, nil