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.
111 lines
3.9 KiB
111 lines
3.9 KiB
package v1
|
|
|
|
import (
|
|
"fmt"
|
|
"gin-vue-admin/global/response"
|
|
"gin-vue-admin/model"
|
|
"gin-vue-admin/model/request"
|
|
resp "gin-vue-admin/model/response"
|
|
"gin-vue-admin/service"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// @Tags SysDictionaryDetail
|
|
// @Summary 创建SysDictionaryDetail
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body model.SysDictionaryDetail true "创建SysDictionaryDetail"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
|
// @Router /sysDictionaryDetail/createSysDictionaryDetail [post]
|
|
func CreateSysDictionaryDetail(c *gin.Context) {
|
|
var sysDictionaryDetail model.SysDictionaryDetail
|
|
_ = c.ShouldBindJSON(&sysDictionaryDetail)
|
|
err := service.CreateSysDictionaryDetail(sysDictionaryDetail)
|
|
if err != nil {
|
|
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
|
|
} else {
|
|
response.OkWithMessage("创建成功", c)
|
|
}
|
|
}
|
|
|
|
// @Tags SysDictionaryDetail
|
|
// @Summary 删除SysDictionaryDetail
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body model.SysDictionaryDetail true "删除SysDictionaryDetail"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
|
// @Router /sysDictionaryDetail/deleteSysDictionaryDetail [delete]
|
|
func DeleteSysDictionaryDetail(c *gin.Context) {
|
|
var sysDictionaryDetail model.SysDictionaryDetail
|
|
_ = c.ShouldBindJSON(&sysDictionaryDetail)
|
|
err := service.DeleteSysDictionaryDetail(sysDictionaryDetail)
|
|
if err != nil {
|
|
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
|
|
} else {
|
|
response.OkWithMessage("删除成功", c)
|
|
}
|
|
}
|
|
|
|
// @Tags SysDictionaryDetail
|
|
// @Summary 更新SysDictionaryDetail
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body model.SysDictionaryDetail true "更新SysDictionaryDetail"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
|
// @Router /sysDictionaryDetail/updateSysDictionaryDetail [put]
|
|
func UpdateSysDictionaryDetail(c *gin.Context) {
|
|
var sysDictionaryDetail model.SysDictionaryDetail
|
|
_ = c.ShouldBindJSON(&sysDictionaryDetail)
|
|
err := service.UpdateSysDictionaryDetail(&sysDictionaryDetail)
|
|
if err != nil {
|
|
response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c)
|
|
} else {
|
|
response.OkWithMessage("更新成功", c)
|
|
}
|
|
}
|
|
|
|
// @Tags SysDictionaryDetail
|
|
// @Summary 用id查询SysDictionaryDetail
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body model.SysDictionaryDetail true "用id查询SysDictionaryDetail"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
|
// @Router /sysDictionaryDetail/findSysDictionaryDetail [get]
|
|
func FindSysDictionaryDetail(c *gin.Context) {
|
|
var sysDictionaryDetail model.SysDictionaryDetail
|
|
_ = c.ShouldBindQuery(&sysDictionaryDetail)
|
|
err, resysDictionaryDetail := service.GetSysDictionaryDetail(sysDictionaryDetail.ID)
|
|
if err != nil {
|
|
response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
|
|
} else {
|
|
response.OkWithData(gin.H{"resysDictionaryDetail": resysDictionaryDetail}, c)
|
|
}
|
|
}
|
|
|
|
// @Tags SysDictionaryDetail
|
|
// @Summary 分页获取SysDictionaryDetail列表
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Param data body request.SysDictionaryDetailSearch true "分页获取SysDictionaryDetail列表"
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
|
// @Router /sysDictionaryDetail/getSysDictionaryDetailList [get]
|
|
func GetSysDictionaryDetailList(c *gin.Context) {
|
|
var pageInfo request.SysDictionaryDetailSearch
|
|
_ = c.ShouldBindQuery(&pageInfo)
|
|
err, list, total := service.GetSysDictionaryDetailInfoList(pageInfo)
|
|
if err != nil {
|
|
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
|
|
} else {
|
|
response.OkWithData(resp.PageResult{
|
|
List: list,
|
|
Total: total,
|
|
Page: pageInfo.Page,
|
|
PageSize: pageInfo.PageSize,
|
|
}, c)
|
|
}
|
|
}
|