// ========================================================================== // 生成日期:{{.CreatedAt}} // 生成路径: apps/{{.PackageName}}/router/{{.TableName}}.go // 生成人:{{.FunctionAuthor}} // ========================================================================== package router import ( "github.com/gin-gonic/gin" "pandax/apps/{{.PackageName}}/api" "pandax/apps/{{.PackageName}}/services" "github.com/XM-GO/PandaKit/restfulx" ) func Init{{.ClassName}}Router(router *gin.RouterGroup) { s := &api.{{.ClassName}}Api{ {{.ClassName}}App: services.{{.ClassName}}ModelDao, } routerGroup := router.Group("{{.BusinessName}}") {{.ClassName}}ListLog := restfulx.NewLogInfo("获取{{.FunctionName}}分页列表") routerGroup.GET("list", func(c *gin.Context) { restfulx.NewReqCtx(c).WithLog({{.ClassName}}ListLog).Handle(s.Get{{.ClassName}}List) }) {{.ClassName}}Log := restfulx.NewLogInfo("获取{{.FunctionName}}信息") routerGroup.GET(":{{.PkJsonField}}", func(c *gin.Context) { restfulx.NewReqCtx(c).WithLog({{.ClassName}}Log).Handle(s.Get{{.ClassName}}) }) insert{{.ClassName}}Log := restfulx.NewLogInfo("添加{{.FunctionName}}信息") routerGroup.POST("", func(c *gin.Context) { restfulx.NewReqCtx(c).WithLog(insert{{.ClassName}}Log).Handle(s.Insert{{.ClassName}}) }) update{{.ClassName}}Log := restfulx.NewLogInfo("修改{{.FunctionName}}信息") routerGroup.PUT("", func(c *gin.Context) { restfulx.NewReqCtx(c).WithLog(update{{.ClassName}}Log).Handle(s.Update{{.ClassName}}) }) delete{{.ClassName}}Log := restfulx.NewLogInfo("删除{{.FunctionName}}信息") routerGroup.DELETE(":{{.PkJsonField}}", func(c *gin.Context) { restfulx.NewReqCtx(c).WithLog(delete{{.ClassName}}Log).Handle(s.Delete{{.ClassName}}) }) }