package com.boman.system.api;

import com.boman.domain.SysUser;
import com.boman.domain.dto.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import com.boman.domain.constant.ServiceNameConstants;
import com.boman.domain.dto.R;
import com.boman.system.api.factory.RemoteUserFallbackFactory;
import com.boman.system.api.model.LoginUser;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 用户服务
 * 
 * @author ruoyi
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @return 结果
     */
    @GetMapping(value = "/user/info/{username}")
    public R<LoginUser> getUserInfo(@PathVariable("username") String username);

    /**
     * 部门下所有人
     *
     * @param deptIdList deptIdList
     * @return 结果
     */
    @PostMapping("/user/listByDeptId")
    List<SysUser> listByDeptId(@RequestBody List<Long> deptIdList);

    /**
     * 查询所有用户
     * @return
     */
    @GetMapping("/userListAll")
    List<SysUser> selectUserListAll();

    @PostMapping("/user/updateUnionId")
    public AjaxResult updateUnionId(@RequestBody SysUser sysUser);

    /**
     * 功能描述: queryByOpenId
     *
     * @param openId openId
     * @return com.boman.domain.SysUser
     */
    @GetMapping("user/queryByOpenId/{openId}")
    SysUser queryByOpenId(@PathVariable("openId") String openId);

    /**
     * 功能描述: getByPhone
     *
     * @param phone phone
     * @return com.boman.domain.SysUser
     */
    @GetMapping("user/getByPhone/{phone}")
    SysUser getByPhone(@PathVariable("phone") String phone);

    @PostMapping("user/packInfo")
    LoginUser packInfo(@RequestBody SysUser sysUser);
}
