You've already forked DataMate
fix: 修复多个 null 参数和空集合问题
1. EditReviewRepository - reviewedAt null 参数问题 - PENDING 状态时 reviewedAt 为 null - 修复:null 时不在 SET 语句中包含该字段 2. KnowledgeItemApplicationService - 空 IN 子句问题 - getKnowledgeManagementStatistics() 未检查空集合 - 导致 WHERE id IN () MySQL 语法错误 - 修复:添加空集合检查,提前返回零计数 验证: - 其他 Neo4j 操作已正确处理 null 参数 - 其他 listByIds/removeByIds 调用已有保护
This commit is contained in:
@@ -266,6 +266,12 @@ public class KnowledgeItemApplicationService {
|
||||
response.setTotalKnowledgeSets(totalSets);
|
||||
|
||||
List<String> accessibleSetIds = knowledgeSetRepository.listSetIdsByCriteria(baseQuery, ownerFilterUserId, excludeConfidential);
|
||||
if (CollectionUtils.isEmpty(accessibleSetIds)) {
|
||||
response.setTotalFiles(0L);
|
||||
response.setTotalSize(0L);
|
||||
response.setTotalTags(0L);
|
||||
return response;
|
||||
}
|
||||
List<KnowledgeSet> accessibleSets = knowledgeSetRepository.listByIds(accessibleSetIds);
|
||||
if (CollectionUtils.isEmpty(accessibleSets)) {
|
||||
response.setTotalFiles(0L);
|
||||
|
||||
@@ -43,7 +43,13 @@ public class EditReviewRepository {
|
||||
params.put("reviewedBy", review.getReviewedBy() != null ? review.getReviewedBy() : "");
|
||||
params.put("reviewComment", review.getReviewComment() != null ? review.getReviewComment() : "");
|
||||
params.put("createdAt", review.getCreatedAt());
|
||||
params.put("reviewedAt", review.getReviewedAt());
|
||||
|
||||
// reviewed_at 为 null 时(PENDING 状态)不写入 SET,避免 null 参数导致属性缺失
|
||||
String reviewedAtSet = "";
|
||||
if (review.getReviewedAt() != null) {
|
||||
reviewedAtSet = ", r.reviewed_at = $reviewedAt";
|
||||
params.put("reviewedAt", review.getReviewedAt());
|
||||
}
|
||||
|
||||
neo4jClient
|
||||
.query(
|
||||
@@ -57,8 +63,8 @@ public class EditReviewRepository {
|
||||
" r.submitted_by = $submittedBy, " +
|
||||
" r.reviewed_by = $reviewedBy, " +
|
||||
" r.review_comment = $reviewComment, " +
|
||||
" r.created_at = $createdAt, " +
|
||||
" r.reviewed_at = $reviewedAt " +
|
||||
" r.created_at = $createdAt" +
|
||||
reviewedAtSet + " " +
|
||||
"RETURN r"
|
||||
)
|
||||
.bindAll(params)
|
||||
|
||||
Reference in New Issue
Block a user