feat:优化信息,增加技术成果搜索
This commit is contained in:
@ -33,7 +33,7 @@ func (m *ManageExpert) Experts(page, pageSize int, count *int64, where ...*model
|
||||
db := orm.GetDB().Table(m.TableName()+" e").
|
||||
Select("e.id", "e.name", "e.mobile", "e.industry", "v.count AS visit_count", "c.count AS collect_count",
|
||||
"e.examine_at AS settled_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT expert_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY expert_id) AS v ON e.id = v.expert_id",
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT expert_id, SUM(count) AS count FROM %s WHERE is_deleted = %d GROUP BY expert_id) AS v ON e.id = v.expert_id",
|
||||
model.NewManageExpertVisit().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT expert_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY expert_id) AS c ON e.id = c.expert_id",
|
||||
model.NewManageExpertCollect().TableName(), model.DeleteStatusForNot)).
|
||||
|
@ -28,7 +28,7 @@ func (m *ManageLaboratory) Laboratory(page, pageSize int, count *int64, where ..
|
||||
Select("l.id", "l.name", "l.industry", "u.name AS username", "u.mobile", "v.count AS visit_count",
|
||||
"c.count AS collect_count", "l.examine_at AS settled_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u ON l.uid = u.uuid", model.NewUserInstance().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT laboratory_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY laboratory_id) AS v ON l.id = v.laboratory_id",
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT laboratory_id, SUM(count) AS count FROM %s WHERE is_deleted = %d GROUP BY laboratory_id) AS v ON l.id = v.laboratory_id",
|
||||
model.NewManageLaboratoryVisit().TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT laboratory_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY laboratory_id) AS c ON l.id = c.laboratory_id",
|
||||
model.NewManageLaboratoryCollect().TableName(), model.DeleteStatusForNot))
|
||||
|
@ -30,7 +30,7 @@ func (m *TechnologyProduct) Product(page, pageSize int, count *int64, where ...*
|
||||
db := orm.GetDB().Table(m.TableName()+" AS p").
|
||||
Select("p.id", "p.title", "p.image", "p.maturity", "p.industry", "p.cooperation_mode", "p.keyword",
|
||||
"v.count AS v visit_count", "c.count AS collect_count").
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT product_id, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY product_id) AS v ON p.id = v.product_id",
|
||||
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(id) AS count FROM %s WHERE is_deleted = %d GROUP BY product_id) AS c ON p.id = c.product_id",
|
||||
model.NewTechnologyProductCollect().TableName(), model.DeleteStatusForNot))
|
||||
|
Reference in New Issue
Block a user