corp host
This commit is contained in:
parent
9a84b0172f
commit
111b3b0a5a
|
@ -2,6 +2,7 @@ package dao
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"enterprise/common/model"
|
"enterprise/common/model"
|
||||||
|
"fmt"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -53,7 +54,7 @@ func (d *CorpDao) Get(id int64) (*model.Corp, error) {
|
||||||
func (d *CorpDao) GetByHost(host string) (*model.Corp, error) {
|
func (d *CorpDao) GetByHost(host string) (*model.Corp, error) {
|
||||||
var u model.Corp
|
var u model.Corp
|
||||||
tx := GetDB().Table(d.TableName())
|
tx := GetDB().Table(d.TableName())
|
||||||
tx = tx.Where("host = ?", host)
|
tx = tx.Where("host LIKE ?", fmt.Sprintf("%%%s%%", host))
|
||||||
res := tx.First(&u)
|
res := tx.First(&u)
|
||||||
if res.Error == gorm.ErrRecordNotFound {
|
if res.Error == gorm.ErrRecordNotFound {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
Loading…
Reference in New Issue