package com.usky.ems.controller.web;

import com.usky.common.core.bean.ApiResult;
import com.usky.ems.service.BaseSpaceService;
import com.usky.ems.service.vo.BaseSpaceForestNodeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 空间树接口（base_space）
 *
 * GET /base-space/tree  获取空间树
 */
@RestController
@RequestMapping("/space")
public class BaseSpaceController {

    @Autowired
    private BaseSpaceService baseSpaceService;

    /**
     * 获取空间树（根据 base_space 构建）
     */
    @GetMapping("/tree")
    public ApiResult<BaseSpaceForestNodeVO> tree() {
        return ApiResult.success(baseSpaceService.tree());
    }
}
