feat:完善项目管理,增加网站首页接口信息
This commit is contained in:
31
app/api/website/model/technology_demand.go
Normal file
31
app/api/website/model/technology_demand.go
Normal 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()}
|
||||
}
|
Reference in New Issue
Block a user