package com.css.simulation.resource.common.adapter.controller;

import api.common.pojo.common.ResponseBodyVO;
import com.css.simulation.resource.common.app.algorithm.AlgorithmExpandApplication;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/algPlatform")
public class AlgorithmExpandController {

    @Resource
    private AlgorithmExpandApplication algorithmExpandApplication;


    /**
     * String urlParam = "";
     * if (StringUtil.isNotEmpty(algorithmId)) {
     * urlParam = urlParam + "&algorithmId=" + algorithmId;
     * }
     * if (StringUtil.isNotEmpty(algorithmName)) {
     * urlParam = urlParam + "&algorithmName=" + algorithmName;
     * }
     * if (StringUtil.isNotEmpty(description)) {
     * urlParam = urlParam + "&description=" + description;
     * }
     * if (StringUtil.isNotEmpty(page)) {
     * urlParam = urlParam + "&page=" + page;
     * }
     * if (StringUtil.isNotEmpty(size)) {
     * urlParam = urlParam + "&size=" + size;
     * }
     * urlParam = urlParam + "&sort=" + sort;
     *
     * @param param 参数
     * @return 结果
     */
    @RequestMapping("/getAlgorithmList")
    public ResponseBodyVO<String> getAlgorithmList(@RequestBody String param) {
        return algorithmExpandApplication.getAlgorithmList(param);
    }

    @RequestMapping("/selectAlgorithmNameByAlgorithmId")
    public ResponseBodyVO<String> selectAlgorithmNameByAlgorithmId(@RequestBody String algorithmId) {
        return algorithmExpandApplication.selectAlgorithmNameByAlgorithmId(algorithmId);
    }

    @GetMapping("/download")
    public void download(
            @RequestParam String algorithmId
    ) {
        algorithmExpandApplication.download(algorithmId);

    }

}
