feat:优化项目信息
This commit is contained in:
@ -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