You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
4.2 KiB

  1. package v1
  2. import (
  3. "gin-vue-admin/global"
  4. "gin-vue-admin/model"
  5. "gin-vue-admin/model/request"
  6. "gin-vue-admin/model/response"
  7. "gin-vue-admin/service"
  8. "gin-vue-admin/utils"
  9. "github.com/gin-gonic/gin"
  10. "go.uber.org/zap"
  11. )
  12. // @Tags SysOperationRecord
  13. // @Summary 创建SysOperationRecord
  14. // @Security ApiKeyAuth
  15. // @accept application/json
  16. // @Produce application/json
  17. // @Param data body model.SysOperationRecord true "创建SysOperationRecord"
  18. // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
  19. // @Router /sysOperationRecord/createSysOperationRecord [post]
  20. func CreateSysOperationRecord(c *gin.Context) {
  21. var sysOperationRecord model.SysOperationRecord
  22. _ = c.ShouldBindJSON(&sysOperationRecord)
  23. if err := service.CreateSysOperationRecord(sysOperationRecord); err != nil {
  24. global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
  25. response.FailWithMessage("创建失败", c)
  26. } else {
  27. response.OkWithMessage("创建成功", c)
  28. }
  29. }
  30. // @Tags SysOperationRecord
  31. // @Summary 删除SysOperationRecord
  32. // @Security ApiKeyAuth
  33. // @accept application/json
  34. // @Produce application/json
  35. // @Param data body model.SysOperationRecord true "SysOperationRecord模型"
  36. // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
  37. // @Router /sysOperationRecord/deleteSysOperationRecord [delete]
  38. func DeleteSysOperationRecord(c *gin.Context) {
  39. var sysOperationRecord model.SysOperationRecord
  40. _ = c.ShouldBindJSON(&sysOperationRecord)
  41. if err := service.DeleteSysOperationRecord(sysOperationRecord); err != nil {
  42. global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
  43. response.FailWithMessage("删除失败", c)
  44. } else {
  45. response.OkWithMessage("删除成功", c)
  46. }
  47. }
  48. // @Tags SysOperationRecord
  49. // @Summary 批量删除SysOperationRecord
  50. // @Security ApiKeyAuth
  51. // @accept application/json
  52. // @Produce application/json
  53. // @Param data body request.IdsReq true "批量删除SysOperationRecord"
  54. // @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
  55. // @Router /sysOperationRecord/deleteSysOperationRecordByIds [delete]
  56. func DeleteSysOperationRecordByIds(c *gin.Context) {
  57. var IDS request.IdsReq
  58. _ = c.ShouldBindJSON(&IDS)
  59. if err := service.DeleteSysOperationRecordByIds(IDS); err != nil {
  60. global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
  61. response.FailWithMessage("批量删除失败", c)
  62. } else {
  63. response.OkWithMessage("批量删除成功", c)
  64. }
  65. }
  66. // @Tags SysOperationRecord
  67. // @Summary 用id查询SysOperationRecord
  68. // @Security ApiKeyAuth
  69. // @accept application/json
  70. // @Produce application/json
  71. // @Param data body model.SysOperationRecord true "Id"
  72. // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
  73. // @Router /sysOperationRecord/findSysOperationRecord [get]
  74. func FindSysOperationRecord(c *gin.Context) {
  75. var sysOperationRecord model.SysOperationRecord
  76. _ = c.ShouldBindQuery(&sysOperationRecord)
  77. if err := utils.Verify(sysOperationRecord, utils.IdVerify); err != nil {
  78. response.FailWithMessage(err.Error(), c)
  79. return
  80. }
  81. if err, resysOperationRecord := service.GetSysOperationRecord(sysOperationRecord.ID); err != nil {
  82. global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
  83. response.FailWithMessage("查询失败", c)
  84. } else {
  85. response.OkWithDetailed(gin.H{"resysOperationRecord": resysOperationRecord}, "查询成功", c)
  86. }
  87. }
  88. // @Tags SysOperationRecord
  89. // @Summary 分页获取SysOperationRecord列表
  90. // @Security ApiKeyAuth
  91. // @accept application/json
  92. // @Produce application/json
  93. // @Param data body request.SysOperationRecordSearch true "页码, 每页大小, 搜索条件"
  94. // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
  95. // @Router /sysOperationRecord/getSysOperationRecordList [get]
  96. func GetSysOperationRecordList(c *gin.Context) {
  97. var pageInfo request.SysOperationRecordSearch
  98. _ = c.ShouldBindQuery(&pageInfo)
  99. if err, list, total := service.GetSysOperationRecordInfoList(pageInfo); err != nil {
  100. global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
  101. response.FailWithMessage("获取失败", c)
  102. } else {
  103. response.OkWithDetailed(response.PageResult{
  104. List: list,
  105. Total: total,
  106. Page: pageInfo.Page,
  107. PageSize: pageInfo.PageSize,
  108. }, "获取成功", c)
  109. }
  110. }