优化代码

This commit is contained in:
RuoYi
2025-12-02 11:08:36 +08:00
parent 8ba767cd64
commit 69f05c0dbd
3 changed files with 11 additions and 11 deletions

View File

@@ -374,7 +374,11 @@ public class ExcelUtil<T>
Map<String, Integer> cellMap = new HashMap<String, Integer>();
// 获取表头
Row heard = sheet.getRow(titleNum);
for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++)
if (heard == null)
{
throw new UtilException("文件标题行为空请检查Excel文件格式");
}
for (int i = 0; i < heard.getLastCellNum(); i++)
{
Cell cell = heard.getCell(i);
if (StringUtils.isNotNull(cell))
@@ -382,10 +386,6 @@ public class ExcelUtil<T>
String value = this.getCellValue(heard, i).toString();
cellMap.put(value, i);
}
else
{
cellMap.put(null, i);
}
}
// 有数据时才处理 得到类的所有field.
List<Object[]> fields = this.getFields();
@@ -710,7 +710,7 @@ public class ExcelUtil<T>
}
if (Type.EXPORT.equals(type))
{
fillExcelData(index, row);
fillExcelData(index);
addStatisticsRow();
}
}
@@ -723,7 +723,7 @@ public class ExcelUtil<T>
* @param row 单元格行
*/
@SuppressWarnings("unchecked")
public void fillExcelData(int index, Row row)
public void fillExcelData(int index)
{
int startNo = index * sheetSize;
int endNo = Math.min(startNo + sheetSize, list.size());
@@ -731,7 +731,7 @@ public class ExcelUtil<T>
for (int i = startNo; i < endNo; i++)
{
row = sheet.createRow(currentRowNum);
Row row = sheet.createRow(currentRowNum);
T vo = (T) list.get(i);
int column = 0;
int maxSubListSize = getCurrentMaxSubListSize(vo);

View File

@@ -166,7 +166,7 @@ public class DictTypeController extends BaseController
* 选择字典树
*/
@GetMapping("/selectDictTree/{columnId}/{dictType}")
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType, ModelMap mmap)
public String selectDictTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType, ModelMap mmap)
{
mmap.put("columnId", columnId);
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));

View File

@@ -3,8 +3,8 @@
<head>
<meta charset="UTF-8">
<title>Font Awesome Ico list</title>
<link href="/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<script src="/js/jquery.min.js"></script>
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<script th:src="@{/js/jquery.min.js}"></script>
<style type="text/css">
.ico-list .fa{
margin: 5px;