From 675e1bd0655b862a2d9020c98baaca277ba20282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=BB=B4=E4=BC=9F?= Date: Thu, 14 Sep 2023 16:19:53 +0800 Subject: [PATCH] code review add comment --- .../main/java/cn/axzo/tyr/client/feign/TyrSaasRoleApi.java | 3 ++- .../tyr/server/service/impl/SaasRoleGroupServiceImpl.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tyr-api/src/main/java/cn/axzo/tyr/client/feign/TyrSaasRoleApi.java b/tyr-api/src/main/java/cn/axzo/tyr/client/feign/TyrSaasRoleApi.java index 8c827a5e..a2c2cf21 100644 --- a/tyr-api/src/main/java/cn/axzo/tyr/client/feign/TyrSaasRoleApi.java +++ b/tyr-api/src/main/java/cn/axzo/tyr/client/feign/TyrSaasRoleApi.java @@ -7,6 +7,7 @@ import cn.axzo.tyr.client.model.res.QueryBatchByIdentityIdTypeRes; import cn.axzo.tyr.client.model.vo.SaasRoleVO; import cn.axzo.tyr.client.model.vo.SaveOrUpdateRoleVO; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -27,7 +28,7 @@ public interface TyrSaasRoleApi { * 如果权限列表不为空则创建通用权限 */ @PostMapping("/api/saasRole/saveOrUpdate") - ApiResult saveOrUpdate(@RequestBody SaveOrUpdateRoleVO saveOrUpdateRole); + ApiResult saveOrUpdate(@RequestBody @Validated SaveOrUpdateRoleVO saveOrUpdateRole); /** * 根据id查询详情 diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/SaasRoleGroupServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/SaasRoleGroupServiceImpl.java index cc9efe1b..bab8e0dc 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/SaasRoleGroupServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/SaasRoleGroupServiceImpl.java @@ -99,8 +99,10 @@ public class SaasRoleGroupServiceImpl implements SaasRoleGroupService { if (CollectionUtils.isEmpty(ids)) { return; } - int relationCount = saasRoleGroupRelationDao.lambdaQuery().in(SaasRoleGroupRelation::getSaasRoleGroupId, ids) - .eq(SaasRoleGroupRelation::getIsDelete, TableIsDeleteEnum.NORMAL.value).count(); + int relationCount = saasRoleGroupRelationDao.lambdaQuery() + .in(SaasRoleGroupRelation::getSaasRoleGroupId, ids) + .eq(SaasRoleGroupRelation::getIsDelete, TableIsDeleteEnum.NORMAL.value) + .count(); if (relationCount > 0) { throw new BizException(BaseCode.BAD_REQUEST, "分组关联角色,不能删除"); }