2021-05-08 18:00:33 +08:00
|
|
|
package persistence
|
|
|
|
|
|
|
|
|
|
import (
|
2022-09-09 18:26:08 +08:00
|
|
|
"mayfly-go/internal/db/domain/entity"
|
|
|
|
|
"mayfly-go/internal/db/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-05-08 18:00:33 +08:00
|
|
|
)
|
|
|
|
|
|
2023-10-26 17:15:49 +08:00
|
|
|
type dbRepoImpl struct {
|
|
|
|
|
base.RepoImpl[*entity.Db]
|
|
|
|
|
}
|
2021-05-08 18:00:33 +08:00
|
|
|
|
2022-09-09 18:26:08 +08:00
|
|
|
func newDbRepo() repository.Db {
|
2024-12-08 13:04:23 +08:00
|
|
|
return &dbRepoImpl{}
|
2022-09-09 18:26:08 +08:00
|
|
|
}
|
2021-05-08 18:00:33 +08:00
|
|
|
|
|
|
|
|
// 分页获取数据库信息列表
|
2023-10-26 17:15:49 +08:00
|
|
|
func (d *dbRepoImpl) GetDbList(condition *entity.DbQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
|
2024-06-24 17:17:57 +08:00
|
|
|
pd := model.NewCond().Eq("instance_id", condition.InstanceId).In("code", condition.Codes).Eq("id", condition.Id)
|
2024-05-21 12:34:26 +08:00
|
|
|
return d.PageByCondToAny(pd, pageParam, toEntity)
|
2021-05-08 18:00:33 +08:00
|
|
|
}
|