package controller

import (
	"github.com/gin-gonic/gin"
	"iot_manager_service/app/system/service"
	"iot_manager_service/util/common"
	"net/http"
)

var Dict = new(dict)

type dict struct{}

func (c *dict) Dictionary(ctx *gin.Context) {
	code := ctx.Query("code")
	result, err := service.DictService.GetByCode(code)
	if err != nil {
		ctx.JSON(http.StatusOK, common.FailResponse(err.Error(), nil))
		return
	}
	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Success, result))
}
