router_no_check_role.go.template 613 B

12345678910111213141516171819202122232425
  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/{{.PackageName}}/apis"
  6. )
  7. func init() {
  8. routerCheckRole = append(routerCheckRole, register{{.ClassName}}Router)
  9. }
  10. // register{{.ClassName}}Router
  11. func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  12. api := apis.{{.ClassName}}{}
  13. r := v1.Group("/{{.ModuleName}}").Use(authMiddleware.MiddlewareFunc())
  14. {
  15. r.GET("", api.GetPage)
  16. r.GET("/:id", api.Get)
  17. r.POST("", api.Insert)
  18. r.PUT("/:id", api.Update)
  19. r.DELETE("", api.Delete)
  20. }
  21. }