feat:完善项目信息
This commit is contained in:
@ -20,19 +20,19 @@ type ManageCompanyProduct struct {
|
||||
|
||||
// Product 产品信息
|
||||
func (m *ManageCompany) Product(id, uid uint64, page, pageSize int, count *int64) ([]*ManageCompanyProduct, error) {
|
||||
mTechnologyProductCollect := model.NewTechnologyProductCollect()
|
||||
mNewUserCollect := model.NewUserCollect()
|
||||
|
||||
db := orm.GetDB().Table(model.NewUserCompany().TableName()+" u_c").
|
||||
Select("p.id", "p.title", "p.image", "p.industry", "p.maturity", "p.lead_standard", "p.cooperation_mode",
|
||||
"p.keyword", "v.count AS visit_count", "IFNULL(c_u.id, 0) AS is_collect", "c.count AS collect_count").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS p ON u_c.uid = p.uid AND p.shelf_status = %d AND p.status = %d AND p.is_deleted = %d",
|
||||
model.NewTechnologyProduct().TableName(), model.ShelfStatusForUp, model.TechnologyProductStatusForAgree, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT product_id, SUM(count) AS count FROM %s WHERE is_deleted = %d GROUP BY product_id) AS v ON p.id = v.product_id",
|
||||
model.NewTechnologyProductVisit().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT product_id, COUNT(count) AS count FROM %s WHERE is_deleted = %d GROUP BY product_id) AS c ON p.id = c.product_id",
|
||||
mTechnologyProductCollect.TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c_u ON p.id = c_u.product_id AND c_u.uid = %d AND c_u.is_deleted = %d",
|
||||
mTechnologyProductCollect.TableName(), uid, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, SUM(count) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS v ON p.id = v.object_id",
|
||||
model.NewUserVisit().TableName(), model.UserVisitKindForTechnologyProduct, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT object_id, COUNT(id) AS count FROM %s WHERE kind = %d AND is_deleted = %d GROUP BY object_id) AS c ON p.id = c.object_id",
|
||||
model.NewUserCollect().TableName(), model.UserCollectKindForTechnologyProduct, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c_u ON p.id = c_u.product_id AND c_u.uid = %d AND c_u.kind = %d AND c_u.is_deleted = %d",
|
||||
mNewUserCollect.TableName(), uid, model.UserCollectKindForTechnologyProduct, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("")).
|
||||
Where("u_c.company_id = ?", id).
|
||||
Where("u_c.invalid_status = ?", model.InvalidStatusForNot).
|
||||
|
Reference in New Issue
Block a user