package com.sptg.permissions.api.feigns;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.permissions.api.dto.DictDto;
import com.sptg.permissions.api.entity.Dict;
import com.sptg.permissions.api.feigns.fallback.DictFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
/**
 * title: DictFeign
 * package: com.sptg.permissions.api.feigns
 * description: 数字字典-对外服务接口
 *
 *
 *
 */
@FeignClient(value = "smart-house-permissions",fallbackFactory = DictFeignFallbackFactory.class)
public interface DictFeign {
    /**
     * 功能描述: 获取所有的字典树形列表
     * @return ResultBean<Dict>
     *
     * date:  2018/11/2 0:40
     */
    @GetMapping(value = "/dict/getDictTreeList")
    ResultBean<Dict> getDictTreeList();

    /**
     * 功能描述: 创建字典
     * @param dictDto 字典信息
     * @return ResultBean<Boolean> ：{ true：成功,false：失败 }
     *
     *
     */
    @PostMapping(value = "/dict/insertDict")
    ResultBean<Boolean> insertDict(DictDto dictDto);

    /**
     * 功能描述: 修改字典
     * @param dictDto 字典信息
     * @return ResultBean<Boolean> ：{ true：成功,false：失败 }
     *
     * date:  2018/11/4 18:56
     */
    @PostMapping(value = "/dict/updateDict")
    ResultBean<Boolean> updateDict(DictDto dictDto);

    /**
     * 功能描述: 删除字典
     * @param dictDto
     * @return ResultBean<Boolean> ：{ true：成功,false：失败 }
     *
     *
     */
    @PostMapping(value = "/dict/deleteDict")
    ResultBean<Boolean> deleteDict(DictDto dictDto);

    @GetMapping(value = "/dict/selectById")
    Dict selectById(@RequestBody Long id);

    @PostMapping(value = "/dict/getByCode")
    ResultBean<Dict> getByCode(@RequestBody String code);
}
