fix
wangpengfei
2023-08-10 f26d6d27c5f756c88a2a44f2cf0125f277ff177e
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:负责人ID"`
@@ -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:
         }