| | |
| | | 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:负责人ID"` |
| | |
| | | } |
| | | |
| | | 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: |
| | | } |