whycxzp
2021-05-19 5552728b86383ac123209ac666c1eb808645d753
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.whyc.controller;
 
import com.github.pagehelper.PageInfo;
import com.whyc.dto.ExperimentConditionDTO;
import com.whyc.dto.Response;
import com.whyc.pojo.Experiment;
import com.whyc.pojo.ExperimentBaseData;
import com.whyc.pojo.ExperimentBaseDataKZ;
import com.whyc.pojo.ExperimentPoint;
import com.whyc.service.ExperimentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RestController
@RequestMapping("experiment")
@Api(tags = "试验")
public class ExperimentController {
 
    @Autowired
    private ExperimentService service;
 
    @GetMapping("experimentId")
    @ApiOperation(value = "查询当前试验编号",notes = "传入的type选择其一:" +
            "绕组:rz,\n" +
            "空载:kz,\n" +
            "负载:fz,\n" +
            "升温:sw,\n" +
            "超速:cs,\n" +
            "空载反电动势:kzfdds,\n" +
            "振动:zd,\n" +
            "耐压:ny,\n" +
            "转动惯量:zdgl,\n")
    public Response getExperimentId(@RequestParam String type){
        return service.getExperimentId(type);
    }
 
    @PostMapping
    @ApiOperation(value = "新增试验-空载")
    public Response addKZ(@RequestBody Experiment<ExperimentBaseDataKZ, ExperimentPoint> experiment){
        return service.addKZ(experiment);
    }
 
 
 
    /*======History======*/
 
    @PostMapping("page")
    @ApiOperation(value = "查询历史分页-根据条件筛选")
    public Response<PageInfo<Experiment>> getPage(@RequestParam Integer pageNum,
                                                  @RequestParam Integer pageSize,
                                                  @RequestBody ExperimentConditionDTO condition){
 
        return service.getPage(pageNum,pageSize,condition);
    }
 
}