mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
# Conflicts: # apps/develop/api/gen.go # apps/develop/api/table.go # apps/develop/router/gen.go # apps/develop/router/table.go # apps/job/api/job.go # apps/job/entity/job.go # apps/job/entity/log_job.go # apps/job/jobs/jobbase.go # apps/job/router/job.go # apps/log/api/log_job.go # apps/log/api/log_login.go # apps/log/api/log_oper.go # apps/log/router/log.go # apps/log/services/log_job.go # apps/resource/api/email.go # apps/resource/api/oss.go # apps/resource/router/email.go # apps/resource/router/oss.go # apps/system/api/api.go # apps/system/api/config.go # apps/system/api/dept.go # apps/system/api/dict.go # apps/system/api/menu.go # apps/system/api/notice.go # apps/system/api/post.go # apps/system/api/role.go # apps/system/api/system.go # apps/system/api/tenant.go # apps/system/api/user.go # apps/system/router/api.go # apps/system/router/config.go # apps/system/router/dept.go # apps/system/router/dict.go # apps/system/router/menu.go # apps/system/router/notice.go # apps/system/router/post.go # apps/system/router/role.go # apps/system/router/tenant.go # apps/system/router/user.go # go.mod # go.sum # main.go # pkg/config/app.go # pkg/config/casbin.go # pkg/config/config.go # pkg/config/db.go # pkg/config/gen.go # pkg/config/jwt.go # pkg/config/log.go # pkg/config/redis.go # pkg/config/server.go # pkg/global/global.go # pkg/initialize/table.go # pkg/middleware/log.go # pkg/middleware/oper.go # pkg/middleware/permission.go # resource/template/go/api.template # resource/template/go/router.template # resource/template/go/service.template
49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
package api
|
|
|
|
import (
|
|
"pandax/apps/develop/gen"
|
|
"pandax/apps/develop/services"
|
|
"pandax/base/ginx"
|
|
)
|
|
|
|
type GenApi struct {
|
|
GenTableApp services.SysGenTableModel
|
|
}
|
|
|
|
// @Summary 代码视图
|
|
// @Description 获取JSON
|
|
// @Tags 工具 / 生成工具
|
|
// @Param tableId path int true "tableId"
|
|
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
|
// @Router /develop/code/gen/preview/{tableId} [get]
|
|
// @Security X-TOKEN
|
|
func (e *GenApi) Preview(rc *ginx.ReqCtx) {
|
|
tableId := ginx.PathParamInt(rc.GinCtx, "tableId")
|
|
rc.ResData = gen.Preview(int64(tableId))
|
|
}
|
|
|
|
// @Summary 代码生成
|
|
// @Description 获取JSON
|
|
// @Tags 工具 / 生成工具
|
|
// @Param tableId path int true "tableId"
|
|
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
|
// @Router /develop/code/gen/code/{tableId} [get]
|
|
// @Security X-TOKEN
|
|
func (e *GenApi) GenCode(rc *ginx.ReqCtx) {
|
|
tableId := ginx.PathParamInt(rc.GinCtx, "tableId")
|
|
gen.GenCode(int64(tableId))
|
|
}
|
|
|
|
// @Summary 配置生成
|
|
// @Description 生成API和菜单
|
|
// @Tags 工具 / 生成工具
|
|
// @Param tableId path int true "tableId"
|
|
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
|
// @Router /develop/code/gen/configure/{tableId} [get]
|
|
// @Security X-TOKEN
|
|
func (e *GenApi) GenConfigure(rc *ginx.ReqCtx) {
|
|
tableId := ginx.PathParamInt(rc.GinCtx, "tableId")
|
|
menuId := ginx.QueryInt(rc.GinCtx, "menuId", 0)
|
|
gen.GenConfigure(tableId, menuId)
|
|
}
|