فهرست منبع

【CHG】修改数据表名

ZhaoMn 4 سال پیش
والد
کامیت
b7d384e9df

+ 14 - 1
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusInspectListController.java

@@ -1,9 +1,11 @@
 package com.railway.web.controller.business.catenary;
 
 
+import com.railway.business.catenary.domain.BusFdfxjyq;
 import com.railway.business.catenary.domain.BusJcbDmcgyq;
 import com.railway.business.catenary.domain.BusJcbFdfxjyq;
 import com.railway.business.catenary.domain.BusJcbGlkg;
+import com.railway.business.catenary.service.IBusFdfxjyqService;
 import com.railway.business.catenary.service.IBusJcbDmcgyqService;
 import com.railway.business.catenary.service.IBusJcbFdfxjyqService;
 import com.railway.business.catenary.service.IBusJcbGlkgService;
@@ -30,14 +32,17 @@ public class BusInspectListController extends BaseController {
   private final IBusJcbFdfxjyqService busJcbFdfxjyqService;
   private final IBusJcbGlkgService busJcbGlkgService;
   private final IBusJcbDmcgyqService busJcbDmcgyqService;
+  private final IBusFdfxjyqService busFdfxjyqService;
 
   public BusInspectListController(
       IBusJcbFdfxjyqService busJcbFdfxjyqService,
       IBusJcbGlkgService busJcbGlkgService,
-      IBusJcbDmcgyqService busJcbDmcgyqService) {
+      IBusJcbDmcgyqService busJcbDmcgyqService,
+      IBusFdfxjyqService busFdfxjyqService) {
     this.busJcbFdfxjyqService = busJcbFdfxjyqService;
     this.busJcbGlkgService = busJcbGlkgService;
     this.busJcbDmcgyqService = busJcbDmcgyqService;
+    this.busFdfxjyqService = busFdfxjyqService;
   }
 
   @ApiOperation(value = "dxf分选绝缘器检查表")
@@ -64,5 +69,13 @@ public class BusInspectListController extends BaseController {
     return getDataTable(list);
   }
 
+  @ApiOperation(value = "分段分相绝缘器")
+  @GetMapping(value = "list")
+  public TableDataInfo getList(BusFdfxjyq busFdfxjyq) {
+    startPage();
+    List<BusFdfxjyq> list = busFdfxjyqService.getList(busFdfxjyq);
+    return getDataTable(list);
+  }
+
 }
 

+ 7 - 15
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcbFdfxjyqController.java

@@ -1,32 +1,23 @@
 package com.railway.web.controller.business.catenary;
 
 import com.railway.business.catenary.domain.BusJcbFdfxjyq;
-import com.railway.business.catenary.domain.BusJcbGlkg;
 import com.railway.business.catenary.service.IBusJcbFdfxjyqService;
-import com.railway.common.utils.poi.WordUtils;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.ResponseEntity;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.bind.WebDataBinder;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
 import com.railway.common.core.page.TableDataInfo;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
+import com.railway.common.utils.poi.WordUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import java.io.FileInputStream;
 import java.io.InputStream;
 import java.net.URLEncoder;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -133,7 +124,8 @@ public class BusJcbFdfxjyqController extends BaseController {
             header.put("content", WordUtils.inputStream2ByteArray(new FileInputStream(filePath+"/fdjyq-20211016.png"), true));
             params.put("${header}",header);
             InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("word/template/DXF分段绝缘器手册.docx");
-            String fileName= URLEncoder.encode("测试文档.docx", "UTF-8");    //生成word文件的文件名
+            //生成word文件的文件名
+            String fileName= URLEncoder.encode("测试文档.docx", "UTF-8");
             //调用生成导出方法
             wordUtil.getWord(inputStream,params,null,fileName,response);
 

+ 89 - 69
railway-generator/src/main/java/com/railway/generator/controller/IndexController.java

@@ -32,59 +32,60 @@ import static com.railway.generator.util.StringPlusUtils.underlineToCamelCase;
 @Slf4j
 public class IndexController {
 
-    @Autowired
-    private FreemarkerTool freemarkerTool;
+  @Autowired
+  private FreemarkerTool freemarkerTool;
 
-    @RequestMapping("/")
-    public String index() {
-        return "index";
-    }
-
-    @RequestMapping("/genCode")
-    @ResponseBody
-    public ReturnT<Map<String, String>> codeGenerate(String tableSql,
-                                                     //2019-2-10 liutf 修改为@RequestParam参数校验
-                                                     @RequestParam(required = false, defaultValue = "author") String authorName,
-                                                     @RequestParam(required = false, defaultValue = "com.railway.business.catenary") String packageName,
-                                                     @RequestParam(required = false, defaultValue = "") String className,
-                                                     @RequestParam(required = false, defaultValue = "id") String primaryKey,
-                                                     @RequestParam(required = false, defaultValue = "/Users/wuhonghao/IdeaProjects/railway") String projectPath,
-                                                     @RequestParam(required = false, defaultValue = "ApiReturnUtil") String returnUtil
-    ) {
+  @RequestMapping("/")
+  public String index() {
+    return "index";
+  }
 
+  @RequestMapping("/genCode")
+  @ResponseBody
+  public ReturnT<Map<String, String>> codeGenerate(String tableSql,
+      //2019-2-10 liutf 修改为@RequestParam参数校验
+      @RequestParam(required = false, defaultValue = "author") String authorName,
+      @RequestParam(required = false, defaultValue = "com.railway.business.catenary") String packageName,
+      @RequestParam(required = false, defaultValue = "") String className,
+      @RequestParam(required = false, defaultValue = "id") String primaryKey,
+      @RequestParam(required = false, defaultValue = "D:/railway/") String projectPath,
+      @RequestParam(required = false, defaultValue = "ApiReturnUtil") String returnUtil
+  ) {
 
-        try {
+    try {
 
-            if (StringUtils.isBlank(tableSql)) {
-                return new ReturnT<>(ReturnT.FAIL_CODE, "表结构信息不可为空");
-            }
+      if (StringUtils.isBlank(tableSql)) {
+        return new ReturnT<>(ReturnT.FAIL_CODE, "表结构信息不可为空");
+      }
 
-            // parse table
-            ClassInfo classInfo = CodeGeneratorTool.processTableIntoClassInfo(tableSql);
+      // parse table
+      ClassInfo classInfo = CodeGeneratorTool.processTableIntoClassInfo(tableSql);
 
-            // code genarete
-            Map<String, Object> params = new HashMap<String, Object>();
-            if (StringUtils.isNotEmpty(className)) {
-                classInfo.setClassName(className);
-            }
-            String primaryKeyCame = underlineToCamelCase(primaryKey);
-            String restPath = packageName.substring(packageName.lastIndexOf(".") + 1) + camelCaseToUnderline(className).replace("_", "/");
-            params.put("classInfo", classInfo);
-            params.put("authorName", authorName);
-            params.put("packageName", packageName);
-            params.put("returnUtil", returnUtil);
-            params.put("primaryKey", primaryKey);
-            params.put("primaryKeyCame", primaryKeyCame);
-            params.put("restPath", restPath);
-            List<FieldInfo> list = new ArrayList();
-            for (FieldInfo fieldInfo : classInfo.getFieldList()) {
-                if (!fieldInfo.getFieldName().equals(primaryKeyCame)) {
-                    list.add(fieldInfo);
-                }
-            }
-            classInfo.setFieldList(list);
-            // result
-            Map<String, String> result = new HashMap<String, String>();
+      // code genarete
+      Map<String, Object> params = new HashMap<String, Object>();
+      if (StringUtils.isNotEmpty(className)) {
+        classInfo.setClassName(className);
+      }
+      String primaryKeyCame = underlineToCamelCase(primaryKey);
+      String restPath =
+          packageName.substring(packageName.lastIndexOf(".") + 1) + camelCaseToUnderline(
+              className).replace("_", "/");
+      params.put("classInfo", classInfo);
+      params.put("authorName", authorName);
+      params.put("packageName", packageName);
+      params.put("returnUtil", returnUtil);
+      params.put("primaryKey", primaryKey);
+      params.put("primaryKeyCame", primaryKeyCame);
+      params.put("restPath", restPath);
+      List<FieldInfo> list = new ArrayList();
+      for (FieldInfo fieldInfo : classInfo.getFieldList()) {
+        if (!fieldInfo.getFieldName().equals(primaryKeyCame)) {
+          list.add(fieldInfo);
+        }
+      }
+      classInfo.setFieldList(list);
+      // result
+      Map<String, String> result = new HashMap<String, String>();
 //
 //            //UI
 //            result.put("swagger-ui", freemarkerTool.processString("code-generator/ui/swagger-ui.ftl", params));
@@ -112,20 +113,39 @@ public class IndexController {
 //            //mybatis plus
 //            result.put("pluscontroller", freemarkerTool.processString("code-generator/mybatis-plus/pluscontroller.ftl", params));
 //            result.put("plusmapper", freemarkerTool.processString("code-generator/mybatis-plus/plusmapper.ftl", params));
-            String controllerPath = projectPath + File.separator + "railway-admin/src/main/java/com/railway/web/controller/business/catenary" + File.separator + classInfo.getClassName() + "Controller.java";
-            String servicePath = projectPath + File.separator + "railway-business/src/main/java/com/railway/business/catenary"  + File.separator + "service" + File.separator + "I"+classInfo.getClassName() + "Service.java";
-            String serviceImplPath = projectPath + File.separator + "railway-business/src/main/java/com/railway/business//catenary" + File.separator + "service" + File.separator + "impl" + File.separator + classInfo.getClassName() + "ServiceImpl.java";
-            String daoPath = projectPath + File.separator + "railway-business/src/main/java/com/railway/business/catenary" +  File.separator + "mapper" + File.separator + classInfo.getClassName() + "Mapper.java";
-            String entityPath = projectPath + File.separator + "railway-business/src/main/java/com/railway/business/catenary" +  File.separator + "domain" + File.separator + classInfo.getClassName() + ".java";
-            String mapperPath = projectPath + File.separator + "railway-business/src/main/resources/mapper/business" + File.separator + classInfo.getClassName() + "Mapper.xml";
-            //写入文件
-            FileUtil.writeToFile(controllerPath, freemarkerTool.processString("code-generator/railway/back/controller.ftl", params));
-            FileUtil.writeToFile(servicePath, freemarkerTool.processString("code-generator/railway/back/service.ftl", params));
-            FileUtil.writeToFile(serviceImplPath, freemarkerTool.processString("code-generator/railway/back/serviceImpl.ftl", params));
-            FileUtil.writeToFile(daoPath, freemarkerTool.processString("code-generator/railway/back/dao.ftl", params));
-            FileUtil.writeToFile(entityPath, freemarkerTool.processString("code-generator/railway/back/entity.ftl", params));
-            FileUtil.writeToFile(mapperPath, freemarkerTool.processString("code-generator/railway/back/mybatis.ftl", params));
-            // 计算,生成代码行数
+      String controllerPath = projectPath + File.separator
+          + "railway-admin/src/main/java/com/railway/web/controller/business/catenary"
+          + File.separator + classInfo.getClassName() + "Controller.java";
+      String servicePath = projectPath + File.separator
+          + "railway-business/src/main/java/com/railway/business/catenary" + File.separator
+          + "service" + File.separator + "I" + classInfo.getClassName() + "Service.java";
+      String serviceImplPath = projectPath + File.separator
+          + "railway-business/src/main/java/com/railway/business//catenary" + File.separator
+          + "service" + File.separator + "impl" + File.separator + classInfo.getClassName()
+          + "ServiceImpl.java";
+      String daoPath = projectPath + File.separator
+          + "railway-business/src/main/java/com/railway/business/catenary" + File.separator
+          + "mapper" + File.separator + classInfo.getClassName() + "Mapper.java";
+      String entityPath = projectPath + File.separator
+          + "railway-business/src/main/java/com/railway/business/catenary" + File.separator
+          + "domain" + File.separator + classInfo.getClassName() + ".java";
+      String mapperPath =
+          projectPath + File.separator + "railway-business/src/main/resources/mapper/business"
+              + File.separator + classInfo.getClassName() + "Mapper.xml";
+      //写入文件
+      FileUtil.writeToFile(controllerPath,
+          freemarkerTool.processString("code-generator/railway/back/controller.ftl", params));
+      FileUtil.writeToFile(servicePath,
+          freemarkerTool.processString("code-generator/railway/back/service.ftl", params));
+      FileUtil.writeToFile(serviceImplPath,
+          freemarkerTool.processString("code-generator/railway/back/serviceImpl.ftl", params));
+      FileUtil.writeToFile(daoPath,
+          freemarkerTool.processString("code-generator/railway/back/dao.ftl", params));
+      FileUtil.writeToFile(entityPath,
+          freemarkerTool.processString("code-generator/railway/back/entity.ftl", params));
+      FileUtil.writeToFile(mapperPath,
+          freemarkerTool.processString("code-generator/railway/back/mybatis.ftl", params));
+      // 计算,生成代码行数
 //            int lineNum = 0;
 //            for (Map.Entry<String, String> item : result.entrySet()) {
 //                if (item.getValue() != null) {
@@ -133,14 +153,14 @@ public class IndexController {
 //                }
 //            }
 //            log.info("生成代码行数:{}", lineNum);
-            //测试环境可自行开启
-            //log.info("生成代码数据:{}", result);
-            return new ReturnT<>(result);
-        } catch (IOException | TemplateException e) {
-            log.error(e.getMessage(), e);
-            return new ReturnT<>(ReturnT.FAIL_CODE, "表结构解析失败" + e.getMessage());
-        }
-
+      //测试环境可自行开启
+      //log.info("生成代码数据:{}", result);
+      return new ReturnT<>(result);
+    } catch (IOException | TemplateException e) {
+      log.error(e.getMessage(), e);
+      return new ReturnT<>(ReturnT.FAIL_CODE, "表结构解析失败" + e.getMessage());
     }
 
+  }
+
 }