@@ -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("操作成功"); |
@@ -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); | |||
//获取模板列表 |
@@ -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); |