From 99d1760b989a57cca8a158fcd29205af211ca46c Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 22 Aug 2022 15:27:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysDeptController.java | 12 +----------- .../common/core/domain/entity/SysDictData.java | 2 +- .../ruoyi/common/core/redis/RedisCache.java | 18 +++--------------- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 9262549..6dd1756 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -1,6 +1,5 @@ package com.ruoyi.web.controller.system; -import java.util.Iterator; import java.util.List; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -54,16 +53,7 @@ public class SysDeptController extends BaseController public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { List depts = deptService.selectDeptList(new SysDept()); - Iterator it = depts.iterator(); - while (it.hasNext()) - { - SysDept d = (SysDept) it.next(); - if (d.getDeptId().intValue() == deptId - || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) - { - it.remove(); - } - } + depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); return AjaxResult.success(depts); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java index 4fa5f0b..e79eaa2 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java @@ -131,7 +131,7 @@ public class SysDictData extends BaseEntity public boolean getDefault() { - return UserConstants.YES.equals(this.isDefault) ? true : false; + return UserConstants.YES.equals(this.isDefault); } public String getIsDefault() diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java index 03f062e..d0a6de4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -124,9 +124,9 @@ public class RedisCache * @param collection 多个对象 * @return */ - public long deleteObject(final Collection collection) + public boolean deleteObject(final Collection collection) { - return redisTemplate.delete(collection); + return redisTemplate.delete(collection) > 0; } /** @@ -231,18 +231,6 @@ public class RedisCache return opsForHash.get(key, hKey); } - /** - * 删除Hash中的数据 - * - * @param key - * @param hKey - */ - public void delCacheMapValue(final String key, final String hKey) - { - HashOperations hashOperations = redisTemplate.opsForHash(); - hashOperations.delete(key, hKey); - } - /** * 获取多个Hash中的数据 * @@ -264,7 +252,7 @@ public class RedisCache */ public boolean deleteCacheMapValue(final String key, final String hKey) { - return Boolean.TRUE.equals(redisTemplate.opsForHash().delete(key, hKey)); + return redisTemplate.opsForHash().delete(key, hKey) > 0; } /**