ソースを参照

fix:query bug

Roc 4 ヶ月 前
コミット
972f355a51
1 ファイル変更2 行追加2 行削除
  1. 2 2
      models/company_product.go

+ 2 - 2
models/company_product.go

@@ -437,12 +437,12 @@ func GetCompanyProductItemListByCompanyIdList(companyIdList []int, productId int
 // @param productId int
 // @return items []*CompanyProductItem
 // @return err error
-func GetCompanyProductItemByCompanyId(companyId int, productId int) (items *CompanyProductItem, err error) {
+func GetCompanyProductItemByCompanyId(companyId int, productId int) (item *CompanyProductItem, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT a.* FROM company_product as a 
          JOIN company b on a.company_id=b.company_id
          WHERE a.company_id = ? AND a.product_id = ? `
-	_, err = o.Raw(sql, companyId, productId).QueryRows(&items)
+	err = o.Raw(sql, companyId, productId).QueryRow(&item)
 
 	return
 }