family.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package service
  2. import (
  3. "baize-demo/project/server/application/domain/family"
  4. "git.sxidc.com/go-framework/baize/convenient/entity_crud"
  5. "git.sxidc.com/go-framework/baize/framework/binding"
  6. "git.sxidc.com/go-framework/baize/framework/core/api"
  7. "git.sxidc.com/go-framework/baize/framework/core/application"
  8. )
  9. var familyService = &FamilyService{}
  10. type FamilyService struct{}
  11. func (svc *FamilyService) Init(appInstance *application.App) error {
  12. svc.v1(appInstance)
  13. return nil
  14. }
  15. func (svc *FamilyService) Destroy() error {
  16. return nil
  17. }
  18. func (svc *FamilyService) v1(appInstance *application.App) {
  19. v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
  20. entity_crud.BindSimple[family.Info](v1Binder, &entity_crud.Simple[family.Info]{
  21. Entity: &family.Entity{},
  22. Schema: dbSchema,
  23. CreateJsonBody: &family.CreateFamilyJsonBody{},
  24. DeleteQueryParams: &family.DeleteFamilyQueryParams{},
  25. UpdateJsonBody: &family.UpdateFamilyJsonBody{},
  26. QueryQueryParams: &family.GetFamiliesQueryParams{},
  27. GetByIDQueryParams: &family.GetFamilyByIDQueryParams{},
  28. })
  29. }