|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.alibaba.excel.write.executor; |
|
|
|
package com.alibaba.excel.write.executor; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
@ -18,18 +19,23 @@ import com.alibaba.excel.util.ClassUtils; |
|
|
|
import com.alibaba.excel.util.FieldUtils; |
|
|
|
import com.alibaba.excel.util.FieldUtils; |
|
|
|
import com.alibaba.excel.util.WorkBookUtil; |
|
|
|
import com.alibaba.excel.util.WorkBookUtil; |
|
|
|
import com.alibaba.excel.util.WriteHandlerUtils; |
|
|
|
import com.alibaba.excel.util.WriteHandlerUtils; |
|
|
|
import com.alibaba.excel.write.metadata.CollectionRowData; |
|
|
|
import com.alibaba.excel.write.metadata.holder.AbstractWriteHolder; |
|
|
|
import com.alibaba.excel.write.metadata.MapRowData; |
|
|
|
|
|
|
|
import com.alibaba.excel.write.metadata.RowData; |
|
|
|
|
|
|
|
import com.alibaba.excel.write.metadata.holder.WriteHolder; |
|
|
|
import com.alibaba.excel.write.metadata.holder.WriteHolder; |
|
|
|
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
|
|
|
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
|
|
|
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import net.sf.cglib.beans.BeanMap; |
|
|
|
import net.sf.cglib.beans.BeanMap; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
|
|
|
|
import org.apache.poi.ss.usermodel.Cell; |
|
|
|
import org.apache.poi.ss.usermodel.Cell; |
|
|
|
import org.apache.poi.ss.usermodel.Row; |
|
|
|
import org.apache.poi.ss.usermodel.Row; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.HashSet; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
import java.util.TreeMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Add the data into excel |
|
|
|
* Add the data into excel |
|
|
|
* |
|
|
|
* |
|
|
@ -183,13 +189,17 @@ public class ExcelWriteAddExecutor extends AbstractExcelWriteExecutor { |
|
|
|
if (!sortedAllFiledMap.isEmpty()) { |
|
|
|
if (!sortedAllFiledMap.isEmpty()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
WriteWorkbookHolder writeWorkbookHolder = writeContext.writeWorkbookHolder(); |
|
|
|
|
|
|
|
boolean needIgnore = |
|
|
|
// 获取当前的使用的 holder
|
|
|
|
!CollectionUtils.isEmpty(writeWorkbookHolder.getExcludeColumnFieldNames()) || !CollectionUtils |
|
|
|
WriteHolder holder = writeContext.currentWriteHolder(); |
|
|
|
.isEmpty(writeWorkbookHolder.getExcludeColumnIndexes()) || !CollectionUtils |
|
|
|
boolean needIgnore = (holder instanceof AbstractWriteHolder) && ( |
|
|
|
.isEmpty(writeWorkbookHolder.getIncludeColumnFieldNames()) || !CollectionUtils |
|
|
|
!CollectionUtils.isEmpty(((AbstractWriteHolder) holder).getExcludeColumnFiledNames()) || !CollectionUtils |
|
|
|
.isEmpty(writeWorkbookHolder.getIncludeColumnIndexes()); |
|
|
|
.isEmpty(((AbstractWriteHolder) holder).getExcludeColumnIndexes()) || !CollectionUtils |
|
|
|
ClassUtils.declaredFields(clazz, sortedAllFiledMap, needIgnore, writeWorkbookHolder); |
|
|
|
.isEmpty(((AbstractWriteHolder) holder).getIncludeColumnFiledNames()) || !CollectionUtils |
|
|
|
|
|
|
|
.isEmpty(((AbstractWriteHolder) holder).getIncludeColumnIndexes())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClassUtils.declaredFields(clazz, sortedAllFiledMap, |
|
|
|
|
|
|
|
writeContext.writeWorkbookHolder().getWriteWorkbook().getConvertAllFiled(), needIgnore, holder); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|