feat:完善信息
This commit is contained in:
@ -18,7 +18,7 @@ type (
|
||||
api.ImageForm
|
||||
Name string `json:"name" form:"name" binding:"required"`
|
||||
Code string `json:"code" form:"code"`
|
||||
Mobile string `json:"mobile" form:"mobile" binding:"required"`
|
||||
Mobile string `json:"mobile" form:"mobile"`
|
||||
config.Area
|
||||
Industrys []string `json:"industrys" form:"industrys"`
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
|
@ -22,8 +22,10 @@ type (
|
||||
ResearchInstance struct {
|
||||
ID string `json:"id"`
|
||||
*model.ManageResearchInfo
|
||||
Address string `json:"address"`
|
||||
Area string `json:"area"`
|
||||
Industrys []string `json:"industrys"`
|
||||
Researchs []string `json:"researchs"`
|
||||
Address string `json:"address"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
// ResearchSelect 科研机构筛选信息
|
||||
ResearchSelect struct {
|
||||
@ -69,9 +71,19 @@ func (c *Research) Instance(tenantID uint64, name string, examineStatus, page, p
|
||||
list := make([]*ResearchInstance, 0)
|
||||
|
||||
for _, v := range out {
|
||||
mManageResearch.Industry = v.Industry
|
||||
mManageResearch.ManageResearch.Research = v.Research
|
||||
|
||||
_industrys := make([]string, 0)
|
||||
|
||||
for _, v := range mManageResearch.GetIndustryAttribute() {
|
||||
_industrys = append(_industrys, config.GetIndustryInfo(v, "-", ">").Value)
|
||||
}
|
||||
list = append(list, &ResearchInstance{
|
||||
ID: v.GetEncodeID(), ManageResearchInfo: v,
|
||||
Address: v.FormatBasic(), Area: (&model2.Area{
|
||||
Industrys: _industrys,
|
||||
Researchs: mManageResearch.GetResearchAttribute(),
|
||||
Address: v.FormatBasic(), Area: (&model2.Area{
|
||||
Province: v.TenantProvince,
|
||||
City: v.TenantCity,
|
||||
}).FormatBasic(),
|
||||
@ -174,7 +186,7 @@ func (c *Research) Detail(id uint64) (*ResearchDetail, error) {
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if out.ManageResearch == nil {
|
||||
} else if out == nil {
|
||||
return nil, errors.New("操作错误,科研机构信息不存在或已被删除")
|
||||
}
|
||||
_industrys := make([]*config.Industry, 0)
|
||||
@ -187,7 +199,7 @@ func (c *Research) Detail(id uint64) (*ResearchDetail, error) {
|
||||
|
||||
return &ResearchDetail{
|
||||
ID: out.GetEncodeID(), TenantID: out.GetEncodeTenantID(),
|
||||
ManageResearch: out.ManageResearch, Industrys: _industrys,
|
||||
ManageResearch: out, Industrys: _industrys,
|
||||
Keywords: out.GetKeywordAttribute(), Researchs: out.GetResearchAttribute(),
|
||||
}, nil
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ManageResearch struct {
|
||||
@ -16,12 +17,13 @@ type (
|
||||
model.Model
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Industry string `json:"industry"`
|
||||
Research string `json:"research"`
|
||||
Industry string `json:"-"`
|
||||
Research string `json:"-"`
|
||||
ExamineStatus string `json:"examine_status"`
|
||||
model.Area
|
||||
TenantProvince string `json:"-"`
|
||||
TenantCity string `json:"-"`
|
||||
TenantProvince string `json:"-"`
|
||||
TenantCity string `json:"-"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
// ManageResearchDetail 详细信息
|
||||
ManageResearchDetail struct {
|
||||
@ -31,13 +33,13 @@ type (
|
||||
)
|
||||
|
||||
// Research 科研机构信息
|
||||
func (m *ManageResearch) Research(id uint64) (*ManageResearchDetail, error) {
|
||||
func (m *ManageResearch) Research(id uint64) (*model.ManageResearch, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS r").
|
||||
Select("r.*").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON r.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Where("r.id = ?", id)
|
||||
|
||||
out := new(ManageResearchDetail)
|
||||
out := new(model.ManageResearch)
|
||||
|
||||
err := db.Scan(out).Error
|
||||
|
||||
@ -48,7 +50,7 @@ func (m *ManageResearch) Research(id uint64) (*ManageResearchDetail, error) {
|
||||
func (m *ManageResearch) Researchs(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ManageResearchInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS r").
|
||||
Select("r.id", "r.name", "r.code", "r.industry", "r.research", "r.province", "r.city", "r.district",
|
||||
"r.examine_status", "t.province AS tenant_province", "t.city AS tenant_city").
|
||||
"r.examine_status", "t.province AS tenant_province", "t.city AS tenant_city", "r.created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON r.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Where("r.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
|
Reference in New Issue
Block a user