feat:优化项目信息
This commit is contained in:
@ -22,7 +22,8 @@ type (
|
||||
PaperInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model2.TechnologyPaper
|
||||
Tags []string `json:"tags"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
PaperParams struct {
|
||||
ID uint64
|
||||
@ -53,7 +54,8 @@ func (c *Paper) List(title string, page, pageSize int) (*controller.ReturnPages,
|
||||
list := make([]*PaperInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &PaperInfo{ID: v.GetEncodeID(), TechnologyPaper: v, Tags: v.GetTagAttribute()})
|
||||
list = append(list, &PaperInfo{ID: v.GetEncodeID(), TechnologyPaper: v, Keywords: v.GetKeywordAttribute(),
|
||||
Tags: v.GetTagAttribute()})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
}
|
||||
|
@ -65,6 +65,15 @@ func (c *PatentParams) add(tenantID, uid uint64) error {
|
||||
return errors.New("操作错误,申请号或公开(公告)号已存在")
|
||||
}
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 查询当前的专家信息
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
if isExist, err = model2.LastWhere(mUserExpert.UserExpert, []string{"id", "expert_id"}, model2.NewWhere("uid", uid),
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,无专家信息")
|
||||
}
|
||||
mTechnologyPatent.Kind = model2.TechnologyPatentKind(c.Kind)
|
||||
mTechnologyPatent.Title = c.Title
|
||||
mTechnologyPatent.FileUrl = c.FileUrl
|
||||
@ -83,15 +92,6 @@ func (c *PatentParams) add(tenantID, uid uint64) error {
|
||||
if err = model2.Create(mTechnologyPatent.TechnologyPatent, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
// 查询当前的专家信息
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
if isExist, err = model2.LastWhere(mUserExpert.UserExpert, []string{"id", "expert_id"}, model2.NewWhere("uid", uid),
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,无专家信息")
|
||||
}
|
||||
mTechnologyPatentExpert := model.NewTechnologyPatentExpert()
|
||||
mTechnologyPatentExpert.ExpertID = mUserExpert.ExpertID
|
||||
mTechnologyPatentExpert.PatentID = mTechnologyPatent.ID
|
||||
@ -215,7 +215,7 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
|
||||
|
||||
where := []*model2.ModelWhere{model2.NewWhereFindInSet("p.inventor", expert.Name)}
|
||||
|
||||
if kind <= 0 {
|
||||
if kind > 0 {
|
||||
where = append(where, model2.NewWhere("p.kind", kind))
|
||||
}
|
||||
if title != "" {
|
||||
|
Reference in New Issue
Block a user