mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-04 05:36:35 +08:00
fix: 机器文件内容写入导致内容清空、feat: ioc支持根据类型注入
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user