package io.renren.modules.dataSet.controller;


import io.renren.common.utils.R;
import io.renren.datasource.annotation.DataSource;
import io.renren.modules.dataSet.service.impl.SubsystemServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author allen
 * @since 2021-06-15
 */
@RestController


@RequestMapping("/dataset/tree")
public class SubsystemController {
    @Autowired
    private SubsystemServiceImpl subsystemService;


    //根据系统ID 查询对应的子系统
    @RequestMapping("getsubSystem")
    public String demo(){
        String demo = subsystemService.demo();
        System.out.println("=====================================");
//        System.out.println((Integer) map.get("systemid"));
//        System.out.println(demo);
        return demo;
    }
    //根据子系统id 查询对应的设备
    @RequestMapping("getequipment")
    public  String getequipment(@RequestBody Map map){
        String equipment = subsystemService.getEquipment((Integer) map.get("subSystemid"));
//        System.out.println((Integer) map.get("subSystemid"));
//        System.out.println(equipment);
        return equipment;
    }

    //    根据设备ID 查询对应的子设备
    @RequestMapping("getsubequipment")
    public String getsubequipment(@RequestBody Map map){
        String subEquiment = subsystemService.getSubequipment((Integer) map.get("equipment"));
        return subEquiment;
    }


}

