package cclotus.cloud.gateway.web

import com.ruoyi.common.core.domain.AjaxResult
import com.ruoyi.system.service.ISysDictTypeService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * 小程序字典相关接口
 */
@RestController
@RequestMapping("/dict")
class DictController {

    @Autowired
    lateinit var dictTypeService: ISysDictTypeService

    /**
     * 根据字典类型查询字典数据信息
     */
    @GetMapping(value = ["/type/{dictType}"])
    fun dictType(@PathVariable dictType: String): AjaxResult {
        val data = dictTypeService.selectDictDataByType(dictType) ?: emptyList()
        return AjaxResult.success(data)
    }
}