From b425df38b434f1eaf4762690905cd7affcf4c7b6 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 20 九月 2024 09:33:24 +0800
Subject: [PATCH] mpk

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/ProjectController.java |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/ProjectController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/ProjectController.java
index 7110831..a7d841e 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/ProjectController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/ProjectController.java
@@ -7,6 +7,7 @@
 import com.iailab.module.model.mpk.dto.ProjectPackageHistoryModelDTO;
 import com.iailab.module.model.mpk.service.ProjectService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Date;
@@ -28,6 +29,7 @@
     @Autowired
     private ProjectService projectService;
 
+    @PreAuthorize("@ss.hasPermission('mpk:project:query')")
     @GetMapping("page")
     public CommonResult<PageData<ProjectDTO>> page(@RequestParam Map<String, Object> params){
         PageData<ProjectDTO> page = projectService.page(params);
@@ -35,6 +37,7 @@
         return success(page);
     }
 
+    @PreAuthorize("@ss.hasPermission('mpk:project:query')")
     @GetMapping("list")
     public CommonResult<List<ProjectDTO>> list() {
         List<ProjectDTO> list = projectService.list(new HashMap<>());
@@ -42,6 +45,7 @@
         return success(list);
     }
 
+    @PreAuthorize("@ss.hasPermission('mpk:project:query')")
     @GetMapping("{id}")
     public CommonResult<ProjectDTO> get(@PathVariable("id") String id){
         ProjectDTO data = projectService.get(id);
@@ -49,27 +53,30 @@
         return success(data);
     }
 
+    @PreAuthorize("@ss.hasPermission('mpk:project:create')")
     @PostMapping
-    public CommonResult save(@RequestBody ProjectDTO dto){
+    public CommonResult<Boolean> save(@RequestBody ProjectDTO dto){
         projectService.save(dto);
 
-        return CommonResult.success();
+        return CommonResult.success(true);
     }
 
+    @PreAuthorize("@ss.hasPermission('mpk:project:update')")
     @PutMapping
-    public CommonResult update(@RequestBody ProjectDTO dto){
+    public CommonResult<Boolean> update(@RequestBody ProjectDTO dto){
         dto.setUpdateTime(new Date());
         projectService.update(dto);
 
-        return CommonResult.success();
+        return CommonResult.success(true);
     }
 
+    @PreAuthorize("@ss.hasPermission('mpk:project:delete')")
     @DeleteMapping
-    public CommonResult delete(String id){
+    public CommonResult<Boolean> delete(String id){
 
         projectService.delete(id);
 
-        return CommonResult.success();
+        return CommonResult.success(true);
     }
 
     @GetMapping("getProjectModel")

--
Gitblit v1.9.3