refactor: 新增base.Repo与base.App,重构repo与app层代码

This commit is contained in:
meilin.huang
2023-10-26 17:15:49 +08:00
parent 10f6b03fb5
commit a1303b52eb
115 changed files with 1867 additions and 1696 deletions

View File

@@ -2,18 +2,12 @@ package repository
import (
"mayfly-go/internal/sys/domain/entity"
"mayfly-go/pkg/base"
"mayfly-go/pkg/model"
)
type Account interface {
// 根据条件获取账号信息
GetAccount(condition *entity.Account, cols ...string) error
base.Repo[*entity.Account]
GetById(id uint64) *entity.Account
GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult[any]
Insert(account *entity.Account)
Update(account *entity.Account)
GetPageList(condition *entity.Account, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
}

View File

@@ -2,17 +2,12 @@ package repository
import (
"mayfly-go/internal/sys/domain/entity"
"mayfly-go/pkg/base"
"mayfly-go/pkg/model"
)
type Config interface {
GetPageList(condition *entity.Config, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult[any]
base.Repo[*entity.Config]
Insert(config *entity.Config)
Update(config *entity.Config)
GetConfig(config *entity.Config, cols ...string) error
GetByCondition(condition *entity.Config, cols ...string) error
GetPageList(condition *entity.Config, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
}

View File

@@ -2,24 +2,18 @@ package repository
import (
"mayfly-go/internal/sys/domain/entity"
"mayfly-go/pkg/base"
)
type Resource interface {
// 获取资源列表
GetResourceList(condition *entity.Resource, toEntity any, orderBy ...string)
GetById(id uint64, cols ...string) *entity.Resource
Delete(id uint64)
GetByCondition(condition *entity.Resource, cols ...string) error
base.Repo[*entity.Resource]
// 获取账号资源列表
GetAccountResources(accountId uint64, toEntity any)
GetAccountResources(accountId uint64, toEntity any) error
// 获取所有子节点id
GetChildren(uiPath string) []entity.Resource
// 根据uiPath右匹配更新所有相关类资源
UpdateByUiPathLike(resource *entity.Resource)
UpdateByUiPathLike(resource *entity.Resource) error
}

View File

@@ -2,13 +2,14 @@ package repository
import (
"mayfly-go/internal/sys/domain/entity"
"mayfly-go/pkg/base"
"mayfly-go/pkg/model"
)
type Role interface {
GetPageList(condition *entity.Role, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult[any]
base.Repo[*entity.Role]
Delete(id uint64)
GetPageList(condition *entity.Role, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
// 获取角色拥有的资源id数组从role_resource表获取
GetRoleResourceIds(roleId uint64) []uint64

View File

@@ -2,11 +2,12 @@ package repository
import (
"mayfly-go/internal/sys/domain/entity"
"mayfly-go/pkg/base"
"mayfly-go/pkg/model"
)
type Syslog interface {
GetPageList(condition *entity.SysLogQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) *model.PageResult[any]
base.Repo[*entity.SysLog]
Insert(log *entity.SysLog)
GetPageList(condition *entity.SysLogQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error)
}