feat:完善项目管理,增加网站首页接口信息
This commit is contained in:
32
app/api/website/model/technology_achievement.go
Normal file
32
app/api/website/model/technology_achievement.go
Normal file
@ -0,0 +1,32 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type TechnologyAchievement struct {
|
||||
*model.TechnologyAchievement
|
||||
}
|
||||
|
||||
// Distribution 分布信息
|
||||
func (m *TechnologyAchievement) Distribution() ([]*DataAreaDistributionInfo, error) {
|
||||
out := make([]*DataAreaDistributionInfo, 0)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS a").
|
||||
Select("e.province", "e.city", "GROUP_CONCAT(a.industry SEPARATOR '&') AS industry").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS u_e ON a.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("a.status = ?", model.TechnologyAchievementStatusForAgree).
|
||||
Where("a.shelf_status = ?", model.ShelfStatusForUp).
|
||||
Scan(&out).Error
|
||||
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewTechnologyAchievement() *TechnologyAchievement {
|
||||
return &TechnologyAchievement{model.NewTechnologyAchievement()}
|
||||
}
|
Reference in New Issue
Block a user