123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- 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"
- )
- 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)
- }
- }
- 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)
- }
- }
- 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)
- }
- }
- 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)
- }
- }
- 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)
- }
- }
|