From a28ca3f36d0ace05966a8c0fac1e4b5fe921f882 Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期三, 30 十月 2024 16:25:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java |   41 +++++++++++++++--------------------------
 1 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java
index a29448d..2cbf40a 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpApiController.java
@@ -7,10 +7,12 @@
 import com.iailab.module.data.channel.http.service.HttpApiService;
 import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO;
 import com.iailab.module.data.channel.http.vo.HttpApiRespVO;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
+import java.util.Date;
 import java.util.List;
 import java.util.UUID;
 
@@ -22,64 +24,51 @@
  * @createTime 2024年08月27日
  */
 @RestController
-@RequestMapping("/data/http/api")
+@RequestMapping("/data/channel/http/api")
 public class HttpApiController {
 
     @Resource
     private HttpApiService httpApiService;
 
+    @PreAuthorize("@ss.hasPermission('data:channel-http:query')")
     @GetMapping("page")
     public CommonResult<PageResult<HttpApiRespVO>> page(@Valid HttpApiPageReqVO reqVO) {
         PageResult<HttpApiEntity> page = httpApiService.queryPage(reqVO);
         return success(BeanUtils.toBean(page, HttpApiRespVO.class));
     }
 
+    @PreAuthorize("@ss.hasPermission('data:channel-http:query')")
     @GetMapping("list")
     public CommonResult<List<HttpApiEntity>> list() {
         List<HttpApiEntity> list = httpApiService.list();
         return success(list);
     }
 
-    /**
-     * 根据id查询详情
-     *
-     * @param id
-     */
+    @PreAuthorize("@ss.hasPermission('data:channel-http:query')")
     @GetMapping("/info/{id}")
     public CommonResult<HttpApiEntity> info(@PathVariable("id") String id){
         HttpApiEntity info= httpApiService.info(id);
         return success(info);
     }
-    /**
-     * 添加API
-     *
-     * @param httpApiEntity
-     */
-    @PostMapping("/add")
-    public CommonResult<Boolean> add(@RequestBody HttpApiEntity httpApiEntity){
-        String id = UUID.randomUUID().toString();
-        httpApiEntity.setId(id);
+
+    @PreAuthorize("@ss.hasPermission('data:channel-http:create')")
+    @PostMapping("/create")
+    public CommonResult<Boolean> create(@RequestBody HttpApiEntity httpApiEntity){
+        httpApiEntity.setId(UUID.randomUUID().toString());
+        httpApiEntity.setCreateTime(new Date());
         httpApiService.add(httpApiEntity);
         return success(true);
     }
 
-    /**
-     * 修改API
-     *
-     * @param httpApiEntity
-     */
+    @PreAuthorize("@ss.hasPermission('data:channel-http:update')")
     @PutMapping("/update")
     public CommonResult<Boolean> update(@RequestBody HttpApiEntity httpApiEntity) {
         httpApiService.update(httpApiEntity);
+        httpApiEntity.setUpdateTime(new Date());
         return success(true);
     }
 
-    /**
-     * 删除API
-     *
-     * @param id
-     *
-     */
+    @PreAuthorize("@ss.hasPermission('data:channel-http:delete')")
     @DeleteMapping("/delete")
     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
         httpApiService.delete(id);

--
Gitblit v1.9.3