
com.geese.plugin.excel.mapping.ClientMapping Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of easy-excel Show documentation
Show all versions of easy-excel Show documentation
像SQL一样操作Excel,简化Excel的读写操作
The newest version!
package com.geese.plugin.excel.mapping;
import com.geese.plugin.excel.ExcelHelper;
import com.geese.plugin.excel.ExcelValidation;
import com.geese.plugin.excel.OperationKey;
import com.geese.plugin.excel.filter.Filter;
import com.geese.plugin.excel.filter.ReadFilter;
import com.geese.plugin.excel.util.Assert;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.*;
/**
* Created by Administrator on 2017/3/12.
*/
public class ClientMapping {
private InputStream excelInput;
private List queries = new ArrayList<>();
private OutputStream excelOutput;
private List inserts = new ArrayList<>();
private Boolean useXlsFormat = true;
private File excelOutputTemplate;
private Map> sheetAndTableDataMap = new LinkedHashMap<>();
private Map sheetAndPointDataMap = new LinkedHashMap<>();
private Map> sheetAndValidationMap = new LinkedHashMap<>();
private Map> sheetFiltersMap = new LinkedHashMap<>();
public ClientMapping addValidation(ExcelValidation validation, String switchSheet) {
if (sheetAndValidationMap.containsKey(switchSheet)) {
sheetAndValidationMap.get(switchSheet).add(validation);
return this;
}
Set validations = new LinkedHashSet<>();
validations.add(validation);
sheetAndValidationMap.put(switchSheet, validations);
return this;
}
public ClientMapping addValidations(Collection validations, String switchSheet) {
if (sheetAndValidationMap.containsKey(switchSheet)) {
sheetAndValidationMap.get(switchSheet).addAll(validations);
return this;
}
sheetAndValidationMap.put(switchSheet, validations);
return this;
}
public ClientMapping addFilter(Filter filter, String switchSheet) {
if (sheetFiltersMap.containsKey(switchSheet)) {
sheetFiltersMap.get(switchSheet).add(filter);
return this;
}
Set filters = new LinkedHashSet<>();
filters.add(filter);
sheetFiltersMap.put(switchSheet, filters);
return this;
}
public ClientMapping addFilters(Collection filters, String switchSheet) {
if (sheetFiltersMap.containsKey(switchSheet)) {
sheetFiltersMap.get(switchSheet).addAll(filters);
return this;
}
sheetFiltersMap.put(switchSheet, filters);
return this;
}
public ClientMapping addTableData(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy