package com.huashe.park.application.web.controller.system;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

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;

import com.huashe.common.domain.AjaxResult;
import com.huashe.common.utils.StringUtils;
import com.huashe.park.core.service.ISysCustDictDataService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;

/**
 * 数据字典信息
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/system/cust/dict/data")
public class SysCustDictDataController extends BaseController {

    @Autowired
    private ISysCustDictDataService dictTypeService;

    /**
     * 根据字典类型查询字典数据信息
     */
    @GetMapping(value = "/type/{dictType}")
    @Anonymous
    public AjaxResult dictType(@PathVariable String dictType) {
        List<Map> data = dictTypeService.selectDictDataList(dictType);
        if (StringUtils.isNull(data)) {
            data = new ArrayList<>();
        }
        return success(data);
    }

}
