feat:完善项目管理,增加网站首页接口信息

This commit is contained in:
henry
2021-12-15 14:31:14 +08:00
parent 3c55143278
commit ba62a25e4b
21 changed files with 471 additions and 50 deletions

View File

@ -0,0 +1,31 @@
package model
import (
"SciencesServer/app/common/model"
"SciencesServer/serve/orm"
"fmt"
)
type TechnologyDemand struct {
*model.TechnologyDemand
}
// Distribution 分布信息
func (m *TechnologyDemand) Distribution() ([]*DataAreaDistributionInfo, error) {
out := make([]*DataAreaDistributionInfo, 0)
err := orm.GetDB().Table(m.TableName()+" AS d").
Select("e.province", "e.city", "GROUP_CONCAT(d.industry SEPARATOR '&') AS industry").
Joins(fmt.Sprintf("LEFT JOIN %s AS u_e ON d.uid = u_e.uid", model.NewUserExpert().TableName())).
Joins(fmt.Sprintf("LEFT JOIN %s AS e ON u_e.expert_id = e.id", model.NewManageExpert().TableName())).
Group("e.province").Group("e.city").
Order("e.province "+model.OrderModeToAsc).Order("e.city "+model.OrderModeToAsc).
Where("d.status = ?", model.TechnologyDemandStatusForAgree).
Scan(&out).Error
return out, err
}
func NewTechnologyDemand() *TechnologyDemand {
return &TechnologyDemand{model.NewTechnologyDemand()}
}