whycxzp
2021-03-30 2653db7013675f4836e43f2cc1126d1c1f22f277
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
59
60
61
62
63
64
65
66
67
package com.whyc.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.pojo.TestPlan;
import com.whyc.service.TestPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
@RestController
@RequestMapping("testPlan")
@Api(tags = "试验计划")
@Slf4j
public class TestPlanController {
    @Autowired
    private TestPlanService service;
 
    @GetMapping("all")
    @ApiOperation(value = "查询所有-分页")
    public Response<IPage<TestPlan>> getAll(@RequestParam int pageNum, @RequestParam int pageSize){
        return service.getAll(pageNum,pageSize);
    }
    @PostMapping("search")
    @ApiOperation(value = "查询分页-根据筛选条件")
    public Response<IPage<TestPlan>> getPageByCondition(@RequestParam int pageNum, @RequestParam int pageSize, @RequestBody TestPlan testPlan){
        return service.getPageByCondition(pageNum,pageSize,testPlan);
    }
 
    @GetMapping
    @ApiOperation(value = "查看详情")
    public Response getOne(@RequestParam Integer num){
        return service.getOne(num);
    }
 
 
    @PostMapping
    @ApiOperation(value = "新增")
    public Response add(@RequestBody TestPlan testPlan){
        return service.add(testPlan);
    }
    @PutMapping
    @ApiOperation(value = "编辑")
    public Response update(@RequestBody TestPlan testPlan){
        return service.update(testPlan);
    }
    @PutMapping("startPlan")
    @ApiOperation(value = "启动计划")
    public Response startPlan(@RequestParam int num){
        return service.startPlan(num);
    }
 
    @PutMapping("delete")
    @ApiOperation(value = "删除作废")
    public Response deletePlan(@RequestParam int num){
        return service.deletePlan(num);
    }
    @PutMapping("stop")
    @ApiOperation(value = "停止计划")
    public Response stopPlan(@RequestParam int num){
        return service.stopPlan(num);
    }
 
}