sys_dict.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  5. "go-admin/app/admin/apis"
  6. "go-admin/common/middleware"
  7. )
  8. func init() {
  9. routerCheckRole = append(routerCheckRole, registerDictRouter)
  10. }
  11. func registerDictRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  12. dictApi := apis.SysDictType{}
  13. dataApi := apis.SysDictData{}
  14. dicts := v1.Group("/dict").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  15. {
  16. dicts.GET("/data", dataApi.GetPage)
  17. dicts.GET("/data/:dictCode", dataApi.Get)
  18. dicts.POST("/data", dataApi.Insert)
  19. dicts.PUT("/data/:dictCode", dataApi.Update)
  20. dicts.DELETE("/data", dataApi.Delete)
  21. dicts.GET("/type-option-select", dictApi.GetAll)
  22. dicts.GET("/type", dictApi.GetPage)
  23. dicts.GET("/type/:id", dictApi.Get)
  24. dicts.POST("/type", dictApi.Insert)
  25. dicts.PUT("/type/:id", dictApi.Update)
  26. dicts.DELETE("/type", dictApi.Delete)
  27. }
  28. opSelect := v1.Group("/dict-data").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  29. {
  30. opSelect.GET("/option-select", dataApi.GetAll)
  31. }
  32. }