feat:完善用户专利数据模型

This commit is contained in:
henry
2021-11-29 13:31:33 +08:00
parent dabb567d41
commit fb5a3d910b
9 changed files with 298 additions and 266 deletions

View File

@ -7,6 +7,7 @@ import (
"SciencesServer/app/session"
"SciencesServer/utils"
"strings"
"time"
)
// Patent 专利信息
@ -19,9 +20,14 @@ type PatentHandle func(session *session.Enterprise) *Patent
type (
// PatentInfo 专利信息
PatentInfo struct {
ID string `json:"id"`
Kind model2.SysParentKind `json:"kind"`
Title string `json:"title"`
ID string `json:"id"`
Kind model2.SysParentKind `json:"kind"`
Title string `json:"title"`
ApplyName string `json:"apply_name"`
ApplyCode string `json:"apply_code"`
ApplyAt string `json:"apply_at"`
Inventor string `json:"inventor"`
CreatedAt time.Time `json:"created_at"`
}
)
@ -36,7 +42,10 @@ func (c *Patent) filter(src string) string {
func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page, pageSize int) (*controller.ReturnPages, error) {
mSysPatent := model.NewSysPatent()
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{Order: model2.NewOrder("id", model2.OrderModeToDesc)}}
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
Where: model2.NewWhere("shelf", model2.ShelfStatusForUp),
Order: model2.NewOrder("id", model2.OrderModeToDesc),
}}
if kind <= 0 {
where = append(where, &model2.ModelWhereOrder{
@ -67,7 +76,7 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
var count int64
if err := model2.Pages(mSysPatent.SysPatent, &out, page, pageSize, &count); err != nil {
if err := model2.PagesFields(mSysPatent.SysPatent, &out, []string{"id", "title", "apply_code", "apply_name", "apply_at", "created_at"}, page, pageSize, &count); err != nil {
return nil, err
}
@ -75,14 +84,14 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
for _, v := range out {
list = append(list, &PatentInfo{
ID: v.GetEncodeID(),
Kind: v.Kind,
Title: v.Title,
ID: v.GetEncodeID(), Kind: v.Kind, Title: v.Title,
ApplyName: v.ApplyName, ApplyCode: v.ApplyCode, ApplyAt: v.ApplyAt,
CreatedAt: v.CreatedAt,
})
v.ApplyName = c.filter(v.ApplyName)
v.ApplyAddress = c.filter(v.ApplyAddress)
v.Inventor = c.filter(v.Inventor)
v.Description = c.filter(v.Description)
//v.ApplyName = c.filter(v.ApplyName)
//v.ApplyAddress = c.filter(v.ApplyAddress)
//v.Inventor = c.filter(v.Inventor)
//v.Description = c.filter(v.Description)
}
return &controller.ReturnPages{
Data: out,
@ -90,6 +99,10 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
}, nil
}
func (c *Patent) Select() {
}
func NewPatent() PatentHandle {
return func(session *session.Enterprise) *Patent {
return &Patent{Enterprise: session}