approveflow/app/http/module/flow_definition/api_definition_query.go

35 lines
1.1 KiB
Go
Raw Normal View History

2024-11-14 17:02:41 +08:00
package flow_definition
import (
"approveflow/app/http/base/res"
"approveflow/app/provider/flow_definition"
"approveflow/app/utils"
"github.com/Superdanda/hade/framework/gin"
)
type DefinitionQueryParam struct {
ID int64 `json:"id"`
}
// DefinitionQuery 获取单个流程定义
// @Summary 查询单个流程定义
// @Description 根据ID查询流程定义详情
// @ID flow-definition-query
// @Tags flow-definition
// @Accept json
// @Produce json
// @Param DefinitionQueryParam body DefinitionQueryParam true "查询详情请求参数"
// @Success 200 {object} base.Result{data=ApprovalFlowDTO} "返回成功的流程定义数据"
// @Failure 500 {object} base.Result "操作失败"
// @Router /definition/query [post]
func (a FlowDefinitionApi) DefinitionQuery(context *gin.Context) {
param := utils.QuickBind[DefinitionQueryParam](context)
definitionService := context.MustMake(flow_definition.FlowDefinitionKey).(flow_definition.Service)
flow, err := definitionService.GetFlow(context, param.ID)
if err != nil {
res.FailWithErr(context, err)
return
}
res.SuccessWithData(context, flow)
}