feat:完善项目信息

This commit is contained in:
henry
2022-01-18 17:31:20 +08:00
parent 10224e8db6
commit 26a3205c08
8 changed files with 75 additions and 49 deletions

View File

@ -10,6 +10,32 @@ type TechnologyDemand struct {
*model.TechnologyDemand
}
type TechnologyDemandInfo struct {
*model.TechnologyDemand
CompanyKind int `json:"company_kind"`
}
func (m *TechnologyDemand) Demand(where ...*model.ModelWhere) ([]*TechnologyDemandInfo, error) {
out := make([]*TechnologyDemandInfo, 0)
db := orm.GetDB().Table(m.TableName()+" AS d").
Select("d.id", "d.title", "d.kind", "d.industry", "d.budget", "d.budget_mode", "d.deadline",
"c.kind AS company_kind").
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)
if len(where) > 0 {
for _, v := range where {
db = db.Where(v.Condition, v.Value)
}
}
err := db.Order("d.id " + model.OrderModeToDesc).Scan(&out).Error
return out, err
}
// Distribution 分布信息
func (m *TechnologyDemand) Distribution() ([]*DataAreaDistributionInfo, error) {
out := make([]*DataAreaDistributionInfo, 0)