Pre Merge pull request !751 from 雨伦/dev

This commit is contained in:
雨伦 2025-08-26 08:10:34 +00:00 committed by Gitee
commit a4082e2315
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -73,12 +73,13 @@ public class CellMergeHandler {
Object val = ReflectUtils.invokeGetter(rowObj, field.getName());
int colNum = mergeFieldsIndex.get(j);
if (!map.containsKey(field)) {
Object cellValue = map.containsKey(field) ? map.get(field).value() : null;
if (!map.containsKey(field) || (isEmpty(cellValue) && val != null)) {
map.put(field, new RepeatCell(val, i));
} else {
RepeatCell repeatCell = map.get(field);
Object cellValue = repeatCell.value();
if (cellValue == null || "".equals(cellValue)) {
if (isEmpty(cellValue)) {
// 空值跳过不合并
continue;
}
@ -110,6 +111,10 @@ public class CellMergeHandler {
return cellList;
}
private boolean isEmpty(Object value) {
return value == null || "".equals(value);
}
private boolean isMerge(List<?> list, int i, Field field) {
boolean isMerge = true;
CellMerge cm = field.getAnnotation(CellMerge.class);