mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-27 12:29:37 +08:00
47 lines
1.7 KiB
Plaintext
47 lines
1.7 KiB
Plaintext
// ==========================================================================
|
|
// 生成日期:{{.CreatedAt}}
|
|
// 生成路径: apps/{{.PackageName}}/router/{{.TableName}}.go
|
|
// 生成人:{{.FunctionAuthor}}
|
|
// ==========================================================================
|
|
package router
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"pandax/apps/{{.PackageName}}/api"
|
|
"pandax/apps/{{.PackageName}}/services"
|
|
"pandax/base/ctx"
|
|
)
|
|
|
|
func Init{{.ClassName}}Router(router *gin.RouterGroup) {
|
|
s := &api.{{.ClassName}}Api{
|
|
{{.ClassName}}App: services.{{.ClassName}}ModelDao,
|
|
}
|
|
routerGroup := router.Group("{{.BusinessName}}")
|
|
|
|
{{.ClassName}}ListLog := ctx.NewLogInfo("获取{{.FunctionName}}分页列表")
|
|
routerGroup.GET("list", func(c *gin.Context) {
|
|
ctx.NewReqCtxWithGin(c).WithLog({{.ClassName}}ListLog).Handle(s.Get{{.ClassName}}List)
|
|
})
|
|
|
|
{{.ClassName}}Log := ctx.NewLogInfo("获取{{.FunctionName}}信息")
|
|
routerGroup.GET(":{{.PkJsonField}}", func(c *gin.Context) {
|
|
ctx.NewReqCtxWithGin(c).WithLog({{.ClassName}}Log).Handle(s.Get{{.ClassName}})
|
|
})
|
|
|
|
insert{{.ClassName}}Log := ctx.NewLogInfo("添加{{.FunctionName}}信息")
|
|
routerGroup.POST("", func(c *gin.Context) {
|
|
ctx.NewReqCtxWithGin(c).WithLog(insert{{.ClassName}}Log).Handle(s.Insert{{.ClassName}})
|
|
})
|
|
|
|
update{{.ClassName}}Log := ctx.NewLogInfo("修改{{.FunctionName}}信息")
|
|
routerGroup.PUT("", func(c *gin.Context) {
|
|
ctx.NewReqCtxWithGin(c).WithLog(update{{.ClassName}}Log).Handle(s.Update{{.ClassName}})
|
|
})
|
|
|
|
delete{{.ClassName}}Log := ctx.NewLogInfo("删除{{.FunctionName}}信息")
|
|
routerGroup.DELETE(":{{.PkJsonField}}", func(c *gin.Context) {
|
|
ctx.NewReqCtxWithGin(c).WithLog(delete{{.ClassName}}Log).Handle(s.Delete{{.ClassName}})
|
|
})
|
|
}
|
|
|