[优化]base模块提出

This commit is contained in:
PandaGoAdmin
2022-08-02 22:37:37 +08:00
parent 0555922a90
commit 2cb23c0ecf
151 changed files with 550 additions and 5255 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/gin-gonic/gin"
"pandax/apps/{{.PackageName}}/api"
"pandax/apps/{{.PackageName}}/services"
"pandax/base/ginx"
"github.com/XM-GO/PandaKit/restfulx"
)
func Init{{.ClassName}}Router(router *gin.RouterGroup) {
@@ -18,29 +18,29 @@ func Init{{.ClassName}}Router(router *gin.RouterGroup) {
}
routerGroup := router.Group("{{.BusinessName}}")
{{.ClassName}}ListLog := ginx.NewLogInfo("获取{{.FunctionName}}分页列表")
{{.ClassName}}ListLog := restfulx.NewLogInfo("获取{{.FunctionName}}分页列表")
routerGroup.GET("list", func(c *gin.Context) {
ginx.NewReqCtx(c).WithLog({{.ClassName}}ListLog).Handle(s.Get{{.ClassName}}List)
restfulx.NewReqCtx(c).WithLog({{.ClassName}}ListLog).Handle(s.Get{{.ClassName}}List)
})
{{.ClassName}}Log := ginx.NewLogInfo("获取{{.FunctionName}}信息")
{{.ClassName}}Log := restfulx.NewLogInfo("获取{{.FunctionName}}信息")
routerGroup.GET(":{{.PkJsonField}}", func(c *gin.Context) {
ginx.NewReqCtx(c).WithLog({{.ClassName}}Log).Handle(s.Get{{.ClassName}})
restfulx.NewReqCtx(c).WithLog({{.ClassName}}Log).Handle(s.Get{{.ClassName}})
})
insert{{.ClassName}}Log := ginx.NewLogInfo("添加{{.FunctionName}}信息")
insert{{.ClassName}}Log := restfulx.NewLogInfo("添加{{.FunctionName}}信息")
routerGroup.POST("", func(c *gin.Context) {
ginx.NewReqCtx(c).WithLog(insert{{.ClassName}}Log).Handle(s.Insert{{.ClassName}})
restfulx.NewReqCtx(c).WithLog(insert{{.ClassName}}Log).Handle(s.Insert{{.ClassName}})
})
update{{.ClassName}}Log := ginx.NewLogInfo("修改{{.FunctionName}}信息")
update{{.ClassName}}Log := restfulx.NewLogInfo("修改{{.FunctionName}}信息")
routerGroup.PUT("", func(c *gin.Context) {
ginx.NewReqCtx(c).WithLog(update{{.ClassName}}Log).Handle(s.Update{{.ClassName}})
restfulx.NewReqCtx(c).WithLog(update{{.ClassName}}Log).Handle(s.Update{{.ClassName}})
})
delete{{.ClassName}}Log := ginx.NewLogInfo("删除{{.FunctionName}}信息")
delete{{.ClassName}}Log := restfulx.NewLogInfo("删除{{.FunctionName}}信息")
routerGroup.DELETE(":{{.PkJsonField}}", func(c *gin.Context) {
ginx.NewReqCtx(c).WithLog(delete{{.ClassName}}Log).Handle(s.Delete{{.ClassName}})
restfulx.NewReqCtx(c).WithLog(delete{{.ClassName}}Log).Handle(s.Delete{{.ClassName}})
})
}