package com.jeeplus.sys.feign;

import com.jeeplus.common.constant.AppNameConstants;
import com.jeeplus.sys.domain.Office;
import com.jeeplus.sys.factory.OfficeApiFallbackFactory;
import com.jeeplus.sys.service.dto.OfficeDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "officeApi", name = AppNameConstants.APP_SYSTEM_SERVICE, fallbackFactory = OfficeApiFallbackFactory.class)
public interface IOfficeApi {
    /**
     * 获取机构
     *
     * @return
     */
    @GetMapping(value = "/feign/sys/office/getOfficeDTOByName")
    OfficeDTO getOfficeDTOByName(@RequestParam(value = "name") String name);

    /**
     * 根据id获取组织
     *
     * @return
     */
    @GetMapping(value = "/feign/sys/office/selectById")
    Office selectById(@RequestParam(value = "id") String id);

    /**
     * 根据office.id 查询部门的所有父节点信息
     *
     * @return
     */
    @GetMapping(value = "/feign/sys/office/getOfficeById")
    OfficeDTO getOfficeById(@RequestParam(value = "id") String id);

    /**
     * 根据当前人管理的部门id查询这些部门信息
     * @param ids
     * @return
     */
    @RequestMapping(value = "/feign/sys/office/getOfficeNameByIds", method = RequestMethod.POST)
    List<String> getOfficeNameByIds(@RequestBody List<String> ids);

    /**
     * 根据父级id查询组织信息
     * @param parentId
     * @return
     */
    @GetMapping(value = "/feign/sys/office/selectListByParentId")
    List<Office> selectListByParentId(@RequestParam(value = "parentId")String parentId);

    /**
     * 根据父级id查询组织信息
     * @param isPublic
     * @return
     */
    @GetMapping(value = "/feign/sys/office/selectListByIsPublic")
    List<Office> selectListByIsPublic(@RequestParam(value = "isPublic")String isPublic);

    /**
     * 根据id 查询父级部门信息
     *
     * @return
     */
    @GetMapping(value = "/feign/sys/office/getParentOfficeById")
    OfficeDTO getParentOfficeById(@RequestParam(value = "id") String id);

    /**
     * 根据公司名称查询部门信息
     * @param company
     * @return
     */
    @GetMapping(value = "/feign/sys/office/getOfficeByCompany")
    List<OfficeDTO> getOfficeByCompany(@RequestParam(value = "company")String company);
}
