package cn.ibizlab.api.rest.extensions;

import cn.ibizlab.core.extensions.service.UAACoreService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UAACoreResource {

    @Autowired
    private UAACoreService uaaCoreService;

    /**
     * 获取全部菜单列表和数据能力列表和统一资源列表
     *
     * @return
     */
    @GetMapping(value = "/sys_permissions/getallMenuAndPermissionAndUnires")
    public ResponseEntity<JSONArray> getAllPermission() {
        JSONArray treeNode = new JSONArray();
        // 获取应用菜单
        treeNode.add(uaaCoreService.getAppMenu());
        // 获取数据能力
        treeNode.add(uaaCoreService.getDEOppriv());
        // 获取统一资源
        treeNode.add(uaaCoreService.getUnires());

        return ResponseEntity.ok().body(treeNode);
    }

}
