package com.fdage.controller;

import com.fdage.dto.ResourceTree;
import com.fdage.service.IResourceService;
import com.fdage.util.AjaxJson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Hb_zzZ on 2020/7/28.
 */
@Controller
@RequestMapping("/zhoushan/resource")
@Slf4j
@Api(tags = "sys-权限资源模块")
public class ResourceController {

    @Autowired
    private IResourceService resourceService;

    @PostMapping("find")
    @ResponseBody
    @ApiOperation("获取所以资源（树形结构）")
    public AjaxJson find() throws Exception {
//        List<ResourceEntity> result = resourceService.findList(Sort.by("sort").ascending());
        List<ResourceTree> listTree = resourceService.getTree();
        return AjaxJson.success(listTree);
    }


}
