fix: 机器文件内容写入导致内容清空、feat: ioc支持根据类型注入

This commit is contained in:
meilin.huang
2024-12-13 12:15:24 +08:00
parent e56788af3e
commit 7f2a49ba3c
31 changed files with 135 additions and 139 deletions

View File

@@ -28,11 +28,6 @@ type accountAppImpl struct {
accountRoleRepo repository.AccountRole `inject:"AccountRoleRepo"`
}
// 注入AccountRepo
func (a *accountAppImpl) InjectAccountRepo(repo repository.Account) {
a.Repo = repo
}
func (a *accountAppImpl) GetPageList(condition *entity.AccountQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
return a.GetRepo().GetPageList(condition, pageParam, toEntity)
}

View File

@@ -31,10 +31,6 @@ type configAppImpl struct {
base.AppImpl[*entity.Config, repository.Config]
}
func (a *configAppImpl) InjectConfigRepo(repo repository.Config) {
a.Repo = repo
}
func (a *configAppImpl) GetPageList(condition *entity.Config, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
return a.GetRepo().GetPageList(condition, pageParam, toEntity)
}

View File

@@ -41,11 +41,6 @@ type resourceAppImpl struct {
var _ (Resource) = (*resourceAppImpl)(nil)
// 注入ResourceRepo
func (r *resourceAppImpl) InjectResourceRepo(repo repository.Resource) {
r.Repo = repo
}
func (r *resourceAppImpl) Save(ctx context.Context, resource *entity.Resource) error {
// 更新操作
if resource.Id != 0 {

View File

@@ -52,10 +52,6 @@ type roleAppImpl struct {
var _ (Role) = (*roleAppImpl)(nil)
func (r *roleAppImpl) InjectRoleRepo(repo repository.Role) {
r.Repo = repo
}
func (m *roleAppImpl) GetPageList(condition *entity.RoleQuery, pageParam *model.PageParam, toEntity any, orderBy ...string) (*model.PageResult[any], error) {
return m.GetRepo().GetPageList(condition, pageParam, toEntity, orderBy...)
}