wk_process.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. package v1
  2. import (
  3. "fmt"
  4. "gin-vue-admin/model"
  5. "gin-vue-admin/model/request"
  6. "gin-vue-admin/model/response"
  7. "gin-vue-admin/service"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // @Tags WorkflowProcess
  11. // @Summary 创建WorkflowProcess
  12. // @Security ApiKeyAuth
  13. // @accept application/json
  14. // @Produce application/json
  15. // @Param data body model.WorkflowProcess true "创建WorkflowProcess"
  16. // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
  17. // @Router /workflowProcess/createWorkflowProcess [post]
  18. func CreateWorkflowProcess(c *gin.Context) {
  19. var workflowProcess model.WorkflowProcess
  20. _ = c.ShouldBindJSON(&workflowProcess)
  21. err := service.CreateWorkflowProcess(workflowProcess)
  22. if err != nil {
  23. response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
  24. } else {
  25. response.OkWithMessage("创建成功", c)
  26. }
  27. }
  28. // @Tags WorkflowProcess
  29. // @Summary 删除WorkflowProcess
  30. // @Security ApiKeyAuth
  31. // @accept application/json
  32. // @Produce application/json
  33. // @Param data body model.WorkflowProcess true "删除WorkflowProcess"
  34. // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
  35. // @Router /workflowProcess/deleteWorkflowProcess [delete]
  36. func DeleteWorkflowProcess(c *gin.Context) {
  37. var workflowProcess model.WorkflowProcess
  38. _ = c.ShouldBindJSON(&workflowProcess)
  39. err := service.DeleteWorkflowProcess(workflowProcess)
  40. if err != nil {
  41. response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
  42. } else {
  43. response.OkWithMessage("删除成功", c)
  44. }
  45. }
  46. // @Tags WorkflowProcess
  47. // @Summary 批量删除WorkflowProcess
  48. // @Security ApiKeyAuth
  49. // @accept application/json
  50. // @Produce application/json
  51. // @Param data body request.IdsReq true "批量删除WorkflowProcess"
  52. // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
  53. // @Router /workflowProcess/deleteWorkflowProcessByIds [delete]
  54. func DeleteWorkflowProcessByIds(c *gin.Context) {
  55. var IDS request.IdsReq
  56. _ = c.ShouldBindJSON(&IDS)
  57. err := service.DeleteWorkflowProcessByIds(IDS)
  58. if err != nil {
  59. response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
  60. } else {
  61. response.OkWithMessage("删除成功", c)
  62. }
  63. }
  64. // @Tags WorkflowProcess
  65. // @Summary 更新WorkflowProcess
  66. // @Security ApiKeyAuth
  67. // @accept application/json
  68. // @Produce application/json
  69. // @Param data body model.WorkflowProcess true "更新WorkflowProcess"
  70. // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
  71. // @Router /workflowProcess/updateWorkflowProcess [put]
  72. func UpdateWorkflowProcess(c *gin.Context) {
  73. var workflowProcess model.WorkflowProcess
  74. _ = c.ShouldBindJSON(&workflowProcess)
  75. err := service.UpdateWorkflowProcess(&workflowProcess)
  76. if err != nil {
  77. response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c)
  78. } else {
  79. response.OkWithMessage("更新成功", c)
  80. }
  81. }
  82. // @Tags WorkflowProcess
  83. // @Summary 用id查询WorkflowProcess
  84. // @Security ApiKeyAuth
  85. // @accept application/json
  86. // @Produce application/json
  87. // @Param data body model.WorkflowProcess true "用id查询WorkflowProcess"
  88. // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
  89. // @Router /workflowProcess/findWorkflowProcess [get]
  90. func FindWorkflowProcess(c *gin.Context) {
  91. var workflowProcess model.WorkflowProcess
  92. _ = c.ShouldBindQuery(&workflowProcess)
  93. err, reworkflowProcess := service.GetWorkflowProcess(workflowProcess.ID)
  94. if err != nil {
  95. response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
  96. } else {
  97. response.OkWithData(gin.H{"reworkflowProcess": reworkflowProcess}, c)
  98. }
  99. }
  100. // @Tags WorkflowProcess
  101. // @Summary 用id查询工作流步骤
  102. // @Security ApiKeyAuth
  103. // @accept application/json
  104. // @Produce application/json
  105. // @Param data body model.WorkflowProcess true "用id查询WorkflowProcess"
  106. // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
  107. // @Router /workflowProcess/findWorkflowStep [get]
  108. func FindWorkflowStep(c *gin.Context) {
  109. var workflowProcess model.WorkflowProcess
  110. _ = c.ShouldBindQuery(&workflowProcess)
  111. err, workflow := service.FindWorkflowStep(workflowProcess.ID)
  112. if err != nil {
  113. response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
  114. } else {
  115. response.OkWithData(gin.H{"workflow": workflow}, c)
  116. }
  117. }
  118. // @Tags WorkflowProcess
  119. // @Summary 分页获取WorkflowProcess列表
  120. // @Security ApiKeyAuth
  121. // @accept application/json
  122. // @Produce application/json
  123. // @Param data body request.WorkflowProcessSearch true "分页获取WorkflowProcess列表"
  124. // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
  125. // @Router /workflowProcess/getWorkflowProcessList [get]
  126. func GetWorkflowProcessList(c *gin.Context) {
  127. var pageInfo request.WorkflowProcessSearch
  128. _ = c.ShouldBindQuery(&pageInfo)
  129. err, list, total := service.GetWorkflowProcessInfoList(pageInfo)
  130. if err != nil {
  131. response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
  132. } else {
  133. response.OkWithData(response.PageResult{
  134. List: list,
  135. Total: total,
  136. Page: pageInfo.Page,
  137. PageSize: pageInfo.PageSize,
  138. }, c)
  139. }
  140. }