package com.sysu.admin.controller.analyse;

import com.xiesx.fastboot.base.result.BaseResult;
import com.xiesx.fastboot.base.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.sql.SQLException;

/**
 * 用于画图分析
 * @author shu hao
 * @description:
 * @date 2022/5/19 11:30
 */
@RequestMapping("/analyse")
@Controller
public class AnalyseController {

    @Autowired
    AnalyseServiceManager analyseServiceManager;

    @RequestMapping("analyse")
    @ResponseBody
    public BaseResult analyse(Analyse analyse) throws IOException, SQLException {
        AnalyseTable table = analyseServiceManager.newInstance(AnalyseType.valueOf(analyse.getType())).analyse(analyse.getWkt());
        return R.succ(table);
    }
}
