feat:完善信息

This commit is contained in:
henry
2022-03-08 13:56:34 +08:00
parent 6f265db820
commit 8eeab34c34
4 changed files with 81 additions and 0 deletions

View File

@ -19,6 +19,10 @@ type Paper struct {
type PaperHandle func(session *session.Enterprise, tenantID uint64) *Paper
type (
PaperBasic struct {
ID string `json:"id"`
Title string `json:"title"`
}
PaperInfo struct {
ID string `json:"id"`
*model2.TechnologyPaper
@ -60,6 +64,27 @@ func (c *Paper) List(title string, page, pageSize int) (*controller.ReturnPages,
return &controller.ReturnPages{Data: list, Count: count}, nil
}
func (c *Paper) Select(title string) ([]*PaperBasic, error) {
mTechnologyPaper := model.NewTechnologyPaper()
where := make([]*model2.ModelWhereOrder, 0)
if title != "" {
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhereLike("title", title)})
}
out := make([]*model2.TechnologyPaper, 0)
if err := model2.ScanFields(mTechnologyPaper.TechnologyPaper, &out, []string{"id", "title"}, where...); err != nil {
return nil, err
}
list := make([]*PaperBasic, 0)
for _, v := range out {
list = append(list, &PaperBasic{ID: v.GetEncodeID(), Title: v.Title})
}
return list, nil
}
// Form 参数信息
func (c *Paper) Form(params *PaperParams) error {
mTechnologyPaper := model.NewTechnologyPaper()