fix
wangpengfei
2023-08-30 82c058c91daed212fd9b3807dca9ca80217ce738
service/test/supplier.go
@@ -34,7 +34,7 @@
// UpdateSupplier 更新Supplier记录
// Author [piexlmax](https://github.com/piexlmax)
func (sService *SupplierService) UpdateSupplier(s test.Supplier) (err error) {
   err = global.GVA_DB.Save(&s).Error
   err = global.GVA_DB.Updates(&s).Error
   return err
}
@@ -60,12 +60,30 @@
   if info.Name != "" {
      db = db.Where("name LIKE ?", "%"+info.Name+"%")
   }
   if info.Number != "" {
      db = db.Where("number LIKE ?", "%"+info.Number+"%")
   }
   if info.SupplierType != "" {
      db = db.Where("supplier_type LIKE ?", "%"+info.SupplierType+"%")
   }
   if info.Industry != "" {
      db = db.Where("industry LIKE ?", "%"+info.Industry+"%")
   }
   if info.Contact != "" {
      db = db.Where("contact LIKE ?", "%"+info.Contact+"%")
   }
   if info.Phone != "" {
      db = db.Where("phone LIKE ?", "%"+info.Phone+"%")
   }
   if info.CreatedAt != nil {
      db = db.Where("created_at = ?", info.CreatedAt)
   }
   err = db.Count(&total).Error
   if err != nil {
      return
   }
   err = db.Limit(limit).Offset(offset).Find(&ss).Error
   err = db.Debug().Limit(limit).Offset(offset).Preload("Contract").Find(&ss).Error
   return ss, total, err
}