完善功能
This commit is contained in:
29
internal/controller/book/book_v1_list.go
Normal file
29
internal/controller/book/book_v1_list.go
Normal file
@ -0,0 +1,29 @@
|
||||
package book
|
||||
|
||||
import (
|
||||
"context"
|
||||
v1 "server/api/book/v1"
|
||||
"server/internal/model"
|
||||
"server/internal/service"
|
||||
)
|
||||
|
||||
func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error) {
|
||||
out, err := service.Book().List(ctx, &model.BookListIn{
|
||||
Page: req.Page,
|
||||
Size: req.Size,
|
||||
Title: req.Title,
|
||||
CategoryId: req.CategoryId,
|
||||
AuthorId: req.AuthorId,
|
||||
Status: req.Status,
|
||||
IsRecommended: req.IsRecommended,
|
||||
Sort: req.Sort,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &v1.ListRes{
|
||||
Total: out.Total,
|
||||
List: out.List,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user