From 01535f49b67e8b4b63f61968a4c71b27519050db Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 27 Sep 2026 20:49:58 +0800 Subject: [PATCH] =?UTF-8?q?chore=F0=9F=94=A7:=20remove=20the=20code=20gene?= =?UTF-8?q?rator's=20unused=20actions=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit template/v4/actions held router templates for an actions mode the generator never had: gen.go only ever loads the no_actions templates, nothing reads sys_tables.is_actions, and the two files referenced XxxSearch, XxxControl and XxxById request types that the DTO template does not generate, so their output could not have compiled. --- .../v4/actions/router_check_role.go.template | 31 ------------------- .../actions/router_no_check_role.go.template | 30 ------------------ 2 files changed, 61 deletions(-) delete mode 100644 template/v4/actions/router_check_role.go.template delete mode 100644 template/v4/actions/router_no_check_role.go.template diff --git a/template/v4/actions/router_check_role.go.template b/template/v4/actions/router_check_role.go.template deleted file mode 100644 index cdbd1ba9..00000000 --- a/template/v4/actions/router_check_role.go.template +++ /dev/null @@ -1,31 +0,0 @@ -package router - -import ( - "github.com/gin-gonic/gin" - jwt "github.com/go-admin-team/go-admin-core/v2/jwtauth" - - "go-admin/app/{{.PackageName}}/models" - "go-admin/app/{{.PackageName}}/service/dto" - "go-admin/common/actions" - "go-admin/common/middleware" -) - -func init() { - routerCheckRole = append(routerCheckRole, register{{.ClassName}}Router) -} - -// 需认证的路由代码 -func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - r := v1.Group("/{{.ModuleName}}").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) - { - model := &models.{{.ClassName}}{} - r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.{{.ClassName}}Search), func() interface{} { - list := make([]models.{{.ClassName}}, 0) - return &list - })) - r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.{{.ClassName}}ById), nil)) - r.POST("", actions.CreateAction(new(dto.{{.ClassName}}Control))) - r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.{{.ClassName}}Control))) - r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.{{.ClassName}}ById))) - } -} diff --git a/template/v4/actions/router_no_check_role.go.template b/template/v4/actions/router_no_check_role.go.template deleted file mode 100644 index 01545572..00000000 --- a/template/v4/actions/router_no_check_role.go.template +++ /dev/null @@ -1,30 +0,0 @@ -package router - -import ( - "github.com/gin-gonic/gin" - - "go-admin/app/{{.PackageName}}/middleware" - "go-admin/app/{{.PackageName}}/models" - "go-admin/app/{{.PackageName}}/service/dto" - "go-admin/common/actions" -) - -func init() { - routerNoCheckRole = append(routerNoCheckRole, register{{.ClassName}}Router) -} - -// 无需认证的路由代码 -func register{{.ClassName}}Router(v1 *gin.RouterGroup) { - r := v1.Group("/{{.ModuleName}}") - { - model := &models.{{.ClassName}}{} - r.GET("", actions.IndexAction(model, new(dto.{{.ClassName}}Search), func() interface{} { - list := make([]models.{{.ClassName}}, 0) - return &list - })) - r.GET("/:id", actions.ViewAction(new(dto.{{.ClassName}}ById), nil)) - r.POST("", actions.CreateAction(new(dto.{{.ClassName}}Control))) - r.PUT("/:id", actions.UpdateAction(new(dto.{{.ClassName}}Control))) - r.DELETE("", actions.DeleteAction(new(dto.{{.ClassName}}ById))) - } -}