Sfoglia il codice sorgente

'代码生成'

master
dongyuangong 4 anni fa
parent
commit
3b0160bac5
3 ha cambiato i file con 16 aggiunte e 5 eliminazioni
  1. +3
    -4
      src/main/java/com/taauav/tool/controller/GenController.java
  2. +2
    -1
      src/main/java/com/taauav/tool/service/GenTableServiceImpl.java
  3. +11
    -0
      src/main/java/com/taauav/tool/util/VelocityUtils.java

+ 3
- 4
src/main/java/com/taauav/tool/controller/GenController.java Vedi File

@@ -3,7 +3,6 @@ package com.taauav.tool.controller;
import com.taauav.admin.controller.BaseController;
import com.taauav.common.bean.Response;
import com.taauav.tool.service.IGenTableService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@@ -19,13 +18,13 @@ public class GenController extends BaseController {
* 导入表结构(保存)
*/
@GetMapping("/importTable")
public Response importTableSave(String tables)
public Response importTableSave(@RequestParam("tableName") String tableName)
{
genTableService.importGenTable(tables);
genTableService.importGenTable(tableName);
return response.success("操作成功");
}
@GetMapping("genCode")
public Response genCode(@Param("tableName") String tableName)
public Response genCode(@RequestParam("tableName") String tableName)
{
genTableService.generatorCode(tableName);
return response.success("操作成功");

+ 2
- 1
src/main/java/com/taauav/tool/service/GenTableServiceImpl.java Vedi File

@@ -39,7 +39,8 @@ public class GenTableServiceImpl extends BaseServiceImpl<GenTableMapper, GenTabl
//查询列信息
List<GenTableColumn> colums = table.getColumns();
setPkColumn(table, colums);

//过滤不需要生成的字段
setIgnoreColumn(table, colums);
VelocityInitializer.initVelocity();
VelocityContext context = VelocityUtils.prepareContext(table);
//获取模板列表

+ 11
- 0
src/main/java/com/taauav/tool/util/VelocityUtils.java Vedi File

@@ -26,6 +26,17 @@ public class VelocityUtils
String funcationName = genTable.getFunctionName();

List<GenTableColumn> columnList = genTable.getColumns();
for (int i=0; i < columnList.size(); i++) {
GenTableColumn column = columnList.get(i);
if (null == column) {
continue;
}
if (column.getColumnName().equals("status") || column.getColumnName().equals("create_user") ||
column.getColumnName().equals("create_time") || column.getColumnName().equals("update_user") ||
column.getColumnName().equals("update_time") || column.getColumnName().equals("mark")) {
columnList.remove(i);
}
}

VelocityContext velocityContext = new VelocityContext();
velocityContext.put("tplCategory", tplCategory);

Loading…
Annulla
Salva