package com.njcn.user.api;

import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.user.api.fallback.DeptFeignClientFallbackFactory;
import com.njcn.user.pojo.dto.DeptDTO;
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.RequestParam;

import java.util.List;

/**
 * @author denghuajun
 * @date 2022/1/11
 *  部门相关业务对外接口
 */
@FeignClient(value = ServerInfo.USER, path = "/dept", fallbackFactory = DeptFeignClientFallbackFactory.class)
public interface DeptFeignClient {

    /**
     * 根据条件获取后代部门索引
     * @param id 部门id
     * @param type 指定部门类型
     * @return 后代部门索引
     */
    @PostMapping("/getDeptDescendantIndexes")
    HttpResult<List<DeptDTO>> getDeptDescendantIndexes(@RequestParam("id") String id, @RequestParam("type") List<Integer> type);

    /**
     * 根据区域获取部门id
     * @param area
     * @author xy
     * @return
     */
    @GetMapping("/getDeptIdByArea")
    HttpResult<String> getDeptIdByArea(@RequestParam("area") String area);

    /**
     * 根据部门id获取区域id
     * @param deptId
     * @author denghuajun
     * @return
     */
    @GetMapping("/getAreaIdByDeptId")
    HttpResult<String> getAreaIdByDeptId(@RequestParam("deptId") String deptId);
}
