feat:完善项目信息
This commit is contained in:
@ -1,11 +1,38 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
)
|
||||
|
||||
type TechnologyPaper struct {
|
||||
*model.TechnologyPaper
|
||||
}
|
||||
|
||||
type (
|
||||
TechnologyPaperInfo struct {
|
||||
model.Model
|
||||
}
|
||||
)
|
||||
|
||||
func (m *TechnologyPaper) Instance(where ...*model.ModelWhere) ([]*TechnologyPaperInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()).
|
||||
Where("p.shelf_status = ?", model.ShelfStatusForUp).
|
||||
Where("p.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if len(where) > 0 {
|
||||
for _, v := range where {
|
||||
db = db.Where(v.Condition, v.Value)
|
||||
}
|
||||
}
|
||||
out := make([]*TechnologyPaperInfo, 0)
|
||||
|
||||
if err := db.Scan(&out).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewTechnologyPaper() *TechnologyPaper {
|
||||
return &TechnologyPaper{model.NewTechnologyPaper()}
|
||||
}
|
||||
|
Reference in New Issue
Block a user