From 9057425fa1472e48d79f7f8608ea80267e224135 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 25 九月 2024 14:14:37 +0800
Subject: [PATCH] pre

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/DmModuleController.java |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/DmModuleController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/DmModuleController.java
index 5a414c1..61826c0 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/DmModuleController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/DmModuleController.java
@@ -1,5 +1,6 @@
 package com.iailab.module.model.mcs.pre.controller.admin;
 
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.iailab.framework.common.exception.ErrorCode;
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
@@ -9,6 +10,7 @@
 import com.iailab.module.model.mcs.pre.vo.DmModulePageReqVO;
 import com.iailab.module.model.mcs.pre.vo.DmModuleRespVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -23,7 +25,7 @@
  * @date 2021年04月23日 9:05
  */
 @RestController
-@RequestMapping("/pre/module")
+@RequestMapping("/model/pre/module")
 public class DmModuleController {
 
     @Autowired
@@ -33,6 +35,7 @@
      * 管网列表
      */
     @GetMapping("/page")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:query')")
     public CommonResult<PageResult<DmModuleRespVO>> page(@Validated DmModulePageReqVO reqVO) {
         PageResult<DmModuleEntity> page = dmModuleService.queryPage(reqVO);
 
@@ -43,6 +46,7 @@
      * 管网列表
      */
     @GetMapping("/list")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:query')")
     public CommonResult<List<DmModuleEntity>> list(@RequestParam Map<String, Object> params) {
         List<DmModuleEntity> list = dmModuleService.list(params);
 
@@ -52,18 +56,21 @@
     /**
      * 管网信息
      */
-    @GetMapping("/get")
-    public CommonResult<DmModuleEntity> info(@RequestParam("id") String id){
-        DmModuleEntity module = dmModuleService.selectById(id);
+    @GetMapping("/get/{id}")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:query')")
+    public CommonResult<DmModuleEntity> info(@PathVariable("id") String id){
+        DmModuleEntity info = dmModuleService.info(id);
 
-        return success(module);
+        return success(info);
     }
 
     /**
      * 保存管网
      */
     @PostMapping("/create")
-    public CommonResult<Boolean> save(@RequestBody DmModuleEntity module){
+    @PreAuthorize("@ss.hasPermission('model:pre-module:create')")
+    @DSTransactional(rollbackFor= Exception.class)
+    public CommonResult<Boolean> create(@RequestBody DmModuleEntity module){
         int count = dmModuleService.check(module);
         if (count > 0) {
             ErrorCode errorCode = new ErrorCode(999, "名称重复");
@@ -77,6 +84,8 @@
      * 修改管网
      */
     @PutMapping("/update")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:update')")
+    @DSTransactional(rollbackFor= Exception.class)
     public CommonResult<Boolean> update(@RequestBody DmModuleEntity module){
         dmModuleService.update(module);
         return success(true);
@@ -86,6 +95,8 @@
      * 删除管网
      */
     @DeleteMapping("/delete")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:delete')")
+    @DSTransactional(rollbackFor= Exception.class)
     public CommonResult<Boolean> delete(@RequestParam("id") String id){
         dmModuleService.deleteBatch(new String[]{id});
         return success(true);

--
Gitblit v1.9.3