kra/internal/server/router/system/sys_auto_code.go

45 lines
1.7 KiB
Go

package system
import (
handler "kra/internal/server/handler/system"
"kra/internal/server/middleware"
"github.com/gin-gonic/gin"
)
type AutoCodeRouter struct{}
// InitAutoCodeRouter 初始化自动代码路由
func (s *AutoCodeRouter) InitAutoCodeRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
autoCodeRouter := Router.Group("autoCode").Use(middleware.OperationRecordMiddleware())
autoCodeRouterWithoutRecord := Router.Group("autoCode")
publicAutoCodeRouter := PublicRouter.Group("autoCode")
{
autoCodeRouterWithoutRecord.GET("getDB", autoCodeApi.GetDB) // 获取数据库
autoCodeRouterWithoutRecord.GET("getTables", autoCodeApi.GetTables) // 获取对应数据库的表
autoCodeRouterWithoutRecord.GET("getColumn", autoCodeApi.GetColumn) // 获取指定表所有字段信息
}
{
// 代码包管理
autoCodeRouter.POST("getPackage", handler.GetPackages) // 获取所有包
autoCodeRouter.POST("delPackage", handler.DeletePackage) // 删除包
autoCodeRouter.GET("getTemplates", handler.GetTemplates) // 获取所有模版
}
{
// 代码模板
autoCodeRouter.POST("preview", handler.PreviewCode) // 预览代码
autoCodeRouter.POST("createTemp", handler.CreateCode) // 创建代码
autoCodeRouter.POST("addFunc", handler.AddFunc) // 增加方法
}
{
// 插件管理
autoCodeRouter.POST("pubPlug", handler.PackagedPlugin) // 打包插件
autoCodeRouter.POST("installPlugin", handler.InstallPlugin) // 安装插件
}
{
// 公开路由
publicAutoCodeRouter.POST("initMenu", handler.InitPluginMenu) // 初始化插件菜单
publicAutoCodeRouter.POST("initAPI", handler.InitPluginAPI) // 初始化插件API
}
}