优化
This commit is contained in:
+1
-1
@@ -3,4 +3,4 @@ package biz
|
||||
import "github.com/google/wire"
|
||||
|
||||
// ProviderSet is biz providers.
|
||||
var ProviderSet = wire.NewSet(NewUserUsecase, NewSystemConfigUsecase, NewAccessUsecase, NewMenuUsecase, NewOrganizationUsecase, NewDictionaryUsecase, NewParameterUsecase, NewTokenUsecase, NewSecurityUsecase, NewVersionUsecase, NewExportUsecase, NewAuditUsecase, NewTaskUsecase, NewMediaUsecase, NewAnnouncementUsecase, NewEmailUsecase)
|
||||
var ProviderSet = wire.NewSet(NewUserUsecase, NewSystemConfigUsecase, NewAccessUsecase, NewMenuUsecase, NewDepartmentUsecase, NewPositionUsecase, NewDictionaryUsecase, NewParameterUsecase, NewTokenUsecase, NewSecurityUsecase, NewVersionUsecase, NewExportUsecase, NewAuditUsecase, NewTaskUsecase, NewMediaUsecase, NewAnnouncementUsecase, NewEmailUsecase)
|
||||
|
||||
@@ -31,10 +31,16 @@ type DepartmentRepo interface {
|
||||
SetUserDepartments(context.Context, uint, []uint, uint) error
|
||||
}
|
||||
|
||||
func (uc *OrganizationUsecase) Departments(ctx context.Context, name string) ([]*Department, error) {
|
||||
type DepartmentUsecase struct{ DepartmentRepo }
|
||||
|
||||
func NewDepartmentUsecase(repo DepartmentRepo) *DepartmentUsecase {
|
||||
return &DepartmentUsecase{DepartmentRepo: repo}
|
||||
}
|
||||
|
||||
func (uc *DepartmentUsecase) Departments(ctx context.Context, name string) ([]*Department, error) {
|
||||
return uc.ListDepartments(ctx, name)
|
||||
}
|
||||
func (uc *OrganizationUsecase) Department(ctx context.Context, id uint) (*Department, error) {
|
||||
func (uc *DepartmentUsecase) Department(ctx context.Context, id uint) (*Department, error) {
|
||||
return uc.FindDepartment(ctx, id)
|
||||
}
|
||||
|
||||
@@ -66,20 +72,15 @@ type PositionRepo interface {
|
||||
SetUserPositions(context.Context, uint, []uint) error
|
||||
}
|
||||
|
||||
func (uc *OrganizationUsecase) Positions(ctx context.Context, page, size int, filter *PositionListFilter) ([]*Position, int64, error) {
|
||||
type PositionUsecase struct{ PositionRepo }
|
||||
|
||||
func NewPositionUsecase(repo PositionRepo) *PositionUsecase {
|
||||
return &PositionUsecase{PositionRepo: repo}
|
||||
}
|
||||
|
||||
func (uc *PositionUsecase) Positions(ctx context.Context, page, size int, filter *PositionListFilter) ([]*Position, int64, error) {
|
||||
return uc.ListPositions(ctx, page, size, filter)
|
||||
}
|
||||
func (uc *OrganizationUsecase) Position(ctx context.Context, id uint) (*Position, error) {
|
||||
func (uc *PositionUsecase) Position(ctx context.Context, id uint) (*Position, error) {
|
||||
return uc.FindPosition(ctx, id)
|
||||
}
|
||||
|
||||
type OrganizationRepo interface {
|
||||
DepartmentRepo
|
||||
PositionRepo
|
||||
}
|
||||
|
||||
type OrganizationUsecase struct{ OrganizationRepo }
|
||||
|
||||
func NewOrganizationUsecase(repo OrganizationRepo) *OrganizationUsecase {
|
||||
return &OrganizationUsecase{OrganizationRepo: repo}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user