student.go 1.2 KB

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