|
@@ -85,6 +85,51 @@ public class FreeMarkerGeneratorTest {
|
|
|
params.setDs(ds);
|
|
|
|
|
|
|
|
|
+ IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
|
|
|
+
|
|
|
+ apiGeneratorService.generateCodes(params);
|
|
|
+ }
|
|
|
+ @Test
|
|
|
+ public void generateCodesTest1() throws IOException {
|
|
|
+ List<TableConfig> tableConfigs = new ArrayList<>();
|
|
|
+ TableConfig mainTable = new TableConfig();
|
|
|
+ mainTable.setTableName("xjr_oa_news");
|
|
|
+ mainTable.setIsMain(true);
|
|
|
+ mainTable.setPkField(GlobalConstant.DEFAULT_PK);
|
|
|
+ mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
|
|
|
+
|
|
|
+ TableConfig childTable1 = new TableConfig();
|
|
|
+ childTable1.setTableName("xjr_oa_news_relation");
|
|
|
+ childTable1.setIsMain(false);
|
|
|
+ childTable1.setPkField(GlobalConstant.DEFAULT_PK);
|
|
|
+ childTable1.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
|
|
|
+ childTable1.setRelationField("news_id");
|
|
|
+ childTable1.setRelationTableField(GlobalConstant.DEFAULT_PK);
|
|
|
+
|
|
|
+
|
|
|
+ TableConfig childTable2 = new TableConfig();
|
|
|
+ childTable2.setTableName("xjr_oa_news_relation_config");
|
|
|
+ childTable2.setIsMain(false);
|
|
|
+ childTable2.setPkField(GlobalConstant.DEFAULT_PK);
|
|
|
+ childTable2.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
|
|
|
+ childTable2.setRelationField("news_id");
|
|
|
+ childTable2.setRelationTableField(GlobalConstant.DEFAULT_PK);
|
|
|
+
|
|
|
+ tableConfigs.add(mainTable);
|
|
|
+ tableConfigs.add(childTable1);
|
|
|
+// tableConfigs.add(childTable2);
|
|
|
+
|
|
|
+ ApiGenerateCodesDto params = new ApiGenerateCodesDto();
|
|
|
+ params.setAuthor("fanxp");
|
|
|
+ params.setPackageName("test");
|
|
|
+ params.setTableConfigs(tableConfigs);
|
|
|
+ params.setPage(true);
|
|
|
+ params.setImport(true);
|
|
|
+ params.setExport(true);
|
|
|
+ params.setOutMainDir(false);
|
|
|
+ params.setDs(ds);
|
|
|
+
|
|
|
+
|
|
|
IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
|
|
|
|
|
|
apiGeneratorService.generateCodes(params);
|