|
@@ -0,0 +1,147 @@
|
|
|
+package autocode
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
|
+ "github.com/flipped-aurora/gin-vue-admin/server/model/autocode"
|
|
|
+ autocodeReq "github.com/flipped-aurora/gin-vue-admin/server/model/autocode/request"
|
|
|
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
|
|
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
|
|
|
+ "github.com/flipped-aurora/gin-vue-admin/server/service"
|
|
|
+ "github.com/flipped-aurora/gin-vue-admin/server/utils"
|
|
|
+ "github.com/gin-gonic/gin"
|
|
|
+ "go.uber.org/zap"
|
|
|
+)
|
|
|
+
|
|
|
+type ProblemReplyApi struct {
|
|
|
+}
|
|
|
+
|
|
|
+var problemReplyService = service.ServiceGroupApp.AutoCodeServiceGroup.ProblemReplyService
|
|
|
+
|
|
|
+// CreateProblemReply 创建ProblemReply
|
|
|
+// @Tags ProblemReply
|
|
|
+// @Summary 创建ProblemReply
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Param data body autocode.ProblemReply true "创建ProblemReply"
|
|
|
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
|
|
+// @Router /problemReply/createProblemReply [post]
|
|
|
+func (problemReplyApi *ProblemReplyApi) CreateProblemReply(c *gin.Context) {
|
|
|
+ var problemReply autocode.ProblemReply
|
|
|
+ _ = c.ShouldBindJSON(&problemReply)
|
|
|
+ _, user := service.ServiceGroupApp.SystemServiceGroup.GetUserInfo(utils.GetUserUuid(c))
|
|
|
+ problemReply.HeaderImg = user.HeaderImg
|
|
|
+ problemReply.Uuid = user.UUID
|
|
|
+ problemReply.NickName = user.NickName
|
|
|
+ if err := problemReplyService.CreateProblemReply(problemReply); err != nil {
|
|
|
+ global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
|
|
|
+ response.FailWithMessage("创建失败", c)
|
|
|
+ } else {
|
|
|
+ response.OkWithMessage("创建成功", c)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// DeleteProblemReply 删除ProblemReply
|
|
|
+// @Tags ProblemReply
|
|
|
+// @Summary 删除ProblemReply
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Param data body autocode.ProblemReply true "删除ProblemReply"
|
|
|
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
|
|
+// @Router /problemReply/deleteProblemReply [delete]
|
|
|
+func (problemReplyApi *ProblemReplyApi) DeleteProblemReply(c *gin.Context) {
|
|
|
+ var problemReply autocode.ProblemReply
|
|
|
+ _ = c.ShouldBindJSON(&problemReply)
|
|
|
+ if err := problemReplyService.DeleteProblemReply(problemReply); err != nil {
|
|
|
+ global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
|
|
+ response.FailWithMessage("删除失败", c)
|
|
|
+ } else {
|
|
|
+ response.OkWithMessage("删除成功", c)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// DeleteProblemReplyByIds 批量删除ProblemReply
|
|
|
+// @Tags ProblemReply
|
|
|
+// @Summary 批量删除ProblemReply
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Param data body request.IdsReq true "批量删除ProblemReply"
|
|
|
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
|
|
|
+// @Router /problemReply/deleteProblemReplyByIds [delete]
|
|
|
+func (problemReplyApi *ProblemReplyApi) DeleteProblemReplyByIds(c *gin.Context) {
|
|
|
+ var IDS request.IdsReq
|
|
|
+ _ = c.ShouldBindJSON(&IDS)
|
|
|
+ if err := problemReplyService.DeleteProblemReplyByIds(IDS); err != nil {
|
|
|
+ global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
|
|
|
+ response.FailWithMessage("批量删除失败", c)
|
|
|
+ } else {
|
|
|
+ response.OkWithMessage("批量删除成功", c)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateProblemReply 更新ProblemReply
|
|
|
+// @Tags ProblemReply
|
|
|
+// @Summary 更新ProblemReply
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Param data body autocode.ProblemReply true "更新ProblemReply"
|
|
|
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
|
|
+// @Router /problemReply/updateProblemReply [put]
|
|
|
+func (problemReplyApi *ProblemReplyApi) UpdateProblemReply(c *gin.Context) {
|
|
|
+ var problemReply autocode.ProblemReply
|
|
|
+ _ = c.ShouldBindJSON(&problemReply)
|
|
|
+ if err := problemReplyService.UpdateProblemReply(problemReply); err != nil {
|
|
|
+ global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
|
|
|
+ response.FailWithMessage("更新失败", c)
|
|
|
+ } else {
|
|
|
+ response.OkWithMessage("更新成功", c)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// FindProblemReply 用id查询ProblemReply
|
|
|
+// @Tags ProblemReply
|
|
|
+// @Summary 用id查询ProblemReply
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Param data query autocode.ProblemReply true "用id查询ProblemReply"
|
|
|
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
|
|
+// @Router /problemReply/findProblemReply [get]
|
|
|
+func (problemReplyApi *ProblemReplyApi) FindProblemReply(c *gin.Context) {
|
|
|
+ var problemReply autocode.ProblemReply
|
|
|
+ _ = c.ShouldBindQuery(&problemReply)
|
|
|
+ if err, reproblemReply := problemReplyService.GetProblemReply(problemReply.ID); err != nil {
|
|
|
+ global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
|
|
|
+ response.FailWithMessage("查询失败", c)
|
|
|
+ } else {
|
|
|
+ response.OkWithData(gin.H{"reproblemReply": reproblemReply}, c)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// GetProblemReplyList 分页获取ProblemReply列表
|
|
|
+// @Tags ProblemReply
|
|
|
+// @Summary 分页获取ProblemReply列表
|
|
|
+// @Security ApiKeyAuth
|
|
|
+// @accept application/json
|
|
|
+// @Produce application/json
|
|
|
+// @Param data query autocodeReq.ProblemReplySearch true "分页获取ProblemReply列表"
|
|
|
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
|
|
+// @Router /problemReply/getProblemReplyList [get]
|
|
|
+func (problemReplyApi *ProblemReplyApi) GetProblemReplyList(c *gin.Context) {
|
|
|
+ var pageInfo autocodeReq.ProblemReplySearch
|
|
|
+ _ = c.ShouldBindQuery(&pageInfo)
|
|
|
+ if err, list, total := problemReplyService.GetProblemReplyInfoList(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)
|
|
|
+ }
|
|
|
+}
|