package com.muyu.system.controller;

import com.muyu.common.system.domain.SysUser;
import com.muyu.system.service.SysPermissionService;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import lombok.extern.slf4j.Slf4j;

import java.util.HashSet;
import java.util.Set;

/**
 * @Author: 胡杨
 * @Name: SysPermission
 * @Description:
 * @CreatedDate: 2024/9/23 下午8:58
 * @FilePath: com.muyu.system.controller
 */
@Slf4j
@RestController
@RequestMapping("/permission")
public class SysPermissionController {
    @Resource
    private SysPermissionService permissionService;


    /**
     * 获取角色数据权限
     *
     * @param user 用户
     *
     * @return 角色权限信息
     */
    @PostMapping("/getRole")
    public Set<String> getRolePermission (@RequestBody SysUser user) {
        return permissionService.getRolePermission(user);
    }

    /**
     * 获取菜单数据权限
     *
     * @param user 用户
     *
     * @return 菜单权限信息
     */
    @PostMapping("/getMenu")
    public Set<String> getMenuPermission (@RequestBody SysUser user) {
        return permissionService.getMenuPermission(user);
    }
}
