2025-04-07 11:21:43 +08:00

70 lines
1.4 KiB
Go

package system
import (
db "management/internal/db/sqlc"
"management/internal/erpserver/store"
"management/internal/pkg/redis"
"management/internal/pkg/session"
)
type SystemBiz interface {
UserBiz() UserBiz
MenuBiz() MenuBiz
RoleBiz() RoleBiz
DepartmentBiz() DepartmentBiz
ConfigBiz() ConfigBiz
AuditBiz() AuditBiz
LoginLogBiz() LoginLogBiz
CategoryBiz() CategoryBiz
}
type systemBiz struct {
database store.IStore
store db.Store
redis redis.IRedis
session session.ISession
}
var _ SystemBiz = (*systemBiz)(nil)
func New(database store.IStore, store db.Store, redis redis.IRedis, session session.ISession) *systemBiz {
return &systemBiz{
database: database,
store: store,
redis: redis,
session: session,
}
}
func (b *systemBiz) UserBiz() UserBiz {
return NewUser(b.database, b.store, b.session)
}
func (b *systemBiz) MenuBiz() MenuBiz {
return NewMenu(b.store, b.redis)
}
func (b *systemBiz) RoleBiz() RoleBiz {
return NewRole(b.store, b.redis)
}
func (b *systemBiz) DepartmentBiz() DepartmentBiz {
return NewDepartment(b.store, b.redis)
}
func (b *systemBiz) ConfigBiz() ConfigBiz {
return NewConfig(b.store, b.redis)
}
func (b *systemBiz) AuditBiz() AuditBiz {
return NewAudit(b.store)
}
func (b *systemBiz) LoginLogBiz() LoginLogBiz {
return NewLoginLog(b.store)
}
func (b *systemBiz) CategoryBiz() CategoryBiz {
return NewCategory(b.store, b.redis)
}