From f6fc46e59aa75e620358819ee32ef119f5925dbc Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 22 二月 2024 15:42:54 +0800
Subject: [PATCH] #
---
/dev/null | 17 --------
zy-asrs-flow/src/pages/system/role/components/scope.jsx | 1
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/RoleController.java | 20 +++++++--
zy-asrs-flow/src/pages/system/role/index.jsx | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/RoleScopeParam.java | 26 +++++++++++++
5 files changed, 42 insertions(+), 24 deletions(-)
diff --git a/zy-asrs-flow/src/pages/system/role/components/scope.jsx b/zy-asrs-flow/src/pages/system/role/components/scope.jsx
index 71d7441..72548d6 100644
--- a/zy-asrs-flow/src/pages/system/role/components/scope.jsx
+++ b/zy-asrs-flow/src/pages/system/role/components/scope.jsx
@@ -52,7 +52,6 @@
}
const handleFinish = async (values) => {
- console.log({ ...values, menuIds }); return
props.onSubmit({ ...values, menuIds });
}
diff --git a/zy-asrs-flow/src/pages/system/role/index.jsx b/zy-asrs-flow/src/pages/system/role/index.jsx
index ebdf0f4..2d46932 100644
--- a/zy-asrs-flow/src/pages/system/role/index.jsx
+++ b/zy-asrs-flow/src/pages/system/role/index.jsx
@@ -91,7 +91,7 @@
const handleScope = async (val) => {
const hide = message.loading('姝e湪鍒嗛厤');
try {
- const resp = await Http.doPost('api/role/scope', val);
+ const resp = await Http.doPost('api/role/scope/update', val);
if (resp.code === 200) {
message.success('鍒嗛厤鎴愬姛');
return true;
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/RoleController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/RoleController.java
index 4d933c9..884fb4b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/RoleController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/RoleController.java
@@ -9,6 +9,7 @@
import com.zy.asrs.wcs.common.domain.BaseParam;
import com.zy.asrs.wcs.common.domain.KeyValVo;
import com.zy.asrs.wcs.common.domain.PageParam;
+import com.zy.asrs.wcs.system.controller.param.RoleScopeParam;
import com.zy.asrs.wcs.system.entity.Role;
import com.zy.asrs.wcs.system.entity.RoleMenu;
import com.zy.asrs.wcs.system.service.RoleMenuService;
@@ -20,7 +21,10 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -145,10 +149,16 @@
@PreAuthorize("hasAuthority('system:role:update')")
@OperationLog("鍒嗛厤鏉冮檺")
@PostMapping("/role/scope/update")
- public R scopeUpdate(@RequestBody Role role) {
-
-
-
+ @Transactional
+ public R scopeUpdate(@RequestBody RoleScopeParam param) {
+ Long roleId = param.getId();
+ List<Long> menuIds = new ArrayList<>(param.getMenuIds().getChecked());
+ menuIds.addAll(param.getMenuIds().getHalfChecked());
+ for (Long menuId : menuIds) {
+ if (!roleMenuService.save(new RoleMenu(roleId, menuId))) {
+ throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
+ }
+ }
return R.ok("鍒嗛厤鎴愬姛");
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/RoleParam.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/RoleParam.java
deleted file mode 100644
index f2f9f02..0000000
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/RoleParam.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.zy.asrs.wcs.system.controller.param;
-
-import com.zy.asrs.wcs.common.domain.BaseParam;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * Created by vincent on 2/16/2024
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class RoleParam extends BaseParam {
-
- private String name;
-
-
-}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/RoleScopeParam.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/RoleScopeParam.java
new file mode 100644
index 0000000..74fa2e7
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/system/controller/param/RoleScopeParam.java
@@ -0,0 +1,26 @@
+package com.zy.asrs.wcs.system.controller.param;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Created by vincent on 2/16/2024
+ */
+@Data
+public class RoleScopeParam {
+
+ private Long id;
+
+ private MenuIds menuIds;
+
+ @Data
+ public static class MenuIds {
+
+ private List<Long> checked;
+
+ private List<Long> halfChecked;
+
+ }
+
+}
--
Gitblit v1.9.1