package com.corewing.app.modules.downloadCenter;

import cn.hutool.core.lang.tree.Tree;
import com.corewing.app.common.Result;
import com.corewing.app.dto.ResourceCategoryTreeRequest;
import com.corewing.app.service.BizResourceCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 资源分类接口
 */
@Api(tags = "资源分类接口")
@RestController
@RequestMapping("/api/app/resource_category")
public class BizResourceCategoryController {

    @Resource
    private BizResourceCategoryService bizResourceCategoryService;

    /**
     * 获取分类树形集合
     * @param resourceCategoryTreeRequest
     * @return
     */
    @ApiOperation("分类树形集合")
    @GetMapping("/tree")
    public Result<List<Tree<String>>> categoryTree(ResourceCategoryTreeRequest resourceCategoryTreeRequest) {
        return Result.success(bizResourceCategoryService.tree(resourceCategoryTreeRequest));
    }

}
