BootTestController.java
1.97 KB
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
package com.cnlive.shenhe.controller;
import com.google.common.collect.Lists;
import com.cnlive.shenhe.entity.BootTest;
import com.cnlive.shenhe.serviceImpl.BootTestServiceImpl;
import com.cnlive.shenhe.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Author: yanzhaowang
* @Date: 2022/3/4 14:10
*/
@RestController
@RequestMapping("/boottest")
public class BootTestController {
@Autowired
BootTestServiceImpl bootTestService;
@GetMapping("/testselect/{pagesiaz}/{pageNum}")
public List<BootTest> selectAll(@RequestParam(defaultValue = "10") @PathVariable(name = "pagesiaz") int pagesiaz, @RequestParam(defaultValue = "1") @PathVariable(name = "pageNum") int pageNum){
List<BootTest> bootTests = bootTestService.selectAll(pagesiaz, pageNum);
return bootTests;
}
@GetMapping("/testselectid/{BootId}")
public BootTest selectById(@PathVariable(value = "BootId") String BootId){
if (BootId != null) {
BootTest bootTest = bootTestService.selectByid(BootId);
return bootTest;
}
return null;
}
@RequestMapping("/testaddBoottest")
public int addBootTest(@RequestBody BootTest bootTest){
int i = bootTestService.addBootTest(bootTest);
return i;
}
@DeleteMapping("/testdeleteBoottest/{bootTestid}")
public int deleteBootTest(@PathVariable(name = "bootTestid") String bootTestid){
if (CommonUtils.isNotEmpty(bootTestid)) {
int i = bootTestService.deleteBootTest(bootTestid);
return i;
}
return 0;
}
@RequestMapping("/testupdateBoottest")
public int testupdateBoottest(@RequestBody BootTest bootTest){
if (bootTest.getId() != null&&bootTest.getAge()!=null&&bootTest.getName()!=null) {
int i = bootTestService.updateBootTest(bootTest);
return i;
}
return 0;
}
}