8.11 缓存优化bug解决

This commit is contained in:
zhangsan 2025-08-11 16:51:14 +08:00
parent 61e633f88e
commit 652a4973f0

View File

@ -619,15 +619,16 @@ public class PictureServiceImpl extends ServiceImpl<PictureMapper, Picture>
ThrowUtils.throwIf(!hasPermission, ErrorCode.NO_AUTH_ERROR); ThrowUtils.throwIf(!hasPermission, ErrorCode.NO_AUTH_ERROR);
} }
// 把查询条件序列化成 JSON Map<String, Object> params = Map.of(
String queryJson = JSONUtil.toJsonStr(Map.of(
"spaceId", spaceId == null ? "public" : spaceId, "spaceId", spaceId == null ? "public" : spaceId,
"category", queryRequest.getCategory(), "category", Optional.ofNullable(queryRequest.getCategory()).orElse(""),
"tags", queryRequest.getTags(), "tags", Optional.ofNullable(queryRequest.getTags()).orElse(Collections.emptyList()),
"searchText", queryRequest.getSearchText(), "searchText", Optional.ofNullable(queryRequest.getSearchText()).orElse(""),
"current", current, "current", current,
"size", size "size", size
)); );
// 把查询条件序列化成 JSON
String queryJson = JSONUtil.toJsonStr(params);
// 计算 MD5 作为哈希也可用 SHA256 // 计算 MD5 作为哈希也可用 SHA256
String hash = DigestUtil.md5Hex(queryJson); String hash = DigestUtil.md5Hex(queryJson);