From 0d47e4af3c3e68bcf1f89bb9e3f894c035f3f229 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Fri, 6 Sep 2024 11:12:01 +0800 Subject: [PATCH] =?UTF-8?q?sql=20=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../club/joylink/xiannccda/controller/RoleAuthController.java | 1 + src/main/java/club/joylink/xiannccda/dto/auth/AuthRoleDTO.java | 2 ++ src/main/java/club/joylink/xiannccda/service/AuthService.java | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/xiannccda/controller/RoleAuthController.java b/src/main/java/club/joylink/xiannccda/controller/RoleAuthController.java index bda1310..0468de7 100644 --- a/src/main/java/club/joylink/xiannccda/controller/RoleAuthController.java +++ b/src/main/java/club/joylink/xiannccda/controller/RoleAuthController.java @@ -75,6 +75,7 @@ public class RoleAuthController { @PostMapping("/role/saveOrUpdate") @Operation(summary = "角色编辑") @ApiResponse(description = "角色编辑") + @SecurityRequirement(name = "jwt") public void roleSaveOrUpdate(@RequestBody AuthRoleDTO dto) { this.authService.saveOrUpdate(dto); } diff --git a/src/main/java/club/joylink/xiannccda/dto/auth/AuthRoleDTO.java b/src/main/java/club/joylink/xiannccda/dto/auth/AuthRoleDTO.java index b005e41..34570ab 100644 --- a/src/main/java/club/joylink/xiannccda/dto/auth/AuthRoleDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/auth/AuthRoleDTO.java @@ -2,6 +2,7 @@ package club.joylink.xiannccda.dto.auth; import club.joylink.xiannccda.entity.AuthRole; import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; +import com.fasterxml.jackson.annotation.JsonIgnore; import java.util.List; import lombok.Data; @@ -11,5 +12,6 @@ public class AuthRoleDTO { private Long id; private String name; private List resList; + @JsonIgnore private String apiIds; } diff --git a/src/main/java/club/joylink/xiannccda/service/AuthService.java b/src/main/java/club/joylink/xiannccda/service/AuthService.java index a74a73f..5087209 100644 --- a/src/main/java/club/joylink/xiannccda/service/AuthService.java +++ b/src/main/java/club/joylink/xiannccda/service/AuthService.java @@ -42,8 +42,9 @@ public class AuthService { if (Objects.isNull(dto.getId())) { AuthRole r = new AuthRole(); r.setName(dto.getName()); + this.authRoleRepository.save(r); - this.batchSave(dto.getResList(), dto.getId()); + this.batchSave(dto.getResList(), r.getId()); } else { AuthRole r = this.authRoleRepository.getById(dto.getId()); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(r));