feat:完善项目信息

This commit is contained in:
henry
2022-01-21 11:42:58 +08:00
parent dda20eb011
commit 1c027dd2d1
23 changed files with 125 additions and 113 deletions

View File

@ -26,7 +26,7 @@ func (m *ManageCompany) Products(id, uid uint64, page, pageSize int, count *int6
Select("p.id", "p.title", "p.image", "p.industry", "p.maturity", "p.lead_standard", "p.cooperation_mode",
"p.keyword", "v.count AS visit_count", "c_u.id AS collect_id", "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)).
model.NewTechnologyProduct().TableName(), model.ShelfStatusForUp, model.TechnologyStatusKindForAgree, 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",

View File

@ -26,7 +26,7 @@ func (m *TechnologyAchievement) Achievements(page, pageSize int, count *int64, w
model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, 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 a.id = c.object_id",
model.NewUserCollect().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)).
Where("a.status = ?", model.TechnologyAchievementStatusForAgree).
Where("a.status = ?", model.TechnologyStatusKindForAgree).
Where("a.is_deleted = ?", model.DeleteStatusForNot)
if len(where) > 0 {
@ -54,7 +54,7 @@ func (m *TechnologyAchievement) Achievement(where ...*model.ModelWhere) ([]*Tech
model.NewUserVisit().TableName(), model.UserCollectKindForTechnologyAchievement, 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 a.id = c.object_id",
model.NewUserCollect().TableName(), model.UserCollectKindForTechnologyAchievement, model.DeleteStatusForNot)).
Where("a.status = ?", model.TechnologyAchievementStatusForAgree).
Where("a.status = ?", model.TechnologyStatusKindForAgree).
Where("a.is_deleted = ?", model.DeleteStatusForNot)
out := make([]*TechnologyAchievementInfo, 0)
@ -99,7 +99,7 @@ func (m *TechnologyAchievement) Distribution() ([]*DataAreaDistributionInfo, err
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
Group("e.province").Group("e.city").Group("e.district").
Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).Order("e.district "+model.OrderModeToAsc).
Where("a.status = ?", model.TechnologyAchievementStatusForAgree).
Where("a.status = ?", model.TechnologyStatusKindForAgree).
Where("a.shelf_status = ?", model.ShelfStatusForUp).
Scan(&out).Error

View File

@ -24,7 +24,7 @@ func (m *TechnologyDemand) Demand(page, pageSize int, count *int64, where ...*mo
Joins(fmt.Sprintf("LEFT JOIN %s AS u_c ON d.uid = u_c.uid AND u_c.is_deleted = %d",
model.NewUserCompany().TableName(), model.DeleteStatusForNot)).
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u_c.company_id = c.id", model.NewManageCompany().TableName())).
Where("d.status = ?", model.TechnologyDemandStatusForAgree)
Where("d.status = ?", model.TechnologyStatusKindForAgree)
if len(where) > 0 {
for _, v := range where {
@ -50,7 +50,7 @@ func (m *TechnologyDemand) Distribution() ([]*DataAreaDistributionInfo, error) {
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
Group("e.province").Group("e.city").Group("e.district").
Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).Order("e.district "+model.OrderModeToAsc).
Where("d.status = ?", model.TechnologyDemandStatusForAgree).
Where("d.status = ?", model.TechnologyStatusKindForAgree).
Scan(&out).Error
return out, err