package com.trade.client.system.controller;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.trade.common.core.domain.ResponseResult;
import com.trade.common.utils.StringUtils;
import com.trade.service.system.domain.SysDictData;
import com.trade.service.system.service.ISysDictTypeService;

/**
 * 数据字典信息
 * 
 * @author wl
 */
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController {

    @Autowired
    private ISysDictTypeService dictTypeService;

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