清空所有客户端缓存

This commit is contained in:
2025-07-02 14:16:11 +08:00
parent a69aad227a
commit a487e7ae67
6 changed files with 46 additions and 40 deletions

View File

@ -1,6 +1,7 @@
package com.fuyuanshen.system.controller.system;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.fuyuanshen.common.core.constant.CacheNames;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.excel.utils.ExcelUtil;
import com.fuyuanshen.common.log.annotation.Log;
@ -13,6 +14,7 @@ import com.fuyuanshen.system.domain.vo.SysConfigVo;
import com.fuyuanshen.system.service.ISysConfigService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -134,4 +136,15 @@ public class SysConfigController extends BaseController {
configService.resetConfigCache();
return R.ok();
}
/**
* 清空所有客户端缓存
*/
@GetMapping(value = "/clearAllClientCache")
@CacheEvict(cacheNames = CacheNames.SYS_CLIENT, allEntries = true)
public void clearAllClientCache() {
}
}

View File

@ -54,6 +54,7 @@ public class SysClientServiceImpl implements ISysClientService {
@Cacheable(cacheNames = CacheNames.SYS_CLIENT, key = "#clientId")
@Override
public SysClientVo queryByClientId(String clientId) {
log.debug("【queryByClientId】缓存未命中开始执行数据库查询clientId={}", clientId);
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysClient>().eq(SysClient::getClientId, clientId));
}
@ -125,16 +126,16 @@ public class SysClientServiceImpl implements ISysClientService {
@Override
public int updateClientStatus(String clientId, String status) {
return baseMapper.update(null,
new LambdaUpdateWrapper<SysClient>()
.set(SysClient::getStatus, status)
.eq(SysClient::getClientId, clientId));
new LambdaUpdateWrapper<SysClient>()
.set(SysClient::getStatus, status)
.eq(SysClient::getClientId, clientId));
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(SysClient entity) {
//TODO 做一些数据校验,如唯一约束
// TODO 做一些数据校验,如唯一约束
}
/**
@ -144,7 +145,7 @@ public class SysClientServiceImpl implements ISysClientService {
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
// TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}