package com.gyee.sampleimpala.controller; import com.alibaba.fastjson.JSONObject; import com.gyee.sampleimpala.common.result.JsonResult; import com.gyee.sampleimpala.common.result.ResultCode; import com.gyee.sampleimpala.model.kudu.Caseperformance; import com.gyee.sampleimpala.service.custom.GoldenService; import com.gyee.sampleimpala.service.kudu.CaseperformanceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 性能样本 * * @author w * @since 2021-11-17 import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 性能下降样本库 */ @CrossOrigin @RestController @RequestMapping("/case") public class CaseperformanceController { @Autowired private CaseperformanceService caseperformanceService; @Autowired private GoldenService goldenService; /** * 获取样本数据 * * @param station 场站 * @param model 风机模型 * @param tag 样本类型 * @param st 开始时间 * @param et 结束时间 * @return */ @GetMapping("/performance/list") public JSONObject getPerformanceList(String station, String[] model, Integer tag, String st, String et) { List list = caseperformanceService.getPerformanceList(station, model, tag, st, et); return JsonResult.successData(ResultCode.SUCCESS, list); } /** * 新增样本 * * @param performance 样本对象 * @return */ @PostMapping("/performance/add") public JSONObject addPerformance(@RequestBody Caseperformance performance) { boolean flag = caseperformanceService.addPerformance(performance); if (flag) { return JsonResult.success(ResultCode.SUCCESS); } return JsonResult.error(ResultCode.ERROR); } /** * 编辑样本 * * @param performance 样本对象 * @return */ @PostMapping("/performance/edit") public JSONObject editPerformance(@RequestBody Caseperformance performance) { boolean flag = caseperformanceService.editPerformance(performance); if (flag) { return JsonResult.success(ResultCode.SUCCESS); } return JsonResult.error(ResultCode.ERROR); } /** * 删除样本 * * @param id 样本id * @return */ @PostMapping("/performance/remove") public JSONObject removePerformance(Integer id) { boolean flag = caseperformanceService.removePerformance(id); if (flag) { return JsonResult.success(ResultCode.SUCCESS); } return JsonResult.error(ResultCode.ERROR); } /** * * @param id 样本id(数组) * @param interval 数据时间间隔 * @return */ public JSONObject getCurve( @RequestParam(value = "id",required = false) Integer[] id, @RequestParam(value = "interval",required = false) Integer interval ) { return null; } }