From dc7d094dce0f5536b4fcb8fed227649d290e6c5c Mon Sep 17 00:00:00 2001
From: baoshiwei <baoshiwei@shlanbao.cn>
Date: 星期二, 05 八月 2025 13:19:19 +0800
Subject: [PATCH] feat(dry): 添加干燥机设备相关缓存清理逻辑

---
 jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
index 0bf2aac..eb38ac3 100755
--- a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
+++ b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
@@ -14,6 +14,7 @@
 import cn.hutool.core.bean.BeanUtil;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.config.TenantContext;
+import org.jeecg.common.constant.CommonCacheConstant;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.RedisUtil;
 import org.jeecg.common.util.oConvertUtils;
@@ -38,6 +39,7 @@
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
@@ -154,8 +156,10 @@
 	@ApiOperation(value="骞茬嚗鏈�-娣诲姞", notes="骞茬嚗鏈�-娣诲姞")
 	@RequiresPermissions("dry:dry_equipment:add")
 	@PostMapping(value = "/add")
+	@CacheEvict(value = {CommonCacheConstant.DRY_CACHE_TENANT_EQUS_LIST,CommonCacheConstant.DRY_CACHE_TENANT_EQUS},allEntries=true)
 	public Result<String> add(@RequestBody DryEquipment dryEquipment) {
 		dryEquipmentService.save(dryEquipment);
+		redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode());
 		return Result.OK("娣诲姞鎴愬姛锛�");
 	}
 
@@ -169,11 +173,11 @@
 	@ApiOperation(value="骞茬嚗鏈�-缂栬緫", notes="骞茬嚗鏈�-缂栬緫")
 	@RequiresPermissions("dry:dry_equipment:edit")
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	@CacheEvict(value = {CommonCacheConstant.DRY_CACHE_TENANT_EQUS_LIST,CommonCacheConstant.DRY_CACHE_TENANT_EQUS},allEntries=true)
 	public Result<String> edit(@RequestBody DryEquipment dryEquipment) {
 		// 鍒犻櫎redis缂撳瓨
 		redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode());
 		dryEquipmentService.updateById(dryEquipment);
-
 		return Result.OK("缂栬緫鎴愬姛!");
 	}
 
@@ -187,6 +191,7 @@
 	@ApiOperation(value="骞茬嚗鏈�-閫氳繃id鍒犻櫎", notes="骞茬嚗鏈�-閫氳繃id鍒犻櫎")
 	@RequiresPermissions("dry:dry_equipment:delete")
 	@DeleteMapping(value = "/delete")
+	@CacheEvict(value = {CommonCacheConstant.DRY_CACHE_TENANT_EQUS_LIST,CommonCacheConstant.DRY_CACHE_TENANT_EQUS},allEntries=true)
 	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
 		redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode());
 		dryEquipmentService.removeById(id);
@@ -203,6 +208,7 @@
 	@ApiOperation(value="骞茬嚗鏈�-鎵归噺鍒犻櫎", notes="骞茬嚗鏈�-鎵归噺鍒犻櫎")
 	@RequiresPermissions("dry:dry_equipment:deleteBatch")
 	@DeleteMapping(value = "/deleteBatch")
+	@CacheEvict(value = {CommonCacheConstant.DRY_CACHE_TENANT_EQUS_LIST,CommonCacheConstant.DRY_CACHE_TENANT_EQUS},allEntries=true)
 	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
 		redisUtil.del(CacheConstants.RedisKeyEnum.EQP_MAP.getCode());
 		this.dryEquipmentService.removeByIds(Arrays.asList(ids.split(",")));

--
Gitblit v1.9.3