feat:优化项目信息
This commit is contained in:
@ -12,15 +12,16 @@ type TechnologyPatent struct {
|
||||
*model.TechnologyPatent
|
||||
}
|
||||
|
||||
// SysPatentInfo 专利信息
|
||||
type SysPatentInfo struct {
|
||||
// TechnologyPatentInfo 专利信息
|
||||
type TechnologyPatentInfo struct {
|
||||
model.Model
|
||||
model.ModelTenant
|
||||
Title string `json:"title"`
|
||||
ApplyCode string `json:"apply_code"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
ApplyName string `json:"apply_name"`
|
||||
Inventor string `json:"inventor"`
|
||||
Kind model.TechnologyPatentKind `json:"kind"`
|
||||
Title string `json:"title"`
|
||||
ApplyCode string `json:"apply_code"`
|
||||
ApplyAt string `json:"apply_at"`
|
||||
ApplyName string `json:"apply_name"`
|
||||
Inventor string `json:"inventor"`
|
||||
model.Shelf
|
||||
UID uint64 `json:"-"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
@ -32,7 +33,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
|
||||
@ -40,17 +41,18 @@ func (m *TechnologyPatent) IsExistParams(params map[string]interface{}) (bool, e
|
||||
}
|
||||
|
||||
// Patent 专利信息
|
||||
func (m *TechnologyPatent) Patent(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*SysPatentInfo, error) {
|
||||
func (m *TechnologyPatent) Patent(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*TechnologyPatentInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS p").
|
||||
Select("p.id", "p.title", "p.apply_code", "p.inventor", "p.apply_name", "p.apply_at", "u.uid",
|
||||
"p.shelf_status", "p.created_at")
|
||||
Select("p.id", "p.kind", "p.title", "p.apply_code", "p.inventor", "p.apply_name", "p.apply_at",
|
||||
"p.shelf_status", "p.created_at").
|
||||
Where("p.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, wo := range where {
|
||||
db = db.Where(wo.Condition, wo.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*SysPatentInfo, 0)
|
||||
out := make([]*TechnologyPatentInfo, 0)
|
||||
|
||||
if err := db.Count(count).Error; err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user