feat:优化项目信息
This commit is contained in:
@ -7,12 +7,12 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type UserPatent struct {
|
||||
*model.UserPatent
|
||||
type TechnologyPatentExpert struct {
|
||||
*model.TechnologyPatentExpert
|
||||
}
|
||||
|
||||
// UserPatentInfo 用户专利信息
|
||||
type UserPatentInfo struct {
|
||||
// TechnologyPatentExpertInfo 用户专利信息
|
||||
type TechnologyPatentExpertInfo struct {
|
||||
model.Model
|
||||
Title string `json:"title"`
|
||||
ApplyCode string `json:"apply_code"`
|
||||
@ -24,7 +24,7 @@ type UserPatentInfo struct {
|
||||
}
|
||||
|
||||
// Patent 专利信息
|
||||
func (m *UserPatent) Patent(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*UserPatentInfo, error) {
|
||||
func (m *TechnologyPatentExpert) Patent(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyPatentExpertInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id", "p.title", "p.apply_code", "p.apply_name", "p.apply_at", "p.status", "p.created_at").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS p ON u.patent_id = p.id", model.NewTechnologyPatent().TableName())).
|
||||
@ -35,7 +35,7 @@ func (m *UserPatent) Patent(page, pageSize int, count *int64, where ...*model.Mo
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*UserPatentInfo, 0)
|
||||
out := make([]*TechnologyPatentExpertInfo, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
@ -46,6 +46,6 @@ func (m *UserPatent) Patent(page, pageSize int, count *int64, where ...*model.Mo
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewUserPatent() *UserPatent {
|
||||
return &UserPatent{model.NewUserPatent()}
|
||||
func NewTechnologyPatentExpert() *TechnologyPatentExpert {
|
||||
return &TechnologyPatentExpert{model.NewTechnologyPatentExpert()}
|
||||
}
|
Reference in New Issue
Block a user