package service import ( "baize-demo/project/server/application/domain/class" "baize-demo/project/server/application/domain/student" "git.sxidc.com/go-framework/baize/convenient/relation/one2many" "git.sxidc.com/go-framework/baize/framework/binding" "git.sxidc.com/go-framework/baize/framework/core/api" "git.sxidc.com/go-framework/baize/framework/core/application" ) var classAndStudentService = &ClassAndStudentService{} type ClassAndStudentService struct{} func (svc *ClassAndStudentService) Init(appInstance *application.App) error { svc.v1(appInstance) return nil } func (svc *ClassAndStudentService) Destroy() error { return nil } func (svc *ClassAndStudentService) v1(appInstance *application.App) { v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure()) one2many.BindSimple(v1Binder, &one2many.Simple[class.Info, student.Info]{ Left: &class.Entity{}, Right: &student.Entity{}, Schema: dbSchema, LeftUpdateJsonBody: &class.UpdateStudentsOfClassJsonBody{}, LeftQueryQueryParams: &class.QueryStudentsOfClassQueryParams{}, RightUpdateJsonBody: &student.UpdateClassOfStudentJsonBody{}, RightQueryQueryParams: &student.QueryClassOfStudentQueryParams{}, RightQueryWithLeftQueryParams: &student.QueryStudentWithClassQueryParams{}, }) }