|
@@ -13,6 +13,7 @@ import com.izouma.nineth.utils.excel.ExcelUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
@@ -27,7 +28,7 @@ public class RaexSnapshotController extends BaseController {
|
|
|
private RaexSnapshotService raexSnapshotService;
|
|
private RaexSnapshotService raexSnapshotService;
|
|
|
private RaexSnapshotRepo raexSnapshotRepo;
|
|
private RaexSnapshotRepo raexSnapshotRepo;
|
|
|
|
|
|
|
|
- //@PreAuthorize("hasRole('ADMIN')")
|
|
|
|
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/save")
|
|
@PostMapping("/save")
|
|
|
public RaexSnapshot save(@RequestBody RaexSnapshot record) {
|
|
public RaexSnapshot save(@RequestBody RaexSnapshot record) {
|
|
|
if (record.getId() != null) {
|
|
if (record.getId() != null) {
|
|
@@ -39,24 +40,26 @@ public class RaexSnapshotController extends BaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- //@PreAuthorize("hasRole('ADMIN')")
|
|
|
|
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/all")
|
|
@PostMapping("/all")
|
|
|
public Page<RaexSnapshot> all(@RequestBody PageQuery pageQuery) {
|
|
public Page<RaexSnapshot> all(@RequestBody PageQuery pageQuery) {
|
|
|
return raexSnapshotService.all(pageQuery);
|
|
return raexSnapshotService.all(pageQuery);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
@GetMapping("/get/{id}")
|
|
@GetMapping("/get/{id}")
|
|
|
public RaexSnapshot get(@PathVariable Long id) {
|
|
public RaexSnapshot get(@PathVariable Long id) {
|
|
|
return raexSnapshotRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
return raexSnapshotRepo.findById(id).orElseThrow(new BusinessException("无记录"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/del/{id}")
|
|
|
|
|
- public void del(@PathVariable Long id) {
|
|
|
|
|
- raexSnapshotRepo.softDelete(id);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// @PostMapping("/del/{id}")
|
|
|
|
|
+// public void del(@PathVariable Long id) {
|
|
|
|
|
+// raexSnapshotRepo.softDelete(id);
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
@GetMapping("/excel")
|
|
@GetMapping("/excel")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
|
|
public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
|
|
|
List<RaexSnapshot> data = all(pageQuery).getContent();
|
|
List<RaexSnapshot> data = all(pageQuery).getContent();
|
|
|
ExcelUtils.export(response, data);
|
|
ExcelUtils.export(response, data);
|
|
@@ -64,6 +67,7 @@ public class RaexSnapshotController extends BaseController {
|
|
|
|
|
|
|
|
@GetMapping("/shot")
|
|
@GetMapping("/shot")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
|
|
+ @PreAuthorize("hasRole('ADMIN')")
|
|
|
public void shot(HttpServletResponse response, String name, String time) throws IOException {
|
|
public void shot(HttpServletResponse response, String name, String time) throws IOException {
|
|
|
List<Map<String, Object>> map = raexSnapshotRepo.shot(MetaConstants.LIKE.concat(name).concat(MetaConstants.LIKE), time);
|
|
List<Map<String, Object>> map = raexSnapshotRepo.shot(MetaConstants.LIKE.concat(name).concat(MetaConstants.LIKE), time);
|
|
|
List<SnapshotDTO> snapshotDTOS = mapToList(map);
|
|
List<SnapshotDTO> snapshotDTOS = mapToList(map);
|