|
@@ -1,6 +1,7 @@
|
|
|
package space.anyi.openAPI.controller;
|
|
package space.anyi.openAPI.controller;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import space.anyi.openAPI.model.PageVO;
|
|
import space.anyi.openAPI.model.PageVO;
|
|
|
import space.anyi.openAPI.model.ResponseResult;
|
|
import space.anyi.openAPI.model.ResponseResult;
|
|
@@ -31,6 +32,7 @@ public class InterfaceInfoController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private InterfaceInfoService interfaceInfoService;
|
|
private InterfaceInfoService interfaceInfoService;
|
|
|
@PostMapping
|
|
@PostMapping
|
|
|
|
|
+ @PreAuthorize("@ps.hasRole('管理员')")
|
|
|
public ResponseResult add(@RequestBody RequestAddInterfaceInfo requestAddInterfaceInfo){
|
|
public ResponseResult add(@RequestBody RequestAddInterfaceInfo requestAddInterfaceInfo){
|
|
|
long id = IdUtil.getSnowflake(1, 1).nextId();
|
|
long id = IdUtil.getSnowflake(1, 1).nextId();
|
|
|
InterfaceInfo interfaceInfo = BeanCopyUtil.copyBean(requestAddInterfaceInfo, InterfaceInfo.class);
|
|
InterfaceInfo interfaceInfo = BeanCopyUtil.copyBean(requestAddInterfaceInfo, InterfaceInfo.class);
|
|
@@ -42,12 +44,14 @@ public class InterfaceInfoController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping()
|
|
@DeleteMapping()
|
|
|
|
|
+ @PreAuthorize("@ps.hasRole('管理员')")
|
|
|
public ResponseResult delete(List<Long> ids){
|
|
public ResponseResult delete(List<Long> ids){
|
|
|
interfaceInfoService.removeByIds(ids);
|
|
interfaceInfoService.removeByIds(ids);
|
|
|
return ResponseResult.okResult();
|
|
return ResponseResult.okResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PutMapping
|
|
@PutMapping
|
|
|
|
|
+ @PreAuthorize("@ps.hasRole('管理员')")
|
|
|
public ResponseResult update(@RequestBody RequestUpdateInterfaceInfo requestUpdateInterfaceInfo){
|
|
public ResponseResult update(@RequestBody RequestUpdateInterfaceInfo requestUpdateInterfaceInfo){
|
|
|
InterfaceInfo interfaceInfo = BeanCopyUtil.copyBean(requestUpdateInterfaceInfo, InterfaceInfo.class);
|
|
InterfaceInfo interfaceInfo = BeanCopyUtil.copyBean(requestUpdateInterfaceInfo, InterfaceInfo.class);
|
|
|
interfaceInfoService.updateById(interfaceInfo);
|
|
interfaceInfoService.updateById(interfaceInfo);
|
|
@@ -59,6 +63,7 @@ public class InterfaceInfoController {
|
|
|
return ResponseResult.okResult(pageVO);
|
|
return ResponseResult.okResult(pageVO);
|
|
|
}
|
|
}
|
|
|
@PutMapping("/online")
|
|
@PutMapping("/online")
|
|
|
|
|
+ @PreAuthorize("@ps.hasRole('管理员')")
|
|
|
public ResponseResult onlineInterface(@RequestBody RequestID requestID){
|
|
public ResponseResult onlineInterface(@RequestBody RequestID requestID){
|
|
|
//校验
|
|
//校验
|
|
|
//接口是否存在
|
|
//接口是否存在
|
|
@@ -78,6 +83,7 @@ public class InterfaceInfoController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PutMapping("/offline")
|
|
@PutMapping("/offline")
|
|
|
|
|
+ @PreAuthorize("@ps.hasRole('管理员')")
|
|
|
public ResponseResult offlineInterface(@RequestBody RequestID requestID){
|
|
public ResponseResult offlineInterface(@RequestBody RequestID requestID){
|
|
|
//校验
|
|
//校验
|
|
|
//接口是否存在
|
|
//接口是否存在
|