package com.sptg.permissions.api.feigns;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.permissions.api.dto.MenuDto;
import com.sptg.permissions.api.entity.Menu;
import com.sptg.permissions.api.feigns.fallback.MenuFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * title: MenuFeign
 * package: com.sptg.permissions.api.feigns
 * description: 菜单对外服务接口
 *
 *                  
 *                 
 */
@FeignClient(value = "smart-house-permissions",fallbackFactory = MenuFeignFallbackFactory.class)
public interface MenuFeign {

    /**
     * 功能描述: 获取所有的菜单树形列表
     * @return ResultBean<Menu>
     *                  
     * date:  2018/11/2 0:40
     */
    @GetMapping(value = "/menu/getMenuTreeList")
    ResultBean<Menu> getMenuTreeList();

    /**
     * 功能描述: 创建菜单
     * @param menuDto 菜单信息
     * @return ResultBean<Boolean> ：{ true：成功,false：失败 }
     *                  
     *                     
     */
    @PostMapping(value = "/menu/insertMenu")
    ResultBean<Boolean> insertMenu(MenuDto menuDto);

    /**
     * 功能描述: 修改菜单
     * @param menuDto 菜单信息
     * @return ResultBean<Boolean> ：{ true：成功,false：失败 }
     *                  
     * date:  2018/11/4 18:56
     */
    @PostMapping(value = "/menu/updateMenu")
    ResultBean<Boolean> updateMenu(MenuDto menuDto);

    /**
     * 功能描述: 删除菜单
     * @param menuDto 菜单信息
     * @return ResultBean<Boolean> ：{ true：成功,false：失败 }
     *                  
     *                      
     */
    @PostMapping(value = "/menu/deleteMenu")
    ResultBean<Boolean> deleteMenu(MenuDto menuDto);

    @GetMapping(value = "/menu/selectById")
    Menu selectById(@RequestBody Long id);

    @GetMapping(value = "/menu/getMenuTreeWithRoot")
    ResultBean<Menu> getMenuTreeWithRoot();
}
