|
@@ -79,12 +79,19 @@ func GetCompanyProductCount(companyId, productId int) (count int, err error) {
|
|
|
}
|
|
|
|
|
|
func GetCompanyProductDetailByCompanyId(companyId, productId int) (item *CompanyProduct, err error) {
|
|
|
- sql := ` SELECT * FROM company_product WHERE company_id = ? AND product_id = ?; `
|
|
|
+ sql := ` SELECT * FROM company_product WHERE company_id = ? AND product_id = ? `
|
|
|
o := orm.NewOrmUsingDB("weekly_report")
|
|
|
err = o.Raw(sql, companyId, productId).QueryRow(&item)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func GetCompanyProductDetailByCompanyIdCount(companyId, groupId int) (count int, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
|
+ sql := ` SELECT COUNT(1) AS count FROM company_product WHERE company_id = ? AND product_id = ? `
|
|
|
+ err = o.Raw(sql, companyId, groupId, groupId).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetCompanyProductAaiServeCount(companyId, groupId int) (count int, err error) {
|
|
|
o := orm.NewOrmUsingDB("weekly_report")
|
|
|
sql := ` SELECT COUNT(1) AS count FROM company_product WHERE company_id = ? AND product_id = 2 AND (group_id = ? OR share_group_id = ?) `
|