|
|
@@ -9,6 +9,7 @@ import cn.hutool.poi.excel.ExcelWriter;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -23,7 +24,7 @@ public class GetDictItem {
|
|
|
|
|
|
public static final String CATEGORY_DATA = "/Users/sangkuofeng/Documents/IdeaProjects/dict_get/src/main/resources/dictKey.json";
|
|
|
|
|
|
- public static final String TARGET_PATH = "/Users/sangkuofeng/Documents/IdeaProjects/dict_get/src/main/resources/items/";
|
|
|
+ public static final String TARGET_PATH = "/Users/sangkuofeng/Documents/IdeaProjects/dict_get/src/main/resources/";
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
// 加载字典
|
|
|
@@ -32,6 +33,7 @@ public class GetDictItem {
|
|
|
for (KeyResult.DataDto category : keyResult.getData()) {
|
|
|
Console.log(category.getDictCode(), category.getDictName());
|
|
|
getDictResult(category);
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -63,9 +65,14 @@ public class GetDictItem {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 生成Excel
|
|
|
+ * @param category
|
|
|
+ * @param items
|
|
|
+ */
|
|
|
private static void writeExcel(KeyResult.DataDto category, List<ItemResult.DataDto> items) {
|
|
|
// 通过工具类创建writer
|
|
|
- ExcelWriter writer = ExcelUtil.getWriter(TARGET_PATH + category.getDictCode() + "_" + category.getDictName() + ".xlsx");
|
|
|
+ ExcelWriter writer = ExcelUtil.getWriter(TARGET_PATH + "excel/" + category.getDictCode() + "_" + category.getDictName() + ".xlsx");
|
|
|
// 合并单元格后的标题行,使用默认标题样式
|
|
|
writer.merge(4, category.getDictName());
|
|
|
// 一次性写出内容,使用默认样式,强制输出标题
|
|
|
@@ -74,4 +81,17 @@ public class GetDictItem {
|
|
|
writer.close();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 生成SQL
|
|
|
+ * @param category
|
|
|
+ * @param items
|
|
|
+ */
|
|
|
+ private static void writeSQL(KeyResult.DataDto category, List<ItemResult.DataDto> items) {
|
|
|
+ List <String> list = new ArrayList<>();
|
|
|
+
|
|
|
+ list.add("");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|