identity.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package service
  2. import (
  3. "baize-demo/project/server/application/domain/identity"
  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 identityService = &IdentityService{}
  10. type IdentityService struct{}
  11. func (svc *IdentityService) Init(appInstance *application.App) error {
  12. svc.v1(appInstance)
  13. return nil
  14. }
  15. func (svc *IdentityService) Destroy() error {
  16. return nil
  17. }
  18. func (svc *IdentityService) v1(appInstance *application.App) {
  19. v1Binder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, "v1"), appInstance.Infrastructure())
  20. entity_crud.BindSimple[identity.Info](v1Binder, &entity_crud.Simple[identity.Info]{
  21. Entity: &identity.Entity{},
  22. Schema: dbSchema,
  23. CreateJsonBody: &identity.CreateIdentityJsonBody{},
  24. DeleteQueryParams: &identity.DeleteIdentityQueryParams{},
  25. UpdateJsonBody: &identity.UpdateIdentityJsonBody{},
  26. QueryQueryParams: &identity.GetIdentitiesQueryParams{},
  27. GetByIDQueryParams: &identity.GetIdentityByIDQueryParams{},
  28. })
  29. }