|
@@ -1,43 +1,17 @@
|
|
package com.xjrsoft.xjrsoftboot;
|
|
package com.xjrsoft.xjrsoftboot;
|
|
|
|
|
|
-import cn.dev33.satoken.secure.SaSecureUtil;
|
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
|
import cn.hutool.db.ds.simple.SimpleDataSource;
|
|
import cn.hutool.db.ds.simple.SimpleDataSource;
|
|
-import cn.hutool.db.meta.Column;
|
|
|
|
-import cn.hutool.db.meta.MetaUtil;
|
|
|
|
-import cn.hutool.db.meta.Table;
|
|
|
|
-import cn.hutool.http.HttpUtil;
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
|
-import com.xjrsoft.XjrSoftApplication;
|
|
|
|
import com.xjrsoft.common.constant.GlobalConstant;
|
|
import com.xjrsoft.common.constant.GlobalConstant;
|
|
-import com.xjrsoft.common.utils.DatasourceUtil;
|
|
|
|
-import com.xjrsoft.common.utils.JdbcToJavaUtil;
|
|
|
|
-import com.xjrsoft.module.generator.constant.EntityConstant;
|
|
|
|
import com.xjrsoft.module.generator.dto.ApiGenerateCodesDto;
|
|
import com.xjrsoft.module.generator.dto.ApiGenerateCodesDto;
|
|
-import com.xjrsoft.module.generator.entity.FieldConfig;
|
|
|
|
-import com.xjrsoft.module.generator.entity.GeneratorConfig;
|
|
|
|
import com.xjrsoft.module.generator.entity.TableConfig;
|
|
import com.xjrsoft.module.generator.entity.TableConfig;
|
|
import com.xjrsoft.module.generator.service.IApiGeneratorService;
|
|
import com.xjrsoft.module.generator.service.IApiGeneratorService;
|
|
import com.xjrsoft.module.generator.service.impl.ApiGeneratorServiceImpl;
|
|
import com.xjrsoft.module.generator.service.impl.ApiGeneratorServiceImpl;
|
|
-import freemarker.template.Template;
|
|
|
|
-import freemarker.template.TemplateException;
|
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.Test;
|
|
-import org.junit.runner.RunWith;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
-import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
-import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
|
|
|
|
-import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
|
|
|
|
|
|
|
import javax.sql.DataSource;
|
|
import javax.sql.DataSource;
|
|
-import java.io.FileNotFoundException;
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
-import java.time.LocalDate;
|
|
+import java.util.ArrayList;
|
|
-import java.time.format.DateTimeFormatter;
|
|
+import java.util.List;
|
|
-import java.util.*;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
public class FreeMarkerGeneratorTest {
|
|
public class FreeMarkerGeneratorTest {
|
|
|
|
|
|
@@ -730,6 +704,72 @@ public class FreeMarkerGeneratorTest {
|
|
params.setDs(ds);
|
|
params.setDs(ds);
|
|
|
|
|
|
|
|
|
|
|
|
+ IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
|
|
|
|
+
|
|
|
|
+ apiGeneratorService.generateCodes(params);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ * 奖学金类型维护
|
|
|
|
+ */
|
|
|
|
+ @Test
|
|
|
|
+ public void gcBaseStudentScholarshipCategory() throws IOException {
|
|
|
|
+ List<TableConfig> tableConfigs = new ArrayList<>();
|
|
|
|
+ TableConfig mainTable = new TableConfig();
|
|
|
|
+ mainTable.setTableName("base_student_scholarship_category");
|
|
|
|
+ mainTable.setIsMain(true);
|
|
|
|
+ mainTable.setPkField(GlobalConstant.DEFAULT_PK);
|
|
|
|
+ mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
|
|
|
|
+ tableConfigs.add(mainTable);
|
|
|
|
+
|
|
|
|
+ mainTable = new TableConfig();
|
|
|
|
+ mainTable.setTableName("base_student_scholarship_level");
|
|
|
|
+ mainTable.setIsMain(false);
|
|
|
|
+ mainTable.setPkField(GlobalConstant.DEFAULT_PK);
|
|
|
|
+ mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
|
|
|
|
+ mainTable.setRelationField("base_student_scholarship_category_id");
|
|
|
|
+ mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);
|
|
|
|
+ tableConfigs.add(mainTable);
|
|
|
|
+
|
|
|
|
+ ApiGenerateCodesDto params = new ApiGenerateCodesDto();
|
|
|
|
+ params.setAuthor("dzx");
|
|
|
|
+ params.setPackageName("student");
|
|
|
|
+ params.setTableConfigs(tableConfigs);
|
|
|
|
+ params.setPage(true);
|
|
|
|
+ params.setImport(false);
|
|
|
|
+ params.setExport(false);
|
|
|
|
+ params.setOutMainDir(true);
|
|
|
|
+ params.setDs(ds);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
|
|
|
|
+
|
|
|
|
+ apiGeneratorService.generateCodes(params);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Test
|
|
|
|
+ public void gcBasestudentScholarshipApplicant() throws IOException {
|
|
|
|
+ List<TableConfig> tableConfigs = new ArrayList<>();
|
|
|
|
+ TableConfig mainTable = new TableConfig();
|
|
|
|
+ mainTable.setTableName("base_student_scholarship_applicant");
|
|
|
|
+ mainTable.setIsMain(true);
|
|
|
|
+ mainTable.setPkField(GlobalConstant.DEFAULT_PK);
|
|
|
|
+ mainTable.setPkType(GlobalConstant.DEFAULT_PK_TYPE);
|
|
|
|
+ mainTable.setRelationField("base_student_scholarship_category_id");
|
|
|
|
+ mainTable.setRelationTableField(GlobalConstant.DEFAULT_PK);
|
|
|
|
+ tableConfigs.add(mainTable);
|
|
|
|
+
|
|
|
|
+ ApiGenerateCodesDto params = new ApiGenerateCodesDto();
|
|
|
|
+ params.setAuthor("dzx");
|
|
|
|
+ params.setPackageName("student");
|
|
|
|
+ params.setTableConfigs(tableConfigs);
|
|
|
|
+ params.setPage(true);
|
|
|
|
+ params.setImport(false);
|
|
|
|
+ params.setExport(false);
|
|
|
|
+ params.setOutMainDir(true);
|
|
|
|
+ params.setDs(ds);
|
|
|
|
+
|
|
|
|
+
|
|
IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
|
|
IApiGeneratorService apiGeneratorService = new ApiGeneratorServiceImpl();
|
|
|
|
|
|
apiGeneratorService.generateCodes(params);
|
|
apiGeneratorService.generateCodes(params);
|