修复生成的文档注释返回结构不正确

This commit is contained in:
xiangheng
2024-07-01 22:23:14 +08:00
parent e37f313b09
commit a3ee34aa66
14 changed files with 4013 additions and 3521 deletions

View File

@@ -14,7 +14,8 @@ export default defineConfig({
nav: [ nav: [
{ text: 'Home', link: '/' }, { text: 'Home', link: '/' },
{ text: '后端', link: '/server/准备.md' }, { text: '后端', link: '/server/准备.md' },
{ text: '前端', link: '/admin/准备.md' } { text: '前端', link: '/admin/准备.md' },
{ text: '在线体验', link: 'https://x.adtk.cn/' },
], ],
sidebar: [ sidebar: [

View File

@@ -40,15 +40,14 @@ pm2 start 打包后的二进制文件名 --name x_admin
pm2 startup pm2 startup
# 保存 # 保存
pm2 save pm2 save
# 所有任务列表 # 所有任务列表
pm2 list pm2 list
# 停止 # 停止
```bash
pm2 stop x_admin pm2 stop x_admin
# 重启 # 重启
```bash
pm2 restart x_admin pm2 restart x_admin
# 查看日志 # 查看日志
pm2 log x_admin pm2 log x_admin

View File

@@ -26,9 +26,8 @@ type FlowApplyHandler struct{}
// @Param flowFormData query string false "表单配置" // @Param flowFormData query string false "表单配置"
// @Param flowProcessData query string false "流程配置" // @Param flowProcessData query string false "流程配置"
// @Param status query int false "状态1待提交2审批中3审批完成4审批失败" // @Param status query int false "状态1待提交2审批中3审批完成4审批失败"
// @Success 200 {object} []FlowApplyResp "成功" // @Success 200 {object} response.Response{data=response.PageResp{lists=[]FlowApplyResp}} "成功"
// @Failure 400 {object} string "请求错误" // @Router /api/admin/flow/flow_apply/list [get]
// @Router /api/flow_apply/list [get]
func (hd FlowApplyHandler) List(c *gin.Context) { func (hd FlowApplyHandler) List(c *gin.Context) {
var page request.PageReq var page request.PageReq
var listReq FlowApplyListReq var listReq FlowApplyListReq
@@ -47,8 +46,8 @@ func (hd FlowApplyHandler) List(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id query int false "申请id" // @Param id query int false "申请id"
// @Success 200 {object} FlowApplyResp "成功" // @Success 200 {object} response.Response{data=FlowApplyResp} "成功"
// @Router /api/flow_apply/detail [get] // @Router /api/admin/flow/flow_apply/detail [get]
func (hd FlowApplyHandler) Detail(c *gin.Context) { func (hd FlowApplyHandler) Detail(c *gin.Context) {
var detailReq FlowApplyDetailReq var detailReq FlowApplyDetailReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
@@ -71,8 +70,8 @@ func (hd FlowApplyHandler) Detail(c *gin.Context) {
// @Param flowFormData body string false "表单配置" // @Param flowFormData body string false "表单配置"
// @Param flowProcessData body string false "流程配置" // @Param flowProcessData body string false "流程配置"
// @Param status body int false "状态1待提交2审批中3审批完成4审批失败" // @Param status body int false "状态1待提交2审批中3审批完成4审批失败"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_apply/add [post] // @Router /api/admin/flow/flow_apply/add [post]
func (hd FlowApplyHandler) Add(c *gin.Context) { func (hd FlowApplyHandler) Add(c *gin.Context) {
var addReq FlowApplyAddReq var addReq FlowApplyAddReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
@@ -102,8 +101,8 @@ func (hd FlowApplyHandler) Add(c *gin.Context) {
// @Param flowFormData body string false "表单配置" // @Param flowFormData body string false "表单配置"
// @Param flowProcessData body string false "流程配置" // @Param flowProcessData body string false "流程配置"
// @Param status body int false "状态1待提交2审批中3审批完成4审批失败" // @Param status body int false "状态1待提交2审批中3审批完成4审批失败"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_apply/edit [post] // @Router /api/admin/flow/flow_apply/edit [post]
func (hd FlowApplyHandler) Edit(c *gin.Context) { func (hd FlowApplyHandler) Edit(c *gin.Context) {
var editReq FlowApplyEditReq var editReq FlowApplyEditReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
@@ -117,8 +116,8 @@ func (hd FlowApplyHandler) Edit(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id body int false "申请id" // @Param id body int false "申请id"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_apply/del [post] // @Router /api/admin/flow/flow_apply/del [post]
func (hd FlowApplyHandler) Del(c *gin.Context) { func (hd FlowApplyHandler) Del(c *gin.Context) {
var delReq FlowApplyDelReq var delReq FlowApplyDelReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {

View File

@@ -28,9 +28,8 @@ type FlowHistoryHandler struct {
// @Param formValue query string false "表单值" // @Param formValue query string false "表单值"
// @Param passStatus query int false "通过状态0待处理1通过2拒绝" // @Param passStatus query int false "通过状态0待处理1通过2拒绝"
// @Param passRemark query string false "通过备注" // @Param passRemark query string false "通过备注"
// @Success 200 {object} []FlowHistoryResp "成功" // @Success 200 {object} response.Response{data=response.PageResp{lists=[]FlowHistoryResp}} "成功"
// @Failure 400 {object} string "请求错误" // @Router /api/admin/flow/flow_history/list [get]
// @Router /api/flow_history/list [get]
func (hd FlowHistoryHandler) List(c *gin.Context) { func (hd FlowHistoryHandler) List(c *gin.Context) {
var page request.PageReq var page request.PageReq
var listReq = FlowHistoryListReq{ var listReq = FlowHistoryListReq{
@@ -49,8 +48,8 @@ func (hd FlowHistoryHandler) List(c *gin.Context) {
// @Summary 流程历史列表-所有 // @Summary 流程历史列表-所有
// @Tags flow_history-流程历史 // @Tags flow_history-流程历史
// @Produce json // @Produce json
// @Success 200 {object} []FlowHistoryResp "成功" // @Success 200 {object} response.Response{data=FlowHistoryResp} "成功"
// @Router /api/flow_history/listAll [get] // @Router /api/admin/flow/flow_history/listAll [get]
func (hd FlowHistoryHandler) ListAll(c *gin.Context) { func (hd FlowHistoryHandler) ListAll(c *gin.Context) {
var listReq FlowHistoryListReq var listReq FlowHistoryListReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
@@ -65,8 +64,8 @@ func (hd FlowHistoryHandler) ListAll(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id query int false "历史id" // @Param id query int false "历史id"
// @Success 200 {object} FlowHistoryResp "成功" // @Success 200 {object} response.Response{data=FlowHistoryResp} "成功"
// @Router /api/flow_history/detail [get] // @Router /api/admin/flow/flow_history/detail [get]
func (hd FlowHistoryHandler) Detail(c *gin.Context) { func (hd FlowHistoryHandler) Detail(c *gin.Context) {
var detailReq FlowHistoryDetailReq var detailReq FlowHistoryDetailReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
@@ -90,8 +89,8 @@ func (hd FlowHistoryHandler) Detail(c *gin.Context) {
// @Param formValue body string false "表单值" // @Param formValue body string false "表单值"
// @Param passStatus body int false "通过状态0待处理1通过2拒绝" // @Param passStatus body int false "通过状态0待处理1通过2拒绝"
// @Param passRemark body string false "通过备注" // @Param passRemark body string false "通过备注"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_history/add [post] // @Router /api/admin/flow/flow_history/add [post]
func (hd FlowHistoryHandler) Add(c *gin.Context) { func (hd FlowHistoryHandler) Add(c *gin.Context) {
var addReq FlowHistoryAddReq var addReq FlowHistoryAddReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
@@ -115,8 +114,8 @@ func (hd FlowHistoryHandler) Add(c *gin.Context) {
// @Param formValue body string false "表单值" // @Param formValue body string false "表单值"
// @Param passStatus body int false "通过状态0待处理1通过2拒绝" // @Param passStatus body int false "通过状态0待处理1通过2拒绝"
// @Param passRemark body string false "通过备注" // @Param passRemark body string false "通过备注"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_history/edit [post] // @Router /api/admin/flow/flow_history/edit [post]
func (hd FlowHistoryHandler) Edit(c *gin.Context) { func (hd FlowHistoryHandler) Edit(c *gin.Context) {
var editReq FlowHistoryEditReq var editReq FlowHistoryEditReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
@@ -130,8 +129,8 @@ func (hd FlowHistoryHandler) Edit(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id body int false "历史id" // @Param id body int false "历史id"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_history/del [post] // @Router /api/admin/flow/flow_history/del [post]
func (hd FlowHistoryHandler) Del(c *gin.Context) { func (hd FlowHistoryHandler) Del(c *gin.Context) {
var delReq FlowHistoryDelReq var delReq FlowHistoryDelReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
@@ -142,7 +141,7 @@ func (hd FlowHistoryHandler) Del(c *gin.Context) {
// 提交申请,通过审批 // 提交申请,通过审批
// //
// @Router /api/flow_apply/pass [post] // @Router /api/admin/flow_apply/pass [post]
func (hd FlowHistoryHandler) Pass(c *gin.Context) { func (hd FlowHistoryHandler) Pass(c *gin.Context) {
var pass PassReq var pass PassReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &pass)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &pass)) {
@@ -154,7 +153,7 @@ func (hd FlowHistoryHandler) Pass(c *gin.Context) {
} }
// 拒绝审批 // 拒绝审批
// @Router /api/flow_apply/back [post] // @Router /api/admin/flow_apply/back [post]
func (hd FlowHistoryHandler) Back(c *gin.Context) { func (hd FlowHistoryHandler) Back(c *gin.Context) {
var back BackReq var back BackReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &back)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &back)) {

View File

@@ -21,9 +21,8 @@ type FlowTemplateHandler struct{}
// @Param flowRemark query string false "流程描述" // @Param flowRemark query string false "流程描述"
// @Param flowFormData query string false "表单配置" // @Param flowFormData query string false "表单配置"
// @Param flowProcessData query string false "流程配置" // @Param flowProcessData query string false "流程配置"
// @Success 200 {object} []FlowTemplateResp "成功" // @Success 200 {object} response.Response{data=response.PageResp{lists=[]FlowTemplateResp}} "成功"
// @Failure 400 {object} string "请求错误" // @Router /api/admin/flow/flow_template/list [get]
// @Router /api/flow_template/list [get]
func (hd FlowTemplateHandler) List(c *gin.Context) { func (hd FlowTemplateHandler) List(c *gin.Context) {
var page request.PageReq var page request.PageReq
var listReq FlowTemplateListReq var listReq FlowTemplateListReq
@@ -39,7 +38,7 @@ func (hd FlowTemplateHandler) List(c *gin.Context) {
// @Summary 流程模板列表-所有 // @Summary 流程模板列表-所有
// @Tags flow_template-流程模板 // @Tags flow_template-流程模板
// @Router /api/flow_template/listAll [get] // @Router /api/admin/flow/flow_template/listAll [get]
func (hd FlowTemplateHandler) ListAll(c *gin.Context) { func (hd FlowTemplateHandler) ListAll(c *gin.Context) {
res, err := Service.ListAll() res, err := Service.ListAll()
response.CheckAndRespWithData(c, res, err) response.CheckAndRespWithData(c, res, err)
@@ -51,7 +50,7 @@ func (hd FlowTemplateHandler) ListAll(c *gin.Context) {
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id query int false "历史id" // @Param id query int false "历史id"
// @Success 200 {object} FlowTemplateResp "成功" // @Success 200 {object} FlowTemplateResp "成功"
// @Router /api/flow_template/detail [get] // @Router /api/admin/flow/flow_template/detail [get]
func (hd FlowTemplateHandler) Detail(c *gin.Context) { func (hd FlowTemplateHandler) Detail(c *gin.Context) {
var detailReq FlowTemplateDetailReq var detailReq FlowTemplateDetailReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
@@ -70,8 +69,8 @@ func (hd FlowTemplateHandler) Detail(c *gin.Context) {
// @Param flowRemark body string false "流程描述" // @Param flowRemark body string false "流程描述"
// @Param flowFormData body string false "表单配置" // @Param flowFormData body string false "表单配置"
// @Param flowProcessData body string false "流程配置" // @Param flowProcessData body string false "流程配置"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_template/add [post] // @Router /api/admin/flow/flow_template/add [post]
func (hd FlowTemplateHandler) Add(c *gin.Context) { func (hd FlowTemplateHandler) Add(c *gin.Context) {
var addReq FlowTemplateAddReq var addReq FlowTemplateAddReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
@@ -90,8 +89,8 @@ func (hd FlowTemplateHandler) Add(c *gin.Context) {
// @Param flowRemark body string false "流程描述" // @Param flowRemark body string false "流程描述"
// @Param flowFormData body string false "表单配置" // @Param flowFormData body string false "表单配置"
// @Param flowProcessData body string false "流程配置" // @Param flowProcessData body string false "流程配置"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_template/edit [post] // @Router /api/admin/flow/flow_template/edit [post]
func (hd FlowTemplateHandler) Edit(c *gin.Context) { func (hd FlowTemplateHandler) Edit(c *gin.Context) {
var editReq FlowTemplateEditReq var editReq FlowTemplateEditReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
@@ -105,8 +104,8 @@ func (hd FlowTemplateHandler) Edit(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id body int false "历史id" // @Param id body int false "历史id"
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/flow_template/del [post] // @Router /api/admin/flow/flow_template/del [post]
func (hd FlowTemplateHandler) Del(c *gin.Context) { func (hd FlowTemplateHandler) Del(c *gin.Context) {
var delReq FlowTemplateDelReq var delReq FlowTemplateDelReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) { if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {

View File

@@ -22,15 +22,14 @@ type {{{ title (toCamelCase .ModuleName) }}}Handler struct {}
{{{- range .Columns }}} {{{- range .Columns }}}
{{{- if .IsQuery }}} {{{- if .IsQuery }}}
{{{- if eq .HtmlType "datetime" }}} {{{- if eq .HtmlType "datetime" }}}
// @Param {{{ toCamelCase .GoField }}}Start query {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}}Start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
// @Param {{{ toCamelCase .GoField }}}End query {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}}End query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- else }}} {{{- else }}}
// @Param {{{ toCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
// @Success 200 {object} []{{{ title (toCamelCase .EntityName) }}}Resp "成功" //@Success 200 {object} {{{getPageResp (title (toCamelCase .EntityName)) }}} "成功"
// @Failure 400 {object} string "请求错误"
//@Router /api/admin/{{{ .ModuleName }}}/list [get] //@Router /api/admin/{{{ .ModuleName }}}/list [get]
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) List(c *gin.Context) { func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) List(c *gin.Context) {
var page request.PageReq var page request.PageReq
@@ -51,14 +50,14 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) List(c *gin.Context) {
{{{- range .Columns }}} {{{- range .Columns }}}
{{{- if .IsQuery }}} {{{- if .IsQuery }}}
{{{- if eq .HtmlType "datetime" }}} {{{- if eq .HtmlType "datetime" }}}
// @Param {{{ toCamelCase .GoField }}}Start query {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}}Start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
// @Param {{{ toCamelCase .GoField }}}End query {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}}End query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- else }}} {{{- else }}}
// @Param {{{ toCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
// @Success 200 {object} []{{{ title (toCamelCase .EntityName) }}}Resp "成功" // @Success 200 {object} response.Response{ data=[]{{{ title (toCamelCase .EntityName) }}}Resp} "成功"
// @Router /api/admin/{{{ .ModuleName }}}/listAll [get] // @Router /api/admin/{{{ .ModuleName }}}/listAll [get]
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) ListAll(c *gin.Context) { func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) ListAll(c *gin.Context) {
var listReq {{{ title (toCamelCase .EntityName) }}}ListReq var listReq {{{ title (toCamelCase .EntityName) }}}ListReq
@@ -75,10 +74,10 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) ListAll(c *gin.Context
// @Param Token header string true "token" // @Param Token header string true "token"
{{{- range .Columns }}} {{{- range .Columns }}}
{{{- if .IsPk }}} {{{- if .IsPk }}}
// @Param {{{ toCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
// @Success 200 {object} {{{ title (toCamelCase .EntityName) }}}Resp "成功" // @Success 200 {object} response.Response{ data={{{ title (toCamelCase .EntityName) }}}Resp} "成功"
// @Router /api/admin/{{{ .ModuleName }}}/detail [get] // @Router /api/admin/{{{ .ModuleName }}}/detail [get]
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Detail(c *gin.Context) { func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Detail(c *gin.Context) {
var detailReq {{{ title (toCamelCase .EntityName) }}}DetailReq var detailReq {{{ title (toCamelCase .EntityName) }}}DetailReq
@@ -96,10 +95,10 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Detail(c *gin.Context)
// @Param Token header string true "token" // @Param Token header string true "token"
{{{- range .Columns }}} {{{- range .Columns }}}
{{{- if .IsInsert }}} {{{- if .IsInsert }}}
// @Param {{{ toCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/{{{ .ModuleName }}}/add [post] // @Router /api/admin/{{{ .ModuleName }}}/add [post]
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Add(c *gin.Context) { func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Add(c *gin.Context) {
var addReq {{{ title (toCamelCase .EntityName) }}}AddReq var addReq {{{ title (toCamelCase .EntityName) }}}AddReq
@@ -114,10 +113,10 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Add(c *gin.Context) {
// @Param Token header string true "token" // @Param Token header string true "token"
{{{- range .Columns }}} {{{- range .Columns }}}
{{{- if .IsEdit }}} {{{- if .IsEdit }}}
// @Param {{{ toCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/{{{ .ModuleName }}}/edit [post] // @Router /api/admin/{{{ .ModuleName }}}/edit [post]
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Edit(c *gin.Context) { func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Edit(c *gin.Context) {
var editReq {{{ title (toCamelCase .EntityName) }}}EditReq var editReq {{{ title (toCamelCase .EntityName) }}}EditReq
@@ -132,10 +131,10 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Edit(c *gin.Context) {
// @Param Token header string true "token" // @Param Token header string true "token"
{{{- range .Columns }}} {{{- range .Columns }}}
{{{- if .IsPk }}} {{{- if .IsPk }}}
// @Param {{{ toCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}." // @Param {{{ toCamelCase .GoField }}} body {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/{{{ .ModuleName }}}/del [post] // @Router /api/admin/{{{ .ModuleName }}}/del [post]
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Del(c *gin.Context) { func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Del(c *gin.Context) {
var delReq {{{ title (toCamelCase .EntityName) }}}DelReq var delReq {{{ title (toCamelCase .EntityName) }}}DelReq
@@ -153,7 +152,12 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) Del(c *gin.Context) {
// @Param Token header string true "token" // @Param Token header string true "token"
{{{- range .Columns }}} {{{- range .Columns }}}
{{{- if .IsQuery }}} {{{- if .IsQuery }}}
// @Param {{{ toCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}." {{{- if eq .HtmlType "datetime" }}}
// @Param {{{ toCamelCase .GoField }}}Start query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
// @Param {{{ toCamelCase .GoField }}}End query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- else }}}
// @Param {{{ toCamelCase .GoField }}} query {{{ .GoType }}} false "{{{ .ColumnComment }}}"
{{{- end }}}
{{{- end }}} {{{- end }}}
{{{- end }}} {{{- end }}}
// @Router /api/admin/{{{ .ModuleName }}}/ExportFile [get] // @Router /api/admin/{{{ .ModuleName }}}/ExportFile [get]
@@ -178,6 +182,7 @@ func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) ExportFile(c *gin.Cont
// @Summary {{{ .FunctionName }}}导入 // @Summary {{{ .FunctionName }}}导入
// @Tags {{{ .ModuleName }}}-{{{ .FunctionName }}} // @Tags {{{ .ModuleName }}}-{{{ .FunctionName }}}
// @Produce json // @Produce json
// @Router /api/admin/{{{ .ModuleName }}}/ImportFile [post]
func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) ImportFile(c *gin.Context) { func (hd {{{ title (toCamelCase .ModuleName) }}}Handler) ImportFile(c *gin.Context) {
file, _, err := c.Request.FormFile("file") file, _, err := c.Request.FormFile("file")
if err != nil { if err != nil {

View File

@@ -24,6 +24,7 @@ var TemplateUtil = templateUtil{
"toCamelCase": util.StringUtil.ToCamelCase, "toCamelCase": util.StringUtil.ToCamelCase,
"contains": util.ToolsUtil.Contains, "contains": util.ToolsUtil.Contains,
"goToTsType": util.ToolsUtil.GoToTsType, "goToTsType": util.ToolsUtil.GoToTsType,
"getPageResp": util.ToolsUtil.GetPageResp,
}), }),
} }

View File

@@ -3,13 +3,13 @@ package monitor_client
import ( import (
"net/http" "net/http"
"time" "time"
"github.com/gin-gonic/gin"
"x_admin/core/request" "x_admin/core/request"
"x_admin/core/response" "x_admin/core/response"
"x_admin/util" "x_admin/util"
"x_admin/util/excel" "x_admin/util/excel"
)
"github.com/gin-gonic/gin"
)
type MonitorClientHandler struct{} type MonitorClientHandler struct{}
@@ -32,7 +32,9 @@ type MonitorClientHandler struct {}
// @Param createTimeEnd query core.TsTime false "创建时间." // @Param createTimeEnd query core.TsTime false "创建时间."
// @Param clientTimeStart query core.TsTime false "更新时间." // @Param clientTimeStart query core.TsTime false "更新时间."
// @Param clientTimeEnd query core.TsTime false "更新时间." // @Param clientTimeEnd query core.TsTime false "更新时间."
// @Success 200 {object} []MonitorClientResp "成功" //
// @Success 200 {object} response.Response{data=response.PageResp{lists=[]MonitorClientResp}} "成功"
//
// @Failure 400 {object} string "请求错误" // @Failure 400 {object} string "请求错误"
// @Router /api/admin/monitor_client/list [get] // @Router /api/admin/monitor_client/list [get]
func (hd MonitorClientHandler) List(c *gin.Context) { func (hd MonitorClientHandler) List(c *gin.Context) {
@@ -64,7 +66,7 @@ func (hd MonitorClientHandler) List(c *gin.Context) {
// @Param createTimeEnd query core.TsTime false "创建时间." // @Param createTimeEnd query core.TsTime false "创建时间."
// @Param clientTimeStart query core.TsTime false "更新时间." // @Param clientTimeStart query core.TsTime false "更新时间."
// @Param clientTimeEnd query core.TsTime false "更新时间." // @Param clientTimeEnd query core.TsTime false "更新时间."
// @Success 200 {object} []MonitorClientResp "成功" // @Success 200 {object} response.Response{data=[]MonitorClientResp} "成功"
// @Router /api/admin/monitor_client/listAll [get] // @Router /api/admin/monitor_client/listAll [get]
func (hd MonitorClientHandler) ListAll(c *gin.Context) { func (hd MonitorClientHandler) ListAll(c *gin.Context) {
var listReq MonitorClientListReq var listReq MonitorClientListReq
@@ -80,7 +82,7 @@ func (hd MonitorClientHandler) ListAll(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id query int false "uuid." // @Param id query int false "uuid."
// @Success 200 {object} MonitorClientResp "成功" // @Success 200 {object} response.Response{data=MonitorClientResp} "成功"
// @Router /api/admin/monitor_client/detail [get] // @Router /api/admin/monitor_client/detail [get]
func (hd MonitorClientHandler) Detail(c *gin.Context) { func (hd MonitorClientHandler) Detail(c *gin.Context) {
var detailReq MonitorClientDetailReq var detailReq MonitorClientDetailReq
@@ -91,7 +93,6 @@ func (hd MonitorClientHandler) Detail(c *gin.Context) {
response.CheckAndRespWithData(c, res, err) response.CheckAndRespWithData(c, res, err)
} }
// @Summary 监控-客户端信息新增 // @Summary 监控-客户端信息新增
// @Tags monitor_client-监控-客户端信息 // @Tags monitor_client-监控-客户端信息
// @Produce json // @Produce json
@@ -105,7 +106,7 @@ func (hd MonitorClientHandler) Detail(c *gin.Context) {
// @Param height body int false "屏幕高度." // @Param height body int false "屏幕高度."
// @Param ua body string false "ua记录." // @Param ua body string false "ua记录."
// @Param clientTime body core.TsTime false "更新时间." // @Param clientTime body core.TsTime false "更新时间."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_client/add [post] // @Router /api/admin/monitor_client/add [post]
func (hd MonitorClientHandler) Add(c *gin.Context) { func (hd MonitorClientHandler) Add(c *gin.Context) {
var addReq MonitorClientAddReq var addReq MonitorClientAddReq
@@ -114,6 +115,7 @@ func (hd MonitorClientHandler) Add(c *gin.Context) {
} }
response.CheckAndResp(c, Service.Add(addReq)) response.CheckAndResp(c, Service.Add(addReq))
} }
// @Summary 监控-客户端信息编辑 // @Summary 监控-客户端信息编辑
// @Tags monitor_client-监控-客户端信息 // @Tags monitor_client-监控-客户端信息
// @Produce json // @Produce json
@@ -127,7 +129,7 @@ func (hd MonitorClientHandler) Add(c *gin.Context) {
// @Param height body int false "屏幕高度." // @Param height body int false "屏幕高度."
// @Param ua body string false "ua记录." // @Param ua body string false "ua记录."
// @Param clientTime body core.TsTime false "更新时间." // @Param clientTime body core.TsTime false "更新时间."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_client/edit [post] // @Router /api/admin/monitor_client/edit [post]
func (hd MonitorClientHandler) Edit(c *gin.Context) { func (hd MonitorClientHandler) Edit(c *gin.Context) {
var editReq MonitorClientEditReq var editReq MonitorClientEditReq
@@ -136,12 +138,13 @@ func (hd MonitorClientHandler) Edit(c *gin.Context) {
} }
response.CheckAndResp(c, Service.Edit(editReq)) response.CheckAndResp(c, Service.Edit(editReq))
} }
// @Summary 监控-客户端信息删除 // @Summary 监控-客户端信息删除
// @Tags monitor_client-监控-客户端信息 // @Tags monitor_client-监控-客户端信息
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id body int false "uuid." // @Param id body int false "uuid."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_client/del [post] // @Router /api/admin/monitor_client/del [post]
func (hd MonitorClientHandler) Del(c *gin.Context) { func (hd MonitorClientHandler) Del(c *gin.Context) {
var delReq MonitorClientDelReq var delReq MonitorClientDelReq
@@ -151,8 +154,6 @@ func (hd MonitorClientHandler) Del(c *gin.Context) {
response.CheckAndResp(c, Service.Del(delReq.Id)) response.CheckAndResp(c, Service.Del(delReq.Id))
} }
// @Summary 监控-客户端信息导出 // @Summary 监控-客户端信息导出
// @Tags monitor_client-监控-客户端信息 // @Tags monitor_client-监控-客户端信息
// @Produce json // @Produce json

View File

@@ -23,7 +23,7 @@ type MonitorProjectHandler struct{}
// @Param projectKey query string false "项目uuid." // @Param projectKey query string false "项目uuid."
// @Param projectName query string false "项目名称." // @Param projectName query string false "项目名称."
// @Param projectType query string false "项目类型go java web node php 等." // @Param projectType query string false "项目类型go java web node php 等."
// @Success 200 {object} []MonitorProjectResp "成功" // @Success 200 {object} response.Response{data=response.PageResp{lists=[]MonitorProjectResp}} "成功"
// @Failure 400 {object} string "请求错误" // @Failure 400 {object} string "请求错误"
// @Router /api/admin/monitor_project/list [get] // @Router /api/admin/monitor_project/list [get]
func (hd MonitorProjectHandler) List(c *gin.Context) { func (hd MonitorProjectHandler) List(c *gin.Context) {
@@ -42,7 +42,7 @@ func (hd MonitorProjectHandler) List(c *gin.Context) {
// @Summary 错误项目列表-所有 // @Summary 错误项目列表-所有
// @Tags monitor_project-错误项目 // @Tags monitor_project-错误项目
// @Produce json // @Produce json
// @Success 200 {object} []MonitorProjectResp "成功" // @Success 200 {object} response.Response{data=[]MonitorProjectResp} "成功"
// @Router /api/admin/monitor_project/listAll [get] // @Router /api/admin/monitor_project/listAll [get]
func (hd MonitorProjectHandler) ListAll(c *gin.Context) { func (hd MonitorProjectHandler) ListAll(c *gin.Context) {
res, err := Service.ListAll() res, err := Service.ListAll()
@@ -58,7 +58,7 @@ func (hd MonitorProjectHandler) ListAll(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id query int false "项目id." // @Param id query int false "项目id."
// @Success 200 {object} MonitorProjectResp "成功" // @Success 200 {object} response.Response{data=MonitorProjectResp} "成功"
// @Router /api/admin/monitor_project/detail [get] // @Router /api/admin/monitor_project/detail [get]
func (hd MonitorProjectHandler) Detail(c *gin.Context) { func (hd MonitorProjectHandler) Detail(c *gin.Context) {
var detailReq MonitorProjectDetailReq var detailReq MonitorProjectDetailReq
@@ -76,7 +76,7 @@ func (hd MonitorProjectHandler) Detail(c *gin.Context) {
// @Param projectKey body string false "项目uuid." // @Param projectKey body string false "项目uuid."
// @Param projectName body string false "项目名称." // @Param projectName body string false "项目名称."
// @Param projectType body string false "项目类型go java web node php 等." // @Param projectType body string false "项目类型go java web node php 等."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_project/add [post] // @Router /api/admin/monitor_project/add [post]
func (hd MonitorProjectHandler) Add(c *gin.Context) { func (hd MonitorProjectHandler) Add(c *gin.Context) {
var addReq MonitorProjectAddReq var addReq MonitorProjectAddReq
@@ -94,7 +94,7 @@ func (hd MonitorProjectHandler) Add(c *gin.Context) {
// @Param projectKey body string false "项目uuid." // @Param projectKey body string false "项目uuid."
// @Param projectName body string false "项目名称." // @Param projectName body string false "项目名称."
// @Param projectType body string false "项目类型go java web node php 等." // @Param projectType body string false "项目类型go java web node php 等."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_project/edit [post] // @Router /api/admin/monitor_project/edit [post]
func (hd MonitorProjectHandler) Edit(c *gin.Context) { func (hd MonitorProjectHandler) Edit(c *gin.Context) {
var editReq MonitorProjectEditReq var editReq MonitorProjectEditReq
@@ -109,7 +109,7 @@ func (hd MonitorProjectHandler) Edit(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id body int false "项目id." // @Param id body int false "项目id."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_project/del [post] // @Router /api/admin/monitor_project/del [post]
func (hd MonitorProjectHandler) Del(c *gin.Context) { func (hd MonitorProjectHandler) Del(c *gin.Context) {
var delReq MonitorProjectDelReq var delReq MonitorProjectDelReq

View File

@@ -85,7 +85,7 @@ func (hd MonitorWebHandler) Detail(c *gin.Context) {
// @Param message body string false "错误消息." // @Param message body string false "错误消息."
// @Param stack body string false "错误堆栈." // @Param stack body string false "错误堆栈."
// @Param clientTime body int false "客户端时间." // @Param clientTime body int false "客户端时间."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_web/add [post] // @Router /api/admin/monitor_web/add [post]
func (hd MonitorWebHandler) Add(c *gin.Context) { func (hd MonitorWebHandler) Add(c *gin.Context) {
var addReq MonitorWebAddReq var addReq MonitorWebAddReq
@@ -107,7 +107,7 @@ func (hd MonitorWebHandler) Add(c *gin.Context) {
// @Param message body string false "错误消息." // @Param message body string false "错误消息."
// @Param stack body string false "错误堆栈." // @Param stack body string false "错误堆栈."
// @Param clientTime body int false "客户端时间." // @Param clientTime body int false "客户端时间."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_web/edit [post] // @Router /api/admin/monitor_web/edit [post]
func (hd MonitorWebHandler) Edit(c *gin.Context) { func (hd MonitorWebHandler) Edit(c *gin.Context) {
var editReq MonitorWebEditReq var editReq MonitorWebEditReq
@@ -122,7 +122,7 @@ func (hd MonitorWebHandler) Edit(c *gin.Context) {
// @Produce json // @Produce json
// @Param Token header string true "token" // @Param Token header string true "token"
// @Param id body int false "uuid." // @Param id body int false "uuid."
// @Success 200 {object} response.RespType "成功" // @Success 200 {object} response.Response "成功"
// @Router /api/admin/monitor_web/del [post] // @Router /api/admin/monitor_web/del [post]
func (hd MonitorWebHandler) Del(c *gin.Context) { func (hd MonitorWebHandler) Del(c *gin.Context) {
var delReq MonitorWebDelReq var delReq MonitorWebDelReq

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -97,6 +97,11 @@ func (tu toolsUtil) GoToTsType(s string) string {
return "string" return "string"
} }
// 拼接字符串
func (tu toolsUtil) GetPageResp(s string) string {
return `response.Response{ data=response.PageResp{ lists= []` + s + `Resp}}`
}
// Round float四舍五入 // Round float四舍五入
func (tu toolsUtil) Round(val float64, n int) float64 { func (tu toolsUtil) Round(val float64, n int) float64 {
base := math.Pow(10, float64(n)) base := math.Pow(10, float64(n))