Commit 2dcdf475 authored by yanzg's avatar yanzg

接口文档的支持

parent 7e9a4574
......@@ -301,7 +301,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
if (column.isMerger()) {
ExcelMergerData mergerData = mergerGroupData.get(column.getMegerGroup());
// 判断是否需要合并历史记录
if (mergerData.getRowCell() > 1) {
if (mergerData.isMergerFlag()) {
// 合并历史记录单元格
mergerData(mergerData, columnPos);
}
......@@ -320,6 +320,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
private void mergerData(ExcelMergerData mergerColumn, int columnPos) {
int rowStart = mergerColumn.getRowIndex();
int rowEnd = rowStart + mergerColumn.getRowCell() - 1;
CellRangeAddress region = new CellRangeAddress(rowStart, rowEnd, columnPos, columnPos);
sheet.addMergedRegion(region);
......@@ -337,6 +338,15 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
// 合并数据配置
for (int columnPos = 0; columnPos < this.config.getColumns().size(); columnPos++) {
ExportColumn column = this.config.getColumns().get(columnPos);
// 判断列是否需要合并
if (column.isMerger()) {
ExcelMergerData mergerData = mergerGroupData.get(column.getMegerGroup());
// 判断是否需要合并历史记录
if (mergerData.isMergerFlag()) {
// 合并历史记录单元格
mergerData(mergerData, columnPos);
}
}
if (column.getWidth() < 1) {
sheet.autoSizeColumn(columnPos, true);
} else {
......
......@@ -24,6 +24,11 @@ public class ExcelMergerData {
*/
private int rowCell = 1;
/**
* 判断是否可以合并
*/
private boolean mergerFlag = false;
/**
* 上次合并行号
*/
......@@ -50,6 +55,8 @@ public class ExcelMergerData {
this.data = nowCellData;
this.rowIndex = rowIndex;
this.rowCell = 1;
this.mergerFlag = true;
} else {
this.rowCell++;
}
......@@ -59,39 +66,25 @@ public class ExcelMergerData {
return data;
}
public void setData(String data) {
this.data = data;
}
public int getRowIndex() {
return rowIndex;
}
public void setRowIndex(int rowIndex) {
this.rowIndex = rowIndex;
}
public int getRowCell() {
return rowCell;
}
public void setRowCell(int rowCell) {
this.rowCell = rowCell;
public boolean isMergerFlag() {
boolean ret = mergerFlag;
mergerFlag = false;
return ret;
}
public int getRowIndexHistory() {
return rowIndexHistory;
}
public void setRowIndexHistory(int rowIndexHistory) {
this.rowIndexHistory = rowIndexHistory;
}
public int getRowCellHistory() {
return rowCellHistory;
}
public void setRowCellHistory(int rowCellHistory) {
this.rowCellHistory = rowCellHistory;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment