|
| 1 | +package v1 |
| 2 | + |
| 3 | +import ( |
| 4 | +"fmt" |
| 5 | +"gin-vue-admin/global/response" |
| 6 | +"gin-vue-admin/model" |
| 7 | +"gin-vue-admin/model/request" |
| 8 | +resp "gin-vue-admin/model/response" |
| 9 | +"gin-vue-admin/service" |
| 10 | +"github.com/gin-gonic/gin" |
| 11 | +) |
| 12 | + |
| 13 | +// @Tags SysDictionaryDetail |
| 14 | +// @Summary 创建SysDictionaryDetail |
| 15 | +// @Security ApiKeyAuth |
| 16 | +// @accept application/json |
| 17 | +// @Produce application/json |
| 18 | +// @Param data body model.SysDictionaryDetail true "创建SysDictionaryDetail" |
| 19 | +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" |
| 20 | +// @Router /sysDictionaryDetail/createSysDictionaryDetail [post] |
| 21 | +func CreateSysDictionaryDetail(c *gin.Context) { |
| 22 | +var sysDictionaryDetail model.SysDictionaryDetail |
| 23 | +_ = c.ShouldBindJSON(&sysDictionaryDetail) |
| 24 | +err := service.CreateSysDictionaryDetail(sysDictionaryDetail) |
| 25 | +if err != nil { |
| 26 | +response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c) |
| 27 | +} else { |
| 28 | +response.OkWithMessage("创建成功", c) |
| 29 | +} |
| 30 | +} |
| 31 | + |
| 32 | +// @Tags SysDictionaryDetail |
| 33 | +// @Summary 删除SysDictionaryDetail |
| 34 | +// @Security ApiKeyAuth |
| 35 | +// @accept application/json |
| 36 | +// @Produce application/json |
| 37 | +// @Param data body model.SysDictionaryDetail true "删除SysDictionaryDetail" |
| 38 | +// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" |
| 39 | +// @Router /sysDictionaryDetail/deleteSysDictionaryDetail [delete] |
| 40 | +func DeleteSysDictionaryDetail(c *gin.Context) { |
| 41 | +var sysDictionaryDetail model.SysDictionaryDetail |
| 42 | +_ = c.ShouldBindJSON(&sysDictionaryDetail) |
| 43 | +err := service.DeleteSysDictionaryDetail(sysDictionaryDetail) |
| 44 | +if err != nil { |
| 45 | +response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c) |
| 46 | +} else { |
| 47 | +response.OkWithMessage("删除成功", c) |
| 48 | +} |
| 49 | +} |
| 50 | + |
| 51 | +// @Tags SysDictionaryDetail |
| 52 | +// @Summary 更新SysDictionaryDetail |
| 53 | +// @Security ApiKeyAuth |
| 54 | +// @accept application/json |
| 55 | +// @Produce application/json |
| 56 | +// @Param data body model.SysDictionaryDetail true "更新SysDictionaryDetail" |
| 57 | +// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" |
| 58 | +// @Router /sysDictionaryDetail/updateSysDictionaryDetail [put] |
| 59 | +func UpdateSysDictionaryDetail(c *gin.Context) { |
| 60 | +var sysDictionaryDetail model.SysDictionaryDetail |
| 61 | +_ = c.ShouldBindJSON(&sysDictionaryDetail) |
| 62 | +err := service.UpdateSysDictionaryDetail(&sysDictionaryDetail) |
| 63 | +if err != nil { |
| 64 | +response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c) |
| 65 | +} else { |
| 66 | +response.OkWithMessage("更新成功", c) |
| 67 | +} |
| 68 | +} |
| 69 | + |
| 70 | +// @Tags SysDictionaryDetail |
| 71 | +// @Summary 用id查询SysDictionaryDetail |
| 72 | +// @Security ApiKeyAuth |
| 73 | +// @accept application/json |
| 74 | +// @Produce application/json |
| 75 | +// @Param data body model.SysDictionaryDetail true "用id查询SysDictionaryDetail" |
| 76 | +// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" |
| 77 | +// @Router /sysDictionaryDetail/findSysDictionaryDetail [get] |
| 78 | +func FindSysDictionaryDetail(c *gin.Context) { |
| 79 | +var sysDictionaryDetail model.SysDictionaryDetail |
| 80 | +_ = c.ShouldBindQuery(&sysDictionaryDetail) |
| 81 | +err, resysDictionaryDetail := service.GetSysDictionaryDetail(sysDictionaryDetail.ID) |
| 82 | +if err != nil { |
| 83 | +response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c) |
| 84 | +} else { |
| 85 | +response.OkWithData(gin.H{"resysDictionaryDetail": resysDictionaryDetail}, c) |
| 86 | +} |
| 87 | +} |
| 88 | + |
| 89 | +// @Tags SysDictionaryDetail |
| 90 | +// @Summary 分页获取SysDictionaryDetail列表 |
| 91 | +// @Security ApiKeyAuth |
| 92 | +// @accept application/json |
| 93 | +// @Produce application/json |
| 94 | +// @Param data body request.SysDictionaryDetailSearch true "分页获取SysDictionaryDetail列表" |
| 95 | +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" |
| 96 | +// @Router /sysDictionaryDetail/getSysDictionaryDetailList [get] |
| 97 | +func GetSysDictionaryDetailList(c *gin.Context) { |
| 98 | +var pageInfo request.SysDictionaryDetailSearch |
| 99 | +_ = c.ShouldBindQuery(&pageInfo) |
| 100 | +err, list, total := service.GetSysDictionaryDetailInfoList(pageInfo) |
| 101 | +if err != nil { |
| 102 | +response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c) |
| 103 | +} else { |
| 104 | +response.OkWithData(resp.PageResult{ |
| 105 | +List: list, |
| 106 | +Total: total, |
| 107 | +Page: pageInfo.Page, |
| 108 | +PageSize: pageInfo.PageSize, |
| 109 | +}, c) |
| 110 | +} |
| 111 | +} |
0 commit comments