feat:优化项目信息
This commit is contained in:
@ -237,53 +237,48 @@ func (c *Expert) Patent(id uint64, title, applyName string) ([]*ExpertPatent, er
|
||||
}
|
||||
|
||||
// PatentBind 专利认领绑定
|
||||
func (c *Expert) PatentBind(id uint64, patentID []uint64) error {
|
||||
mUserExpert := model.NewUserExpert()
|
||||
func (c *Expert) PatentBind(id uint64, patentIDs []uint64) error {
|
||||
mManageExpert := model.NewManageExpert()
|
||||
mManageExpert.ID = id
|
||||
|
||||
uids := make([]uint64, 0)
|
||||
|
||||
err := model2.Pluck(mUserExpert.UserExpert, "uid", &uids, model2.NewWhere("expert_id", id),
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot))
|
||||
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "tenant_id"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,专家信息不存在或已被删除")
|
||||
} else if c.TenantID > 0 && c.TenantID != mManageExpert.TenantID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
if len(uids) <= 0 {
|
||||
return nil
|
||||
}
|
||||
data := make([]*model2.UserPatent, 0)
|
||||
data := make([]*model2.TechnologyPatentExpert, 0)
|
||||
|
||||
for _, uid := range uids {
|
||||
for _, v := range patentID {
|
||||
data = append(data, &model2.UserPatent{
|
||||
UID: uid,
|
||||
PatentID: v,
|
||||
})
|
||||
}
|
||||
for _, v := range patentIDs {
|
||||
data = append(data, &model2.TechnologyPatentExpert{
|
||||
ExpertID: mManageExpert.ID, PatentID: v,
|
||||
})
|
||||
}
|
||||
if len(data) > 0 {
|
||||
return model2.Creates(model.NewUserPatent().UserPatent, data)
|
||||
return model2.Creates(model.NewTechnologyPatentExpert().TechnologyPatentExpert, data)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PatentUnbind 专利认领解绑
|
||||
func (c *Expert) PatentUnbind(id uint64, patentID []uint64) error {
|
||||
mUserExpert := model.NewUserExpert()
|
||||
mManageExpert := model.NewManageExpert()
|
||||
mManageExpert.ID = id
|
||||
|
||||
uids := make([]uint64, 0)
|
||||
|
||||
err := model2.Pluck(mUserExpert.UserExpert, "uid", &uids, model2.NewWhere("expert_id", id),
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot))
|
||||
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "tenant_id"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,专家信息不存在或已被删除")
|
||||
} else if c.TenantID > 0 && c.TenantID != mManageExpert.TenantID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
if len(uids) <= 0 {
|
||||
return nil
|
||||
}
|
||||
return model2.DeleteWhere(model.NewUserPatent().UserPatent, []*model2.ModelWhere{
|
||||
model2.NewWhereIn("uid", uids),
|
||||
return model2.DeleteWhere(model.NewTechnologyPatentExpert().TechnologyPatentExpert, []*model2.ModelWhere{
|
||||
model2.NewWhere("expert_id", mManageExpert.ID),
|
||||
model2.NewWhereIn("patent_id", patentID),
|
||||
})
|
||||
}
|
||||
|
@ -299,9 +299,9 @@ func (c *Patent) Delete(id uint64) error {
|
||||
if err = model2.Delete(mTechnologyPatent.TechnologyPatent, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mUserPatent := model.NewUserPatent()
|
||||
mTechnologyPatentExpert := model.NewTechnologyPatentExpert()
|
||||
|
||||
if err = model2.DeleteWhere(mUserPatent.UserPatent, []*model2.ModelWhere{
|
||||
if err = model2.DeleteWhere(mTechnologyPatentExpert.TechnologyPatentExpert, []*model2.ModelWhere{
|
||||
model2.NewWhere("patent_id", id),
|
||||
model2.NewWhere("is_deleted", model2.DeleteStatusForNot),
|
||||
}, tx); err != nil {
|
||||
|
@ -99,14 +99,6 @@ func (m *ManageExpert) Experts(page, pageSize int, count *int64, where ...*model
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON e.research_id = r.id", model.NewManageResearch().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS l ON e.laboratory_id = l.id", model.NewManageLaboratory().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON e.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT u.expert_id, SUM(t_a.count) AS achievement_count, SUM(p.count) AS patent_count FROM %s AS u "+
|
||||
"LEFT JOIN (SELECT uid, COUNT(id) AS count FROM %s WHERE is_deleted = %d AND status = %d GROUP BY uid) AS t_a ON u.uid = t_a.uid "+
|
||||
"LEFT JOIN (SELECT uid, COUNT(id) AS count FROM %s WHERE is_deleted = %d GROUP BY uid) AS p ON u.uid = p.uid "+
|
||||
"WHERE u.is_deleted = %d AND u.invalid_status = %d GROUP BY u.expert_id) AS u ON e.id = u.expert_id",
|
||||
model.NewUserExpert().TableName(),
|
||||
model.NewTechnologyAchievement().TableName(), model.DeleteStatusForNot, model.TechnologyStatusKindForAgree,
|
||||
model.NewUserPatent().TableName(), model.DeleteStatusForNot,
|
||||
model.DeleteStatusForNot, model.InvalidStatusForNot)).
|
||||
Where("e.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
@ -131,7 +123,7 @@ func (m *ManageExpert) Patents(where ...*model.ModelWhere) ([]*ManageExpertPaten
|
||||
db := orm.GetDB().Table(model.NewTechnologyPatent().TableName()+" AS p").
|
||||
Select("p.id", "p.title", "p.apply_name", "p.apply_code", "p.apply_at", "p.inventor", "u.count AS user_patent_count").
|
||||
Joins(fmt.Sprintf("LEFT JOIN (SELECT patent_id, COUNT(patent_id) AS count FROM %s WHERE is_deleted = %d GROUP BY patent_id) AS u ON p.id = u.patent_id",
|
||||
model.NewUserPatent().TableName(), model.DeleteStatusForNot)).
|
||||
model.NewTechnologyPatentExpert().TableName(), model.DeleteStatusForNot)).
|
||||
Where("p.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
|
12
app/api/admin/model/technology_patent_expert.go
Normal file
12
app/api/admin/model/technology_patent_expert.go
Normal file
@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
// TechnologyPatentExpert 专利专家信息
|
||||
type TechnologyPatentExpert struct {
|
||||
*model.TechnologyPatentExpert
|
||||
}
|
||||
|
||||
func NewTechnologyPatentExpert() *TechnologyPatentExpert {
|
||||
return &TechnologyPatentExpert{model.NewTechnologyPatentExpert()}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
// UserPatent 用户专利信息
|
||||
type UserPatent struct {
|
||||
*model.UserPatent
|
||||
}
|
||||
|
||||
func NewUserPatent() *UserPatent {
|
||||
return &UserPatent{model.NewUserPatent()}
|
||||
}
|
@ -25,7 +25,7 @@ type (
|
||||
// PatentInfo 专利信息
|
||||
PatentInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.UserPatentInfo
|
||||
*model.TechnologyPatentExpertInfo
|
||||
}
|
||||
// PatentMatchInfo 专利匹配信息
|
||||
PatentMatchInfo struct {
|
||||
@ -83,13 +83,23 @@ func (c *PatentParams) add(tenantID, uid uint64) error {
|
||||
if err = model2.Create(mTechnologyPatent.TechnologyPatent, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mUserPatent := model.NewUserPatent()
|
||||
mUserPatent.UID = uid
|
||||
mUserPatent.PatentID = mTechnologyPatent.ID
|
||||
// 查询当前的专家信息
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
if err = model2.Create(mUserPatent.UserPatent, tx); err != nil {
|
||||
if isExist, err = model2.FirstField(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
|
||||
|
||||
if err = model2.Create(mTechnologyPatentExpert.TechnologyPatentExpert, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
manage := service.NewESPatent(
|
||||
service.WithPatentID(mTechnologyPatent.ID),
|
||||
service.WithPatentTitle(mTechnologyPatent.Title),
|
||||
@ -116,20 +126,31 @@ func (c *PatentParams) add(tenantID, uid uint64) error {
|
||||
|
||||
// edit 删除专利信息
|
||||
func (c *PatentParams) edit(uid uint64) error {
|
||||
mUserPatent := model.NewUserPatent()
|
||||
mUserPatent.ID = c.ID
|
||||
mTechnologyPatentExpert := model.NewTechnologyPatentExpert()
|
||||
mTechnologyPatentExpert.ID = c.ID
|
||||
|
||||
isExist, err := model2.FirstField(mUserPatent.UserPatent, []string{"id", "uid", "patent_id"})
|
||||
isExist, err := model2.FirstField(mTechnologyPatentExpert.TechnologyPatentExpert, []string{"id", "expert_id", "patent_id"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,用户专利信息不存在或已被删除")
|
||||
} else if mUserPatent.UID != uid {
|
||||
}
|
||||
// 查询当前用户是否存在对应的专家信息
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
var count int64
|
||||
|
||||
if err = model2.Count(mUserExpert.UserExpert, &count, model2.NewWhere("uid", uid),
|
||||
model2.NewWhere("expert_id", mTechnologyPatentExpert.ExpertID),
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot),
|
||||
); err != nil {
|
||||
return err
|
||||
} else if count > 0 {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
mTechnologyPatent := model.NewTechnologyPatent()
|
||||
mTechnologyPatent.ID = mUserPatent.PatentID
|
||||
mTechnologyPatent.ID = mTechnologyPatentExpert.PatentID
|
||||
|
||||
if isExist, err = model2.FirstField(mTechnologyPatent.TechnologyPatent, []string{"id", "apply_code", "open_code", "created_at"}); err != nil {
|
||||
return err
|
||||
@ -180,9 +201,21 @@ func (c *PatentParams) edit(uid uint64) error {
|
||||
|
||||
// List 列表信息
|
||||
func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mUserPatent := model.NewUserPatent()
|
||||
// 查询当前用户对应的专家信息
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
where := []*model2.ModelWhere{model2.NewWhere("u.uid", c.UID)}
|
||||
isExist, err := model2.LastWhere(mUserExpert.UserExpert, []string{"id", "expert_id"},
|
||||
model2.NewWhere("uid", c.UID),
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !isExist {
|
||||
return nil, nil
|
||||
}
|
||||
mTechnologyPatentExpert := model.NewTechnologyPatentExpert()
|
||||
|
||||
where := []*model2.ModelWhere{model2.NewWhere("u.expert_id", mUserExpert.ExpertID)}
|
||||
|
||||
if kind <= 0 {
|
||||
where = append(where, model2.NewWhere("p.kind", kind))
|
||||
@ -201,16 +234,16 @@ func (c *Patent) List(kind int, title, applyCode, openCode, ipcCode string, page
|
||||
}
|
||||
var count int64
|
||||
|
||||
out, err := mUserPatent.Patent(page, pageSize, &count, where...)
|
||||
out := make([]*model.TechnologyPatentExpertInfo, 0)
|
||||
|
||||
if err != nil {
|
||||
if out, err = mTechnologyPatentExpert.Patent(page, pageSize, &count, where...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list := make([]*PatentInfo, 0)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &PatentInfo{
|
||||
ID: v.GetEncodeID(), UserPatentInfo: v,
|
||||
ID: v.GetEncodeID(), TechnologyPatentExpertInfo: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
@ -281,20 +314,18 @@ func (c *Patent) Form(params *PatentParams) error {
|
||||
|
||||
// Delete 删除操作
|
||||
func (c *Patent) Delete(id uint64) error {
|
||||
mUserPatent := model.NewUserPatent()
|
||||
mUserPatent.ID = id
|
||||
mTechnologyPatentExpert := model.NewTechnologyPatentExpert()
|
||||
mTechnologyPatentExpert.ID = id
|
||||
|
||||
isExist, err := model2.FirstField(mUserPatent.UserPatent, []string{"id", "uid", "patent_id"})
|
||||
isExist, err := model2.FirstField(mTechnologyPatentExpert.TechnologyPatentExpert, []string{"id", "patent_id"})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("操作错误,用户专利信息不存在或已被删除")
|
||||
} else if mUserPatent.UID != c.UID {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
// 只删除关联关系
|
||||
if err = model2.Delete(mUserPatent.UserPatent); err != nil {
|
||||
if err = model2.Delete(mTechnologyPatentExpert.TechnologyPatentExpert); err != nil {
|
||||
return err
|
||||
}
|
||||
//mTechnologyPatent := model.NewTechnologyPatent()
|
||||
|
@ -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()}
|
||||
}
|
@ -33,7 +33,7 @@ type (
|
||||
// PatentInfo 专利信息
|
||||
PatentInfo struct {
|
||||
ID string `json:"id"`
|
||||
*model.UserPatentInfo
|
||||
*model.TechnologyPatentExpertInfo
|
||||
}
|
||||
// PaperInfo 论文信息
|
||||
PaperInfo struct {
|
||||
@ -122,11 +122,12 @@ func project(uids []uint64, page, pageSize int) (*controller.ReturnPages, error)
|
||||
|
||||
// patent 专利信息
|
||||
func patent(uids []uint64, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
mUserPatent := model.NewUserPatent()
|
||||
// 查询用户的专利信息
|
||||
mTechnologyPatentExpert := model.NewTechnologyPatentExpert()
|
||||
|
||||
var count int64
|
||||
|
||||
out, err := mUserPatent.Patents(uids, page, pageSize, &count)
|
||||
out, err := mTechnologyPatentExpert.Patents(uids, page, pageSize, &count)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -135,7 +136,7 @@ func patent(uids []uint64, page, pageSize int) (*controller.ReturnPages, error)
|
||||
|
||||
for _, v := range out {
|
||||
list = append(list, &PatentInfo{
|
||||
ID: v.GetEncodeID(), UserPatentInfo: v,
|
||||
ID: v.GetEncodeID(), TechnologyPatentExpertInfo: v,
|
||||
})
|
||||
}
|
||||
return &controller.ReturnPages{Data: list, Count: count}, nil
|
||||
|
@ -26,11 +26,9 @@ func (m *ManageExpert) Expert(limit int, where ...*model.ModelWhere) ([]*ManageE
|
||||
db := orm.GetDB().Table(m.TableName()+" AS e").
|
||||
Select("e.id", "e.name", "e.industry", "e.image", "e.school", "e.major", "e.keyword",
|
||||
"p.title AS patent_title", "r.name AS research_name").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
|
||||
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT uid, SUBSTRING_INDEX(GROUP_CONCAT(kind, '$$', title ORDER BY id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||
FROM %s WHERE is_deleted = %d AND shelf_status = %d GROUP BY uid) AS p ON e_u.uid = p.uid`,
|
||||
limit, mTechnologyPatent.TableName(), model.DeleteStatusForNot, model.ShelfStatusForUp)).
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.expert_id, SUBSTRING_INDEX(GROUP_CONCAT(p.kind, '$$', p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d GROUP BY u.expert_id) AS p ON e.id = p.expert_id`,
|
||||
limit, model.NewTechnologyPatentExpert().TableName(), mTechnologyPatent.TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON e.research_id = r.id", model.NewManageResearch().TableName())).
|
||||
Where("e.examine_status = ?", model.ExamineStatusForAgree).
|
||||
Where("e.is_deleted = ?", model.DeleteStatusForNot)
|
||||
@ -56,11 +54,9 @@ func (m *ManageExpert) Detail(limit int, id uint64) (*ManageExpertInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS e").
|
||||
Select("e.id", "e.name", "e.industry", "e.image", "e.school", "e.major", "e.keyword", "e.research",
|
||||
"e.introduce", "p.title AS patent_title", "r.name AS research_name").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS e_u ON e.id = e_u.expert_id AND e_u.invalid_status = %d AND e_u.is_deleted = %d",
|
||||
model.NewUserExpert().TableName(), model.InvalidStatusForNot, model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.uid, SUBSTRING_INDEX(GROUP_CONCAT(p.kind, '$$', p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d GROUP BY u.uid) AS p ON e_u.uid = p.uid`,
|
||||
limit, model.NewUserPatent().TableName(), mTechnologyPatent.TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf(`LEFT JOIN (SELECT u.expert_id, SUBSTRING_INDEX(GROUP_CONCAT(p.kind, '$$', p.title ORDER BY p.id DESC SEPARATOR '&&'), '&&', %d) AS title
|
||||
FROM %s AS u LEFT JOIN %s AS p ON u.patent_id = p.id WHERE u.is_deleted = %d GROUP BY u.expert_id) AS p ON e.id = p.expert_id`,
|
||||
limit, model.NewTechnologyPatentExpert().TableName(), mTechnologyPatent.TableName(), model.DeleteStatusForNot)).
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS r ON e.research_id = r.id", model.NewManageResearch().TableName())).
|
||||
Where("e.id = ?", id)
|
||||
|
||||
|
@ -7,11 +7,11 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type UserPatent struct {
|
||||
*model.UserPatent
|
||||
type TechnologyPatentExpert struct {
|
||||
*model.TechnologyPatentExpert
|
||||
}
|
||||
|
||||
type UserPatentInfo struct {
|
||||
type TechnologyPatentExpertInfo struct {
|
||||
model.Model
|
||||
Title string `json:"title"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
@ -19,7 +19,7 @@ type UserPatentInfo struct {
|
||||
}
|
||||
|
||||
// Patents 专利信息
|
||||
func (m *UserPatent) Patents(uid []uint64, page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*UserPatentInfo, error) {
|
||||
func (m *TechnologyPatentExpert) Patents(uid []uint64, page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyPatentExpertInfo, error) {
|
||||
_uids := make([]string, 0)
|
||||
|
||||
for _, u := range uid {
|
||||
@ -36,7 +36,7 @@ func (m *UserPatent) Patents(uid []uint64, page, pageSize int, count *int64, whe
|
||||
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
|
||||
@ -47,6 +47,6 @@ func (m *UserPatent) Patents(uid []uint64, page, pageSize int, count *int64, whe
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewUserPatent() *UserPatent {
|
||||
return &UserPatent{model.NewUserPatent()}
|
||||
func NewTechnologyPatentExpert() *TechnologyPatentExpert {
|
||||
return &TechnologyPatentExpert{model.NewTechnologyPatentExpert()}
|
||||
}
|
18
app/common/model/technology_patent_expert.go
Normal file
18
app/common/model/technology_patent_expert.go
Normal file
@ -0,0 +1,18 @@
|
||||
package model
|
||||
|
||||
// TechnologyPatentExpert 专利专家数据模型
|
||||
type TechnologyPatentExpert struct {
|
||||
Model
|
||||
ExpertID uint64 `gorm:"column:expert_id;type:int(11);default:0;comment:专家ID" json:"-"`
|
||||
PatentID uint64 `gorm:"column:patent_id;type:int(11);default:0;comment:专利ID" json:"-"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *TechnologyPatentExpert) TableName() string {
|
||||
return "technology_patent_expert"
|
||||
}
|
||||
|
||||
func NewTechnologyPatentExpert() *TechnologyPatentExpert {
|
||||
return &TechnologyPatentExpert{}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package model
|
||||
|
||||
// UserPatent 用户专利信息
|
||||
type UserPatent struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
PatentID uint64 `gorm:"column:patent_id;type:int(11);default:0;comment:专利ID" json:"patent_id"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *UserPatent) TableName() string {
|
||||
return "user_patent"
|
||||
}
|
||||
|
||||
func NewUserPatent() *UserPatent {
|
||||
return &UserPatent{}
|
||||
}
|
Reference in New Issue
Block a user