package v1 import ( "gin-vue-admin/global" "gin-vue-admin/model" "gin-vue-admin/model/request" "gin-vue-admin/model/response" "gin-vue-admin/service" "gin-vue-admin/utils" "github.com/gin-gonic/gin" "go.uber.org/zap" ) // @Tags SysOperationRecord // @Summary 创建SysOperationRecord // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body model.SysOperationRecord true "创建SysOperationRecord" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /sysOperationRecord/createSysOperationRecord [post] func CreateSysOperationRecord(c *gin.Context) { var sysOperationRecord model.SysOperationRecord _ = c.ShouldBindJSON(&sysOperationRecord) if err := service.CreateSysOperationRecord(sysOperationRecord); err != nil { global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) response.FailWithMessage("创建失败", c) } else { response.OkWithMessage("创建成功", c) } } // @Tags SysOperationRecord // @Summary 删除SysOperationRecord // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body model.SysOperationRecord true "SysOperationRecord模型" // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" // @Router /sysOperationRecord/deleteSysOperationRecord [delete] func DeleteSysOperationRecord(c *gin.Context) { var sysOperationRecord model.SysOperationRecord _ = c.ShouldBindJSON(&sysOperationRecord) if err := service.DeleteSysOperationRecord(sysOperationRecord); err != nil { global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) response.FailWithMessage("删除失败", c) } else { response.OkWithMessage("删除成功", c) } } // @Tags SysOperationRecord // @Summary 批量删除SysOperationRecord // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body request.IdsReq true "批量删除SysOperationRecord" // @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}" // @Router /sysOperationRecord/deleteSysOperationRecordByIds [delete] func DeleteSysOperationRecordByIds(c *gin.Context) { var IDS request.IdsReq _ = c.ShouldBindJSON(&IDS) if err := service.DeleteSysOperationRecordByIds(IDS); err != nil { global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err)) response.FailWithMessage("批量删除失败", c) } else { response.OkWithMessage("批量删除成功", c) } } // @Tags SysOperationRecord // @Summary 用id查询SysOperationRecord // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body model.SysOperationRecord true "Id" // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" // @Router /sysOperationRecord/findSysOperationRecord [get] func FindSysOperationRecord(c *gin.Context) { var sysOperationRecord model.SysOperationRecord _ = c.ShouldBindQuery(&sysOperationRecord) if err := utils.Verify(sysOperationRecord, utils.IdVerify); err != nil { response.FailWithMessage(err.Error(), c) return } if err, resysOperationRecord := service.GetSysOperationRecord(sysOperationRecord.ID); err != nil { global.GVA_LOG.Error("查询失败!", zap.Any("err", err)) response.FailWithMessage("查询失败", c) } else { response.OkWithDetailed(gin.H{"resysOperationRecord": resysOperationRecord}, "查询成功", c) } } // @Tags SysOperationRecord // @Summary 分页获取SysOperationRecord列表 // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body request.SysOperationRecordSearch true "页码, 每页大小, 搜索条件" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /sysOperationRecord/getSysOperationRecordList [get] func GetSysOperationRecordList(c *gin.Context) { var pageInfo request.SysOperationRecordSearch _ = c.ShouldBindQuery(&pageInfo) if err, list, total := service.GetSysOperationRecordInfoList(pageInfo); err != nil { global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) response.FailWithMessage("获取失败", c) } else { response.OkWithDetailed(response.PageResult{ List: list, Total: total, Page: pageInfo.Page, PageSize: pageInfo.PageSize, }, "获取成功", c) } }