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
|
|
|
)
|
|
|
|
|
|
2023-10-26 17:15:49 +08:00
|
|
|
type roleRepoImpl struct {
|
|
|
|
|
base.RepoImpl[*entity.Role]
|
|
|
|
|
}
|
2021-06-07 17:22:07 +08:00
|
|
|
|
2022-09-09 18:26:08 +08:00
|
|
|
func newRoleRepo() repository.Role {
|
2024-12-08 13:04:23 +08:00
|
|
|
return &roleRepoImpl{}
|
2022-09-09 18:26:08 +08:00
|
|
|
}
|
2021-06-07 17:22:07 +08:00
|
|
|
|
2025-05-20 21:04:47 +08:00
|
|
|
func (m *roleRepoImpl) GetPageList(condition *entity.RoleQuery, orderBy ...string) (*model.PageResult[*entity.Role], error) {
|
2024-04-28 23:45:57 +08:00
|
|
|
qd := model.NewCond().
|
2023-12-18 22:39:32 +08:00
|
|
|
Like("name", condition.Name).
|
|
|
|
|
Like("code", condition.Code).
|
|
|
|
|
In("id", condition.Ids).
|
|
|
|
|
NotIn("id", condition.NotIds).
|
2024-04-28 23:45:57 +08:00
|
|
|
OrderBy(orderBy...)
|
2025-05-20 21:04:47 +08:00
|
|
|
return m.PageByCond(qd, condition.PageParam)
|
2021-06-07 17:22:07 +08:00
|
|
|
}
|
|
|
|
|
|
2023-12-18 22:39:32 +08:00
|
|
|
func (m *roleRepoImpl) ListByQuery(condition *entity.RoleQuery) ([]*entity.Role, error) {
|
2024-04-28 23:45:57 +08:00
|
|
|
qd := model.NewCond().
|
2023-12-18 22:39:32 +08:00
|
|
|
Like("name", condition.Name).
|
|
|
|
|
Like("code", condition.Code).
|
|
|
|
|
In("id", condition.Ids).
|
|
|
|
|
NotIn("id", condition.NotIds).
|
|
|
|
|
OrderByDesc("id")
|
2024-05-05 14:53:30 +08:00
|
|
|
return m.SelectByCond(qd)
|
2023-12-18 22:39:32 +08:00
|
|
|
}
|