123456789101112131415161718192021222324252627282930313233343536373839 |
- package service
- import (
- "baize-demo/project/server/application/domain/family"
- "baize-demo/project/server/application/domain/student"
- "git.sxidc.com/go-framework/baize/convenient/relation/one2one"
- "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 studentAndFamilyService = &StudentAndFamilyService{}
- type StudentAndFamilyService struct{}
- func (svc *StudentAndFamilyService) Init(appInstance *application.App) error {
- svc.v1(appInstance)
- return nil
- }
- func (svc *StudentAndFamilyService) Destroy() error {
- return nil
- }
- func (svc *StudentAndFamilyService) v1(appInstance *application.App) {
- v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
- one2one.BindSimple(v1Binder, &one2one.Simple[student.Info, family.Info]{
- Left: &student.Entity{},
- Right: &family.Entity{},
- Schema: dbSchema,
- LeftUpdateJsonBody: &student.UpdateFamilyOfStudentJsonBody{},
- LeftQueryQueryParams: &student.QueryFamilyOfStudentQueryParams{},
- LeftQueryWithRightQueryParams: &student.QueryStudentWithFamilyQueryParams{},
- RightUpdateJsonBody: &family.UpdateStudentOfFamilyJsonBody{},
- RightQueryQueryParams: &family.QueryStudentOfFamilyQueryParams{},
- RightQueryWithLeftQueryParams: &family.QueryFamilyWithStudentQueryParams{},
- })
- }
|