feat:优化项目信息
This commit is contained in:
@ -43,7 +43,7 @@ type (
|
||||
}
|
||||
// patentForm 专利参数
|
||||
patentForm struct {
|
||||
Kind int `json:"kind" form:"kind" binding:"kind"`
|
||||
Kind int `json:"kind" form:"kind" binding:"required"`
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
FileUrl string `json:"file_url" form:"file_url"`
|
||||
ApplyCode string `json:"apply_code" form:"apply_code" binding:"required"`
|
||||
@ -56,7 +56,7 @@ type (
|
||||
Inventor string `json:"inventor" form:"inventor"`
|
||||
PrincipalClaim string `json:"principal_claim" form:"principal_claim"`
|
||||
Description string `json:"description" form:"description"`
|
||||
Status int `json:"status" form:"status" binding:"status"`
|
||||
Status int `json:"status" form:"status"`
|
||||
}
|
||||
// demandForm 需求参数
|
||||
demandForm struct {
|
||||
|
@ -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 != "" {
|
||||
|
@ -52,7 +52,7 @@ func (m *TechnologyPatent) IsExistParams(params map[string]interface{}) (bool, e
|
||||
|
||||
if len(params) > 0 {
|
||||
for k, v := range params {
|
||||
db = db.Or(fmt.Sprintf("%s = %v AND is_deleted = %d", k, v, model.DeleteStatusForNot))
|
||||
db = db.Or(fmt.Sprintf("'%s' = '%v' AND is_deleted = %d", k, v, model.DeleteStatusForNot))
|
||||
}
|
||||
}
|
||||
err := db.Count(&count).Error
|
||||
|
@ -18,14 +18,15 @@ type TechnologyPatentExpertInfo struct {
|
||||
ApplyCode string `json:"apply_code"`
|
||||
ApplyName string `json:"apply_name"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
Inventor string `json:"inventor"`
|
||||
Status model.TechnologyPatentStatus `json:"status"`
|
||||
CreatedAt time.Time
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// Patent 专利信息
|
||||
func (m *TechnologyPatentExpert) Patent(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyPatentExpertInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("p.id", "p.title", "p.apply_code", "p.apply_name", "p.apply_at", "p.status", "p.created_at").
|
||||
Select("p.id", "p.title", "p.apply_code", "p.apply_name", "p.apply_at", "p.inventor", "p.status", "p.created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS p ON u.patent_id = p.id", model.NewTechnologyPatent().TableName())).
|
||||
Where("u.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
|
1
app/api/enterprise/model/user_patent.go
Normal file
1
app/api/enterprise/model/user_patent.go
Normal file
@ -0,0 +1 @@
|
||||
package model
|
Reference in New Issue
Block a user