feat:完善项目
This commit is contained in:
@ -77,14 +77,14 @@ func (c *Equipment) tree(iModel model2.IModel, src []*model2.ManageEquipment, pa
|
||||
}
|
||||
|
||||
// List 列表信息
|
||||
func (c *Equipment) List(parentID uint64, title string) ([]*EquipmentInfo, error) {
|
||||
func (c *Equipment) List(parentID uint64, title string, page, pageSize int) (*basic.PageDataResponse, error) {
|
||||
mManageEquipment := model.NewManageEquipment()
|
||||
|
||||
out := make([]*model2.ManageEquipment, 0)
|
||||
|
||||
where := []*model2.ModelWhereOrder{
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("parentID", parentID),
|
||||
Where: model2.NewWhere("parent_id", parentID),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
},
|
||||
}
|
||||
@ -93,11 +93,20 @@ func (c *Equipment) List(parentID uint64, title string) ([]*EquipmentInfo, error
|
||||
Where: model2.NewWhereLike("title", title),
|
||||
})
|
||||
}
|
||||
if err := model2.ScanFields(mManageEquipment.ManageEquipment, &out, []string{"id", "code", "title", "image", "created_at"},
|
||||
where...); err != nil {
|
||||
//if err := model2.ScanFields(mManageEquipment.ManageEquipment, &out, []string{"id", "code", "title", "image", "created_at"},
|
||||
// where...); err != nil {
|
||||
// return nil, err
|
||||
//}
|
||||
var count int64
|
||||
|
||||
if err := model2.PagesFields(mManageEquipment.ManageEquipment, &out, []string{"id", "code", "title", "image", "created_at"},
|
||||
page, pageSize, &count, where...); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.tree(mManageEquipment.ManageEquipment, out, 0), nil
|
||||
return &basic.PageDataResponse{
|
||||
Data: c.tree(mManageEquipment.ManageEquipment, out, 0),
|
||||
Count: count,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Detail 详细信息
|
||||
|
Reference in New Issue
Block a user