@@ -23,9 +23,9 @@ func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListR
2323 total uint
2424 )
2525 if len (req .TagIds ) > 0 {
26- data , total , err = listByTagIds (ctx , req )
26+ data , total , err = c . listByTagIds (ctx , req )
2727 } else {
28- data , total , err = listByBookId (ctx , req )
28+ data , total , err = c . listByBookId (ctx , req )
2929 }
3030
3131 if err != nil {
@@ -46,7 +46,7 @@ func (c *ControllerV1) List(ctx context.Context, req *v1.ListReq) (res *v1.ListR
4646 }, nil
4747}
4848
49- func listByTagIds (ctx context.Context , req * v1.ListReq ) (data []entity.Sentence , total uint , err error ) {
49+ func ( c * ControllerV1 ) listByTagIds (ctx context.Context , req * v1.ListReq ) (data []entity.Sentence , total uint , err error ) {
5050 var ids []model.Id
5151 ids , total , err = sentence .GetIdsByTagIds (ctx , req .TagIds , * req .Paging )
5252 if err != nil {
@@ -65,7 +65,7 @@ func listByTagIds(ctx context.Context, req *v1.ListReq) (data []entity.Sentence,
6565 return
6666}
6767
68- func listByBookId (ctx context.Context , req * v1.ListReq ) (data []entity.Sentence , total uint , err error ) {
68+ func ( c * ControllerV1 ) listByBookId (ctx context.Context , req * v1.ListReq ) (data []entity.Sentence , total uint , err error ) {
6969 query := & model.SentenceQuery {
7070 Paging : * req .Paging ,
7171 BookId : req .BookId ,
@@ -74,3 +74,13 @@ func listByBookId(ctx context.Context, req *v1.ListReq) (data []entity.Sentence,
7474 data , total , err = sentence .List (ctx , query )
7575 return
7676}
77+
78+ func (c * ControllerV1 ) listBySearch (ctx context.Context , req * v1.ListReq ) (data []entity.Sentence , total uint , err error ) {
79+ query := & model.SentenceQuery {
80+ Paging : * req .Paging ,
81+ Search : req .Search ,
82+ }
83+
84+ data , total , err = sentence .List (ctx , query )
85+ return
86+ }
0 commit comments