package com.jeeplus.sys.feign;

import com.jeeplus.common.constant.AppNameConstants;
import com.jeeplus.sys.factory.RoleApiFallbackFactory;
import com.jeeplus.sys.service.dto.RoleDTO;
import com.jeeplus.sys.service.dto.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(contextId = "roleApi", name = AppNameConstants.APP_SYSTEM_SERVICE, fallbackFactory = RoleApiFallbackFactory.class)
public interface IRoleApi {
    /**
     * 获取角色
     *
     * @return
     */
    @GetMapping(value = "/feign/sys/role/getRoleDTOByName")
    RoleDTO getRoleDTOByName(@RequestParam(value = "name") String name);

    /**
     * 获取角色
     *
     * @return
     */
    @RequestMapping(value = "/feign/sys/role/getRoleDTOByNameAndTenantId", method = RequestMethod.POST)
    List<RoleDTO> getRoleDTOByNameAndTenantId(@RequestBody Map<String ,String > keyMap);
    /**
     * 获取角色
     *
     * @return
     */
    @GetMapping(value = "/sys/role/getRoleDTOByName2")
    RoleDTO getRoleDTOByName2(@RequestParam(value = "name") String name);
    /**
     * 获取角色
     *
     * @return
     */
    @GetMapping(value = "/feign/sys/role/getRoleDTOById")
    RoleDTO getRoleDTOById(@RequestParam(value = "id") String id);

    /**
     * 获取角色(移动端)
     *
     * @return
     */
    @GetMapping(value = "/feign/sys/role/getRoleDTOByIdForApp")
    RoleDTO getRoleDTOByIdForApp(@RequestParam(value = "id") String id);

    /**
     * 传入用户id和数据权限id，判断当前用户是否具有此数据权限
     *
     * @return boolean
     */
    @PostMapping(value = "/feign/sys/role/existsUserDataRule")
    boolean existsUserDataRule(@RequestBody UserDTO userDTO, @RequestParam(value = "dataRuleId") String dataRuleId);

}
