UpgradeController.java
1.59 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
package vion.controller.monitor;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.model.monitor.Upgrade;
import vion.service.monitor.IUpgradeService;
/**
* 升级包管理
*/
@RestController
@RequestMapping("/api/upgrade")
@RequiredArgsConstructor
public class UpgradeController {
private final IUpgradeService upgradeService;
@GetMapping
@SaCheckPermission(value = "upgrade:list", orRole = "admin")
public Page<Upgrade> list(Upgrade upgrade) {
return upgradeService.lambdaQuery(upgrade)
.orderByDesc(Upgrade::getBuildTime)
.page(Page.of(upgrade.getPageNum(), upgrade.getPageSize()));
}
@GetMapping("/{id}")
@SaCheckPermission(value = "upgrade:query", orRole = "admin")
public Upgrade get(@PathVariable Long id) {
return upgradeService.getById(id);
}
@PostMapping
@SaCheckPermission(value = "upgrade:save", orRole = "admin")
public String save(Upgrade upgrade) {
return upgradeService.saveAndFile(upgrade);
}
@PostMapping("/{id}")
@SaCheckPermission(value = "upgrade:edit", orRole = "admin")
public String update(@PathVariable Long id, Upgrade upgrade) {
upgrade.setId(id);
return upgradeService.update(upgrade);
}
@DeleteMapping("/{id}")
@SaCheckPermission(value = "upgrade:remove", orRole = "admin")
public String remove(@PathVariable Long id) {
return upgradeService.remove(id);
}
}