package com.chushang.system.feign;

import com.chushang.common.core.constant.SecurityConstants;
import com.chushang.common.core.web.Result;
import com.chushang.datascope.entity.DataScopeEntity;
import com.chushang.security.entity.vo.LoginUser;
import com.chushang.system.constants.SystemConstants;
import com.chushang.system.entity.po.SysUser;
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.RequestHeader;

/**
 * by zhaowenyuan create 2022/5/20 10:05
 */
@FeignClient(contextId = "remoteUserService",
        value = SystemConstants.SYSTEM_SERVICE,
        path = SystemConstants.APPLICATION_NAME + "/user"
)
public interface RemoteUserService {

    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/info/{username}")
    Result<LoginUser<SysUser, DataScopeEntity>> getUserInfo(@PathVariable(value = "username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
