From abba5418ce295904c82b6cceaad7ccf9c05fada3 Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期三, 18 九月 2024 17:49:24 +0800
Subject: [PATCH] 添加权限校验

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/DmModuleController.java              |    9 ++++++++-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemOutputController.java          |    2 +-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java         |    8 +++++++-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmModelResultstrController.java      |    2 +-
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDADeviceController.java |    2 +-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemTypeController.java            |    8 +++++++-
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java    |    2 +-
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java         |    8 +++++++-
 8 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/ChannelOPCDADeviceController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDADeviceController.java
similarity index 97%
rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/ChannelOPCDADeviceController.java
rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDADeviceController.java
index 105998f..87693ea 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/ChannelOPCDADeviceController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDADeviceController.java
@@ -1,4 +1,4 @@
-package com.iailab.module.data.channel.opcda.controller;
+package com.iailab.module.data.channel.opcda.controller.admin;
 
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/ChannelOPCDATagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java
similarity index 97%
rename from iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/ChannelOPCDATagController.java
rename to iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java
index fe783cd..77f35e7 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/ChannelOPCDATagController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java
@@ -1,4 +1,4 @@
-package com.iailab.module.data.channel.opcda.controller;
+package com.iailab.module.data.channel.opcda.controller.admin;
 
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
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 8e1089c..9082921 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
@@ -9,6 +9,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 +24,7 @@
  * @date 2021年04月23日 9:05
  */
 @RestController
-@RequestMapping("/pre/module")
+@RequestMapping("/model/pre/module")
 public class DmModuleController {
 
     @Autowired
@@ -33,6 +34,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 +45,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);
 
@@ -53,6 +56,7 @@
      * 管网信息
      */
     @GetMapping("/get/{id}")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:query')")
     public CommonResult<DmModuleEntity> info(@PathVariable("id") String id){
         DmModuleEntity info = dmModuleService.selectById(id);
 
@@ -63,6 +67,7 @@
      * 保存管网
      */
     @PostMapping("/create")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:create')")
     public CommonResult<Boolean> save(@RequestBody DmModuleEntity module){
         int count = dmModuleService.check(module);
         if (count > 0) {
@@ -77,6 +82,7 @@
      * 修改管网
      */
     @PutMapping("/update")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:update')")
     public CommonResult<Boolean> update(@RequestBody DmModuleEntity module){
         dmModuleService.update(module);
         return success(true);
@@ -86,6 +92,7 @@
      * 删除管网
      */
     @DeleteMapping("/delete")
+    @PreAuthorize("@ss.hasPermission('model:pre-module:delete')")
     public CommonResult<Boolean> delete(@RequestParam("id") String id){
         dmModuleService.deleteBatch(new String[]{id});
         return success(true);
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemOutputController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemOutputController.java
index 2df4568..bcde8f8 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemOutputController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemOutputController.java
@@ -19,7 +19,7 @@
  * @date 2021年07月23日 11:13
  */
 @RestController
-@RequestMapping("/pre/item-output")
+@RequestMapping("/model/pre/item-output")
 public class MmItemOutputController {
 
     @Autowired
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemTypeController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemTypeController.java
index 4063aff..1cd0229 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemTypeController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmItemTypeController.java
@@ -8,6 +8,7 @@
 import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO;
 import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO;
 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.*;
 
@@ -19,7 +20,7 @@
  * @date 2021年04月22日 9:57
  */
 @RestController
-@RequestMapping("/pre/item-type")
+@RequestMapping("/model/pre/item-type")
 public class MmItemTypeController {
 
     @Autowired
@@ -29,6 +30,7 @@
      * 预测项类型列表
      */
     @GetMapping("/page")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:query')")
     public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmItemTypePageReqVO reqVO) {
         PageResult<MmItemTypeEntity> page = mmItemTypeService.page(reqVO);
 
@@ -39,6 +41,7 @@
      * 预测项类型信息
      */
     @GetMapping("/get/{id}")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:query')")
     public CommonResult<MmItemTypeEntity> info(@PathVariable("id") String id) {
         MmItemTypeEntity itemType = mmItemTypeService.selectById(id);
 
@@ -49,6 +52,7 @@
      * 保存预测项类型
      */
     @PostMapping("/create")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:create')")
     public CommonResult<Boolean> save(@RequestBody MmItemTypeEntity itemType) {
         int count = mmItemTypeService.check(itemType);
         if (count > 0) {
@@ -62,6 +66,7 @@
      * 修改预测项类型
      */
     @PutMapping("/update")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:update')")
     public CommonResult<Boolean> update(@RequestBody MmItemTypeEntity itemType) {
         int count = mmItemTypeService.check(itemType);
         if (count > 0) {
@@ -75,6 +80,7 @@
      * 删除预测项类型
      */
     @DeleteMapping("/delete")
+    @PreAuthorize("@ss.hasPermission('model:pre-item:delete')")
     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
         mmItemTypeService.deleteBatch(new String[]{id});
         return success(true);
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmModelResultstrController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmModelResultstrController.java
index 368a1a8..3e9ee20 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmModelResultstrController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmModelResultstrController.java
@@ -22,7 +22,7 @@
  * @date 2021年05月07日 16:53
  */
 @RestController
-@RequestMapping("/pre/model-resultstr")
+@RequestMapping("/model/pre/model-resultstr")
 public class MmModelResultstrController {
 
     @Autowired
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
index eb504cc..b7a1575 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmPredictItemController.java
@@ -7,6 +7,7 @@
 import com.iailab.module.model.mcs.pre.vo.CountItemtypeVO;
 import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -22,7 +23,7 @@
  * @date 2021年04月26日 14:42
  */
 @RestController
-@RequestMapping("/pre/predict-item")
+@RequestMapping("/model/pre/predict-item")
 public class MmPredictItemController {
 
     @Autowired
@@ -32,6 +33,7 @@
      * 预测项列表
      */
     @GetMapping("/page")
+    @PreAuthorize("@ss.hasPermission('model:pre-predict:query')")
     public CommonResult<PageResult<MmPredictItemRespVO>> page(@RequestParam Map<String, Object> params) {
         PageResult<MmPredictItemRespVO> page = mmPredictItemService.getPageList(params);
         return success(page);
@@ -41,6 +43,7 @@
      * 预测项信息
      */
     @GetMapping("/get/{id}")
+    @PreAuthorize("@ss.hasPermission('model:pre-predict:query')")
     public CommonResult<MmPredictItemDTO> info(@PathVariable("id") String id, @RequestParam Map<String, Object> params){
         MmPredictItemDTO predictItem = mmPredictItemService.getDetailById(id, params);
         return success(predictItem);
@@ -50,6 +53,7 @@
      * 保存预测项
      */
     @PostMapping("/create")
+    @PreAuthorize("@ss.hasPermission('model:pre-predict:create')")
     public CommonResult<Boolean> save(@RequestBody MmPredictItemDTO mmPredictItemDto){
         int count = mmPredictItemService.check(mmPredictItemDto.getMmPredictItem());
         if (count > 0) {
@@ -63,6 +67,7 @@
      * 修改预测项
      */
     @PutMapping("/update")
+    @PreAuthorize("@ss.hasPermission('model:pre-predict:update')")
     public CommonResult<Boolean> update(@RequestBody MmPredictItemDTO mmPredictItemDto){
         int count = mmPredictItemService.check(mmPredictItemDto.getMmPredictItem());
         if (count > 0) {
@@ -76,6 +81,7 @@
      * 删除预测项
      */
     @DeleteMapping("/delete")
+    @PreAuthorize("@ss.hasPermission('model:pre-predict:delete')")
     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
         mmPredictItemService.deleteBatch(new String[]{id});
         return success(true);
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java
index 57fd8c4..8ff66ab 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/pre/controller/admin/MmResultTableController.java
@@ -8,6 +8,7 @@
 import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO;
 import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO;
 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.*;
 
@@ -19,7 +20,7 @@
  * @date 2021年04月22日 9:57
  */
 @RestController
-@RequestMapping("/pre/result-table")
+@RequestMapping("/model/pre/result-table")
 public class MmResultTableController {
 
     @Autowired
@@ -29,6 +30,7 @@
      * 结果存放列表
      */
     @GetMapping("/page")
+    @PreAuthorize("@ss.hasPermission('model:pre-result:query')")
     public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmResultTablePageReqVO reqVO) {
         PageResult<MmResultTableEntity> page = mmResultTableService.page(reqVO);
 
@@ -36,6 +38,7 @@
     }
 
     @GetMapping("/get/{id}")
+    @PreAuthorize("@ss.hasPermission('model:pre-result:query')")
     public CommonResult<MmResultTableEntity> info(@PathVariable("id") String id){
         MmResultTableEntity resultTable = mmResultTableService.selectById(id);
 
@@ -46,6 +49,7 @@
      * 保存结果存放
      */
     @PostMapping("/create")
+    @PreAuthorize("@ss.hasPermission('model:pre-result:create')")
     public CommonResult<Boolean> save(@RequestBody MmResultTableEntity resultTable){
         int count = mmResultTableService.check(resultTable);
         if (count > 0) {
@@ -59,6 +63,7 @@
      * 修改结果存放
      */
     @PutMapping("/update")
+    @PreAuthorize("@ss.hasPermission('model:pre-result:update')")
     public CommonResult<Boolean> update(@RequestBody MmResultTableEntity resultTable){
         int count = mmResultTableService.check(resultTable);
         if (count > 0) {
@@ -72,6 +77,7 @@
      * 删除结果存放
      */
     @DeleteMapping("/delete")
+    @PreAuthorize("@ss.hasPermission('model:pre-result:delete')")
     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
         mmResultTableService.deleteBatch(new String[]{id});
         return success(true);

--
Gitblit v1.9.3