package com.xydl.cac.old;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

@Api(tags = "旧接口")
@RestController
@RequestMapping("oilChromaController")
public class OilChromaController {

    @Resource
    OldService service;

    /**
     * 查询油色谱表格数据
     *
     * @param eqmid
     * @return
     */
    @ApiOperation(value = "查询油色谱表格数据")
    @GetMapping(value = "/queryTableData/{eqmid}")
    public AjaxResult queryTableData(@PathVariable Integer eqmid) {
        List<OilChromaVo> oilChromaVoList = service.queryTableDataList(eqmid);
        // 油色谱表格只取一条进行展示
        if (oilChromaVoList.size() != 0) {
            return AjaxResult.success(oilChromaVoList.get(0));
        } else {
            return AjaxResult.success("操作成功", null);
        }
    }

    /**
     * 查询油色谱趋势图数据
     *
     * @param eqmid
     * @return
     */
    @ApiOperation(value = "查询油色谱趋势图数据")
    @GetMapping(value = "/queryLineData/{eqmid}")
    public AjaxResult queryLineData(@PathVariable Integer eqmid) {
        return AjaxResult.success(service.queryLineDataList(eqmid));
    }
}
