feat:完善项目信息
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user