package com.lutao.cloud.admin.api.feign;

import com.lutao.cloud.admin.api.entity.SysDept;
import com.lutao.cloud.common.core.constant.SecurityConstants;
import com.lutao.cloud.common.core.constant.ServiceNameConstants;
import com.lutao.cloud.common.core.util.MessageInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteDeptService", value = ServiceNameConstants.UPMS_SERVICE, path = "dept")
public interface RemoteDeptService {


    /**
     * 通过ID查询
     *
     * @param id 部门ID
     * @param from     调用标志
     * @return R
     */
    @GetMapping("/{id}")
    MessageInfo<SysDept> getById(@PathVariable("id") Integer id, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 添加部门
     *
     * @param sysDept 部门
     * @param from     调用标志
     * @return R
     */
    @PostMapping
    MessageInfo<Boolean> save(@RequestBody SysDept sysDept, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 编辑部门
     *
     * @param sysDept 部门
     * @param from     调用标志
     * @return R
     */
    @PutMapping
    MessageInfo<Boolean> update(@RequestBody SysDept sysDept, @RequestHeader(SecurityConstants.FROM) String from);
}