mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
代码生成
This commit is contained in:
41
apps/develop/api/gen.go
Normal file
41
apps/develop/api/gen.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"pandax/apps/develop/gen"
|
||||
"pandax/apps/develop/services"
|
||||
"pandax/base/ctx"
|
||||
"pandax/base/ginx"
|
||||
)
|
||||
|
||||
type GenApi struct {
|
||||
GenTableApp services.SysGenTableModel
|
||||
}
|
||||
|
||||
// @Summary 代码视图
|
||||
// @Description 获取JSON
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableId path int true "tableId"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/gen/preview/{tableId} [get]
|
||||
// @Security X-TOKEN
|
||||
func (e *GenApi) Preview(rc *ctx.ReqCtx) {
|
||||
tableId := ginx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("tableId"))
|
||||
rc.ResData = gen.Preview(int64(tableId))
|
||||
}
|
||||
|
||||
// @Summary 代码生成
|
||||
// @Description 获取JSON
|
||||
// @Tags 工具 / 生成工具
|
||||
// @Param tableId path int true "tableId"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /develop/code/gen/code/{tableId} [get]
|
||||
// @Security X-TOKEN
|
||||
func (e *GenApi) GenCode(rc *ctx.ReqCtx) {
|
||||
tableId := ginx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("tableId"))
|
||||
gen.GenCode(int64(tableId))
|
||||
}
|
||||
|
||||
//自动创建菜单,api
|
||||
func (e *GenApi) AutoApi(rc *ctx.ReqCtx) {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user