2021-06-07 17:22:07 +08:00
|
|
|
package persistence
|
|
|
|
|
|
|
|
|
|
import (
|
2022-06-02 17:41:11 +08:00
|
|
|
"mayfly-go/internal/sys/domain/entity"
|
|
|
|
|
"mayfly-go/internal/sys/domain/repository"
|
2023-10-26 17:15:49 +08:00
|
|
|
"mayfly-go/pkg/base"
|
2023-07-01 14:34:42 +08:00
|
|
|
"mayfly-go/pkg/gormx"
|
2022-06-02 17:41:11 +08:00
|
|
|
"mayfly-go/pkg/model"
|
2021-06-07 17:22:07 +08:00
|
|
|
)
|
|
|
|
|
|
2023-10-26 17:15:49 +08:00
|
|
|
type accountRepoImpl struct {
|
|
|
|
|
base.RepoImpl[*entity.Account]
|
2022-09-09 18:26:08 +08:00
|
|
|
}
|
2021-06-07 17:22:07 +08:00
|
|
|
|
2023-10-26 17:15:49 +08:00
|
|
|
func newAccountRepo() repository.Account {
|
|
|
|
|
return &accountRepoImpl{base.RepoImpl[*entity.Account]{M: new(entity.Account)}}
|
2023-07-24 22:36:07 +08:00
|
|
|
}
|
|
|
|
|
|
2023-10-26 17:15:49 +08:00
|
|
|
func (m *accountRepoImpl) GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
|
2023-07-01 14:34:42 +08:00
|
|
|
qd := gormx.NewQuery(new(entity.Account)).
|
|
|
|
|
Like("name", condition.Name).
|
|
|
|
|
Like("username", condition.Username)
|
|
|
|
|
return gormx.PageQuery(qd, pageParam, toEntity)
|
2021-07-28 18:03:19 +08:00
|
|
|
}
|