fix(service): Fix cache update logic

This commit is contained in:
Sol 2025-06-11 10:28:32 +08:00
parent 05afb9afb6
commit 97ba7cffaf
2 changed files with 1 additions and 2 deletions

View file

@ -140,7 +140,6 @@ public abstract class BaseService<ENTITY extends BaseEntity, PAGE_DTO extends Ba
* @return 实体
*/
public ENTITY update(ENTITY entity) {
this.cacheDelete(entity.getId());
ENTITY queryEntity = cacheSearch(entity.getId());
if (queryEntity == null) {
throw new BaseException("更新失败,更新数据不存在");

View file

@ -34,7 +34,7 @@ public class PermissionService extends BaseService<PermissionEntity, BasePageDto
this.update(parentPermission);
}
for (PermissionEntity permission : parentPermission.getChildren()) {
if (this.cacheSearch(parentPermission.getId()) == null) {
if (this.cacheSearch(permission.getId()) == null) {
this.save(permission);
} else {
this.update(permission);