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"
|
2022-06-02 17:41:11 +08:00
|
|
|
"mayfly-go/pkg/model"
|
2021-06-07 17:22:07 +08:00
|
|
|
)
|
|
|
|
|
|
2024-01-21 22:52:20 +08:00
|
|
|
type AccountRepoImpl struct {
|
2023-10-26 17:15:49 +08:00
|
|
|
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 {
|
2024-01-21 22:52:20 +08:00
|
|
|
return &AccountRepoImpl{base.RepoImpl[*entity.Account]{M: new(entity.Account)}}
|
2023-07-24 22:36:07 +08:00
|
|
|
}
|
|
|
|
|
|
2024-02-29 22:12:50 +08:00
|
|
|
func (m *AccountRepoImpl) GetPageList(condition *entity.AccountQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
|
2024-04-28 23:45:57 +08:00
|
|
|
qd := model.NewCond().
|
2023-07-01 14:34:42 +08:00
|
|
|
Like("name", condition.Name).
|
2024-02-29 22:12:50 +08:00
|
|
|
Like("username", condition.Username).
|
|
|
|
|
In("id", condition.Ids)
|
2024-05-05 14:53:30 +08:00
|
|
|
return m.PageByCondToAny(qd, pageParam, toEntity)
|
2021-07-28 18:03:19 +08:00
|
|
|
}
|