feat: 新增简易版ioc

This commit is contained in:
meilin.huang
2024-01-21 22:52:20 +08:00
parent f4a64b96a9
commit f27d3d200f
106 changed files with 815 additions and 707 deletions

View File

@@ -27,16 +27,15 @@ type Resource interface {
GetAccountResources(accountId uint64, toEntity any) error
}
func newResourceApp(resourceRepo repository.Resource) Resource {
return &resourceAppImpl{
base.AppImpl[*entity.Resource, repository.Resource]{Repo: resourceRepo},
}
}
type resourceAppImpl struct {
base.AppImpl[*entity.Resource, repository.Resource]
}
// 注入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 {