package com.yuchen.saas.park.service.controller.basic;

import com.yuchen.saas.park.api.response.BusinessDataResponse;
import com.yuchen.saas.park.api.response.ParkBusinessDataTreeResponse;
import com.yuchen.saas.park.service.service.ParkBusinessDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * @ClassName ParkBusinessDataController
 * @Description 园区设备分类控制器类
 * @Author 肖祥
 * @Date 2022/10/5 14:50
 * @Version 1.0。0
 **/
@RestController
@AllArgsConstructor
@RequestMapping("/parkBusinessData")
@Api(value = "设备分类", tags = "设备分类接口")
public class ParkBusinessDataController {


    @Resource
    private ParkBusinessDataService parkBusinessDataService;

    /**
     * 根据园区、租户id查询其下所有设备的树形结构图
     */
    @GetMapping("/getBusinessDataTree")
    @ApiOperation(value = "根据园区、租户id查询其下所有设备的树形结构图:可视化使用", notes = "传入查询信息")
    public R<List<ParkBusinessDataTreeResponse>> getParkingTree(@RequestParam(value = "parkIdList",required=false) List<Long> parkIdList,
                                                                @RequestParam(value = "roleId",required=false)Long roleId) {
        return parkBusinessDataService.getParkingBusinessDataTree(parkIdList,roleId);
    }

    /**
     * 根据园区、租户id查询其下所有设备的树形结构图
     */
    @GetMapping("/getBusinessDataTable")
    @ApiOperation(value = "根据园区、租户id查询其下所有设备的树形结构图:可视化使用", notes = "传入查询信息")
    public R<List<BusinessDataResponse>> getBusinessDataTable(@RequestParam(value = "parkIdList",required=false)List<Long> parkIdList) {
        return parkBusinessDataService.getBusinessDataTable(parkIdList);
    }


}
