package com.njcn.system.api;


import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.system.api.fallback.DicDataFeignClientFallbackFactory;

import com.njcn.system.pojo.po.DictData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.awt.image.RenderedImage;
import java.util.List;


/**
 * pqs
 *
 * @author cdf
 * @date 2021/6/24
 */
@FeignClient(value = ServerInfo.SYSTEM, path = "/dictData", fallbackFactory = DicDataFeignClientFallbackFactory.class, contextId = "dictData")
public interface DicDataFeignClient {

    @GetMapping("/getDicDataById")
    HttpResult<DictData> getDicDataById(@RequestParam("dicIndex") String dicIndex);

    @GetMapping("/getDicDataByName")
    HttpResult<DictData> getDicDataByName(@RequestParam("dicName") String dicName);

    @GetMapping("/getDicDataByNameAndType")
    HttpResult<DictData> getDicDataByNameAndType(@RequestParam("dicName") String dicName ,@RequestParam("typeName") String typeName);

    @GetMapping("/getDicDataByCode")
    HttpResult<DictData> getDicDataByCode(@RequestParam("code") String code);

    @GetMapping("/getLoadTypeBySys")
    HttpResult<List<DictData>> getLoadTypeBySys();

    /**
     * 后台新增字典数据
     *
     * @param dicTypeName 类型名称
     * @param dicDataName 数据名称
     * @return 新增后的字典数据
     */
    @GetMapping("/addDicData")
    HttpResult<DictData> addDicData(@RequestParam("dicTypeName") String dicTypeName, @RequestParam("dicDataName") String dicDataName);

    /**
     * 根据字典类型名称&数据名称获取字典数据
     *
     * @param dicTypeName 字典类型名称
     * @param dicDataName 字典数据名称
     * @return 字典数据
     */
    @GetMapping("/getDicDataByNameAndTypeName")
    HttpResult<DictData> getDicDataByNameAndTypeName(@RequestParam("dicTypeName") String dicTypeName, @RequestParam("dicDataName") String dicDataName);


    /**
     * 根据数据code&&字典类型code获取字典数据
     *
     * @param dicDataCode 字典数据名称
     * @param dicTypeCode 字典类型名称
     * @return 字典数据
     */
    @GetMapping("/getDicDataByCodeAndType")
    HttpResult<DictData> getDicDataByCodeAndType(@RequestParam("dicDataCode") String dicDataCode, @RequestParam("dicTypeCode") String dicTypeCode);


    /***
     * 字典类型
     */
    @GetMapping("/getDicDataByTypeName")
    HttpResult<List<DictData>> getDicDataByTypeName(@RequestParam("dictTypeName") String dictTypeName);

    @GetMapping("/getDicDataByTypeCode")
    HttpResult<List<DictData>> getDicDataByTypeCode(@RequestParam("dictTypeCode") String dictTypeCode);
}
