feat:完善信息
This commit is contained in:
@ -239,6 +239,19 @@ func (a *Technology) Paper(c *gin.Context) {
|
|||||||
api.APIResponse(err, data)(c)
|
api.APIResponse(err, data)(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Technology) PaperSelect(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
Title string `json:"title" form:"title" binding:"required"`
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||||
|
Select(form.Title)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *Technology) PaperAdd(c *gin.Context) {
|
func (a *Technology) PaperAdd(c *gin.Context) {
|
||||||
form := new(paperForm)
|
form := new(paperForm)
|
||||||
|
|
||||||
@ -301,6 +314,19 @@ func (a *Technology) Patent(c *gin.Context) {
|
|||||||
api.APIResponse(err, data)(c)
|
api.APIResponse(err, data)(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Technology) PatentSelect(c *gin.Context) {
|
||||||
|
form := &struct {
|
||||||
|
Title string `json:"title" form:"title" binding:"required"`
|
||||||
|
}{}
|
||||||
|
if err := api.Bind(form)(c); err != nil {
|
||||||
|
api.APIFailure(err.(error))(c)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
data, err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||||
|
Select(form.Title)
|
||||||
|
api.APIResponse(err, data)(c)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *Technology) PatentDetail(c *gin.Context) {
|
func (a *Technology) PatentDetail(c *gin.Context) {
|
||||||
form := new(api.IDStringForm)
|
form := new(api.IDStringForm)
|
||||||
|
|
||||||
|
@ -19,6 +19,10 @@ type Paper struct {
|
|||||||
type PaperHandle func(session *session.Enterprise, tenantID uint64) *Paper
|
type PaperHandle func(session *session.Enterprise, tenantID uint64) *Paper
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
PaperBasic struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
PaperInfo struct {
|
PaperInfo struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
*model2.TechnologyPaper
|
*model2.TechnologyPaper
|
||||||
@ -60,6 +64,27 @@ func (c *Paper) List(title string, page, pageSize int) (*controller.ReturnPages,
|
|||||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Paper) Select(title string) ([]*PaperBasic, error) {
|
||||||
|
mTechnologyPaper := model.NewTechnologyPaper()
|
||||||
|
|
||||||
|
where := make([]*model2.ModelWhereOrder, 0)
|
||||||
|
|
||||||
|
if title != "" {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhereLike("title", title)})
|
||||||
|
}
|
||||||
|
out := make([]*model2.TechnologyPaper, 0)
|
||||||
|
|
||||||
|
if err := model2.ScanFields(mTechnologyPaper.TechnologyPaper, &out, []string{"id", "title"}, where...); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
list := make([]*PaperBasic, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &PaperBasic{ID: v.GetEncodeID(), Title: v.Title})
|
||||||
|
}
|
||||||
|
return list, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Form 参数信息
|
// Form 参数信息
|
||||||
func (c *Paper) Form(params *PaperParams) error {
|
func (c *Paper) Form(params *PaperParams) error {
|
||||||
mTechnologyPaper := model.NewTechnologyPaper()
|
mTechnologyPaper := model.NewTechnologyPaper()
|
||||||
|
@ -22,6 +22,10 @@ type Patent struct {
|
|||||||
type PatentHandle func(session *session.Enterprise, tenantID uint64) *Patent
|
type PatentHandle func(session *session.Enterprise, tenantID uint64) *Patent
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
PatentBasic struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
// PatentInfo 专利信息
|
// PatentInfo 专利信息
|
||||||
PatentInfo struct {
|
PatentInfo struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
@ -247,6 +251,30 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
|
|||||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Select 列表信息
|
||||||
|
func (c *Patent) Select(title string) ([]*PatentBasic, error) {
|
||||||
|
where := make([]*model2.ModelWhereOrder, 0)
|
||||||
|
|
||||||
|
if title != "" {
|
||||||
|
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhereLike("title", title)})
|
||||||
|
}
|
||||||
|
mTechnologyPatent := model.NewTechnologyPatent()
|
||||||
|
|
||||||
|
out := make([]*model2.TechnologyPatent, 0)
|
||||||
|
|
||||||
|
if err := model2.ScanFields(mTechnologyPatent.TechnologyPatent, &out, []string{"id", "title"}, where...); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
list := make([]*PatentBasic, 0)
|
||||||
|
|
||||||
|
for _, v := range out {
|
||||||
|
list = append(list, &PatentBasic{
|
||||||
|
ID: v.GetEncodeID(), Title: v.Title,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return list, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Match 搜索信息
|
// Match 搜索信息
|
||||||
func (c *Patent) Match(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
|
func (c *Patent) Match(title string, industrys, keywords []string) (*controller.ReturnPages, error) {
|
||||||
params := strings.Join([]string{
|
params := strings.Join([]string{
|
||||||
|
@ -522,10 +522,12 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
|||||||
{
|
{
|
||||||
_api := new(api3.Technology)
|
_api := new(api3.Technology)
|
||||||
technologyV1.POST("/paper", _api.Paper)
|
technologyV1.POST("/paper", _api.Paper)
|
||||||
|
technologyV1.POST("/paper/select", _api.PaperSelect)
|
||||||
technologyV1.POST("/paper/add", _api.PaperAdd)
|
technologyV1.POST("/paper/add", _api.PaperAdd)
|
||||||
technologyV1.POST("/paper/edit", _api.PaperEdit)
|
technologyV1.POST("/paper/edit", _api.PaperEdit)
|
||||||
technologyV1.POST("/paper/delete", _api.PaperDelete)
|
technologyV1.POST("/paper/delete", _api.PaperDelete)
|
||||||
technologyV1.POST("/patent", _api.Patent)
|
technologyV1.POST("/patent", _api.Patent)
|
||||||
|
technologyV1.POST("/patent/select", _api.PatentSelect)
|
||||||
technologyV1.POST("/patent/detail", _api.PatentDetail)
|
technologyV1.POST("/patent/detail", _api.PatentDetail)
|
||||||
technologyV1.POST("/patent/add", _api.PatentAdd)
|
technologyV1.POST("/patent/add", _api.PatentAdd)
|
||||||
technologyV1.POST("/patent/edit", _api.PatentEdit)
|
technologyV1.POST("/patent/edit", _api.PatentEdit)
|
||||||
|
Reference in New Issue
Block a user