Pre Merge pull request !207 from XiaoHH/issue-I5AT0W
This commit is contained in:
commit
d0372623b4
|
|
@ -8,14 +8,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -55,6 +48,17 @@ public class GenController extends BaseController
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有可以生成代码的数据库名称列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("tool:gen:list")
|
||||||
|
@GetMapping("/schema/list")
|
||||||
|
public AjaxResult genSchemaList()
|
||||||
|
{
|
||||||
|
List<String> list = genTableService.selectGenSchemaList();
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改代码生成业务
|
* 修改代码生成业务
|
||||||
*/
|
*/
|
||||||
|
|
@ -102,12 +106,12 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("tool:gen:import")
|
@RequiresPermissions("tool:gen:import")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
||||||
@PostMapping("/importTable")
|
@PostMapping("/importTable/{schemaName}")
|
||||||
public AjaxResult importTableSave(String tables)
|
public AjaxResult importTableSave(@PathVariable("schemaName") String schemaName, @RequestParam("tables") String tables)
|
||||||
{
|
{
|
||||||
String[] tableNames = Convert.toStrArray(tables);
|
String[] tableNames = Convert.toStrArray(tables);
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
List<GenTable> tableList = genTableService.selectDbTableListByNames(tableNames);
|
List<GenTable> tableList = genTableService.selectDbTableListByNames(schemaName, tableNames);
|
||||||
genTableService.importGenTable(tableList);
|
genTableService.importGenTable(tableList);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
@ -153,10 +157,10 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("tool:gen:code")
|
@RequiresPermissions("tool:gen:code")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||||
@GetMapping("/download/{tableName}")
|
@GetMapping("/download/{schemaName}/{tableName}")
|
||||||
public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException
|
public void download(HttpServletResponse response, @PathVariable("schemaName") String schemaName, @PathVariable("tableName") String tableName) throws IOException
|
||||||
{
|
{
|
||||||
byte[] data = genTableService.downloadCode(tableName);
|
byte[] data = genTableService.downloadCode(schemaName, tableName);
|
||||||
genCode(response, data);
|
genCode(response, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,10 +169,10 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("tool:gen:code")
|
@RequiresPermissions("tool:gen:code")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||||
@GetMapping("/genCode/{tableName}")
|
@GetMapping("/genCode/{schemaName}/{tableName}")
|
||||||
public AjaxResult genCode(@PathVariable("tableName") String tableName)
|
public AjaxResult genCode(@PathVariable("schemaName") String schemaName, @PathVariable("tableName") String tableName)
|
||||||
{
|
{
|
||||||
genTableService.generatorCode(tableName);
|
genTableService.generatorCode(schemaName, tableName);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,10 +181,10 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("tool:gen:edit")
|
@RequiresPermissions("tool:gen:edit")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
@Log(title = "代码生成", businessType = BusinessType.UPDATE)
|
||||||
@GetMapping("/synchDb/{tableName}")
|
@GetMapping("/synchDb/{schemaName}/{tableName}")
|
||||||
public AjaxResult synchDb(@PathVariable("tableName") String tableName)
|
public AjaxResult synchDb(@PathVariable("schemaName") String schemaName, @PathVariable("tableName") String tableName)
|
||||||
{
|
{
|
||||||
genTableService.synchDb(tableName);
|
genTableService.synchDb(schemaName, tableName);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,11 +193,11 @@ public class GenController extends BaseController
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("tool:gen:code")
|
@RequiresPermissions("tool:gen:code")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
@Log(title = "代码生成", businessType = BusinessType.GENCODE)
|
||||||
@GetMapping("/batchGenCode")
|
@GetMapping("/batchGenCode/{schemaName}")
|
||||||
public void batchGenCode(HttpServletResponse response, String tables) throws IOException
|
public void batchGenCode(HttpServletResponse response, @PathVariable("schemaName") String schemaName, String tables) throws IOException
|
||||||
{
|
{
|
||||||
String[] tableNames = Convert.toStrArray(tables);
|
String[] tableNames = Convert.toStrArray(tables);
|
||||||
byte[] data = genTableService.downloadCode(tableNames);
|
byte[] data = genTableService.downloadCode(schemaName, tableNames);
|
||||||
genCode(response, data);
|
genCode(response, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,10 @@ public class GenTable extends BaseEntity
|
||||||
/** 编号 */
|
/** 编号 */
|
||||||
private Long tableId;
|
private Long tableId;
|
||||||
|
|
||||||
|
/** 库名称 */
|
||||||
|
@NotBlank(message = "库名称不能为空")
|
||||||
|
private String schemaName;
|
||||||
|
|
||||||
/** 表名称 */
|
/** 表名称 */
|
||||||
@NotBlank(message = "表名称不能为空")
|
@NotBlank(message = "表名称不能为空")
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
@ -105,6 +109,16 @@ public class GenTable extends BaseEntity
|
||||||
this.tableId = tableId;
|
this.tableId = tableId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSchemaName()
|
||||||
|
{
|
||||||
|
return schemaName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSchemaName(String schemaName)
|
||||||
|
{
|
||||||
|
this.schemaName = schemaName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTableName()
|
public String getTableName()
|
||||||
{
|
{
|
||||||
return tableName;
|
return tableName;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.gen.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.gen.domain.GenTableColumn;
|
import com.ruoyi.gen.domain.GenTableColumn;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务字段 数据层
|
* 业务字段 数据层
|
||||||
|
|
@ -12,11 +13,12 @@ public interface GenTableColumnMapper
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 根据表名称查询列信息
|
* 根据表名称查询列信息
|
||||||
*
|
*
|
||||||
* @param tableName 表名称
|
* @param schemaName 数据库名字
|
||||||
|
* @param tableName 表名称
|
||||||
* @return 列信息
|
* @return 列信息
|
||||||
*/
|
*/
|
||||||
public List<GenTableColumn> selectDbTableColumnsByName(String tableName);
|
public List<GenTableColumn> selectDbTableColumnsByName(@Param("schemaName") String schemaName, @Param("tableName") String tableName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询业务字段列表
|
* 查询业务字段列表
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.gen.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.gen.domain.GenTable;
|
import com.ruoyi.gen.domain.GenTable;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务 数据层
|
* 业务 数据层
|
||||||
|
|
@ -18,6 +19,13 @@ public interface GenTableMapper
|
||||||
*/
|
*/
|
||||||
public List<GenTable> selectGenTableList(GenTable genTable);
|
public List<GenTable> selectGenTableList(GenTable genTable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有可以生成代码的数据库名称列表
|
||||||
|
*
|
||||||
|
* @return 数据库名称列表
|
||||||
|
*/
|
||||||
|
public List<String> selectGenSchemaList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询据库列表
|
* 查询据库列表
|
||||||
*
|
*
|
||||||
|
|
@ -32,7 +40,7 @@ public interface GenTableMapper
|
||||||
* @param tableNames 表名称组
|
* @param tableNames 表名称组
|
||||||
* @return 数据库表集合
|
* @return 数据库表集合
|
||||||
*/
|
*/
|
||||||
public List<GenTable> selectDbTableListByNames(String[] tableNames);
|
public List<GenTable> selectDbTableListByNames(@Param("schemaName") String schemaName, @Param("tableNames") String[] tableNames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有表信息
|
* 查询所有表信息
|
||||||
|
|
@ -55,7 +63,7 @@ public interface GenTableMapper
|
||||||
* @param tableName 表名称
|
* @param tableName 表名称
|
||||||
* @return 业务信息
|
* @return 业务信息
|
||||||
*/
|
*/
|
||||||
public GenTable selectGenTableByName(String tableName);
|
public GenTable selectGenTableByName(@Param("schemaName") String schemaName, @Param("tableName") String tableName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增业务
|
* 新增业务
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,20 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
return genTableMapper.selectGenTableList(genTable);
|
return genTableMapper.selectGenTableList(genTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有可以生成代码的数据库名称列表
|
||||||
|
*
|
||||||
|
* @return 数据库名称列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<String> selectGenSchemaList()
|
||||||
|
{
|
||||||
|
return genTableMapper.selectGenSchemaList();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询据库列表
|
* 查询据库列表
|
||||||
*
|
*
|
||||||
* @param genTable 业务信息
|
* @param genTable 业务信息
|
||||||
* @return 数据库表集合
|
* @return 数据库表集合
|
||||||
*/
|
*/
|
||||||
|
|
@ -93,14 +104,15 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询据库列表
|
* 查询据库列表
|
||||||
*
|
*
|
||||||
|
* @param schemaName 数据库的名称
|
||||||
* @param tableNames 表名称组
|
* @param tableNames 表名称组
|
||||||
* @return 数据库表集合
|
* @return 数据库表集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GenTable> selectDbTableListByNames(String[] tableNames)
|
public List<GenTable> selectDbTableListByNames(String schemaName, String[] tableNames)
|
||||||
{
|
{
|
||||||
return genTableMapper.selectDbTableListByNames(tableNames);
|
return genTableMapper.selectDbTableListByNames(schemaName, tableNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -170,7 +182,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
if (row > 0)
|
if (row > 0)
|
||||||
{
|
{
|
||||||
// 保存列信息
|
// 保存列信息
|
||||||
List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
List<GenTableColumn> genTableColumns = genTableColumnMapper.selectDbTableColumnsByName(table.getSchemaName(), tableName);
|
||||||
for (GenTableColumn column : genTableColumns)
|
for (GenTableColumn column : genTableColumns)
|
||||||
{
|
{
|
||||||
GenUtils.initColumnField(column, table);
|
GenUtils.initColumnField(column, table);
|
||||||
|
|
@ -220,30 +232,32 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成代码(下载方式)
|
* 生成代码(下载方式)
|
||||||
*
|
*
|
||||||
* @param tableName 表名称
|
* @param schemaName 库名称
|
||||||
|
* @param tableName 表名称
|
||||||
* @return 数据
|
* @return 数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public byte[] downloadCode(String tableName)
|
public byte[] downloadCode(String schemaName, String tableName)
|
||||||
{
|
{
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||||
generatorCode(tableName, zip);
|
generatorCode(schemaName, tableName, zip);
|
||||||
IOUtils.closeQuietly(zip);
|
IOUtils.closeQuietly(zip);
|
||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成代码(自定义路径)
|
* 生成代码(自定义路径)
|
||||||
*
|
*
|
||||||
* @param tableName 表名称
|
* @param schemaName 库名称
|
||||||
|
* @param tableName 表名称
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void generatorCode(String tableName)
|
public void generatorCode(String schemaName, String tableName)
|
||||||
{
|
{
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
GenTable table = genTableMapper.selectGenTableByName(schemaName, tableName);
|
||||||
// 设置主子表信息
|
// 设置主子表信息
|
||||||
setSubTable(table);
|
setSubTable(table);
|
||||||
// 设置主键列信息
|
// 设置主键列信息
|
||||||
|
|
@ -283,13 +297,13 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void synchDb(String tableName)
|
public void synchDb(String schemaName, String tableName)
|
||||||
{
|
{
|
||||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
GenTable table = genTableMapper.selectGenTableByName(schemaName, tableName);
|
||||||
List<GenTableColumn> tableColumns = table.getColumns();
|
List<GenTableColumn> tableColumns = table.getColumns();
|
||||||
Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity()));
|
Map<String, GenTableColumn> tableColumnMap = tableColumns.stream().collect(Collectors.toMap(GenTableColumn::getColumnName, Function.identity()));
|
||||||
|
|
||||||
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(schemaName, tableName);
|
||||||
if (StringUtils.isEmpty(dbTableColumns))
|
if (StringUtils.isEmpty(dbTableColumns))
|
||||||
{
|
{
|
||||||
throw new ServiceException("同步数据失败,原表结构不存在");
|
throw new ServiceException("同步数据失败,原表结构不存在");
|
||||||
|
|
@ -333,18 +347,19 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量生成代码(下载方式)
|
* 批量生成代码(下载方式)
|
||||||
*
|
*
|
||||||
|
* @param schemaName 库名称
|
||||||
* @param tableNames 表数组
|
* @param tableNames 表数组
|
||||||
* @return 数据
|
* @return 数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public byte[] downloadCode(String[] tableNames)
|
public byte[] downloadCode(String schemaName, String[] tableNames)
|
||||||
{
|
{
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||||
for (String tableName : tableNames)
|
for (String tableName : tableNames)
|
||||||
{
|
{
|
||||||
generatorCode(tableName, zip);
|
generatorCode(schemaName, tableName, zip);
|
||||||
}
|
}
|
||||||
IOUtils.closeQuietly(zip);
|
IOUtils.closeQuietly(zip);
|
||||||
return outputStream.toByteArray();
|
return outputStream.toByteArray();
|
||||||
|
|
@ -353,10 +368,10 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
/**
|
/**
|
||||||
* 查询表信息并生成代码
|
* 查询表信息并生成代码
|
||||||
*/
|
*/
|
||||||
private void generatorCode(String tableName, ZipOutputStream zip)
|
private void generatorCode(String schemaName, String tableName, ZipOutputStream zip)
|
||||||
{
|
{
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
GenTable table = genTableMapper.selectGenTableByName(schemaName, tableName);
|
||||||
// 设置主子表信息
|
// 设置主子表信息
|
||||||
setSubTable(table);
|
setSubTable(table);
|
||||||
// 设置主键列信息
|
// 设置主键列信息
|
||||||
|
|
@ -474,7 +489,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
String subTableName = table.getSubTableName();
|
String subTableName = table.getSubTableName();
|
||||||
if (StringUtils.isNotEmpty(subTableName))
|
if (StringUtils.isNotEmpty(subTableName))
|
||||||
{
|
{
|
||||||
table.setSubTable(genTableMapper.selectGenTableByName(subTableName));
|
table.setSubTable(genTableMapper.selectGenTableByName(table.getSchemaName(), subTableName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,13 @@ public interface IGenTableService
|
||||||
*/
|
*/
|
||||||
public List<GenTable> selectGenTableList(GenTable genTable);
|
public List<GenTable> selectGenTableList(GenTable genTable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有可以生成代码的数据库名称列表
|
||||||
|
*
|
||||||
|
* @return 数据库名称列表
|
||||||
|
*/
|
||||||
|
public List<String> selectGenSchemaList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询据库列表
|
* 查询据库列表
|
||||||
*
|
*
|
||||||
|
|
@ -29,11 +36,12 @@ public interface IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询据库列表
|
* 查询据库列表
|
||||||
*
|
*
|
||||||
|
* @param schemaName 数据库的名称
|
||||||
* @param tableNames 表名称组
|
* @param tableNames 表名称组
|
||||||
* @return 数据库表集合
|
* @return 数据库表集合
|
||||||
*/
|
*/
|
||||||
public List<GenTable> selectDbTableListByNames(String[] tableNames);
|
public List<GenTable> selectDbTableListByNames(String schemaName, String[] tableNames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询所有表信息
|
* 查询所有表信息
|
||||||
|
|
@ -83,11 +91,12 @@ public interface IGenTableService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成代码(下载方式)
|
* 生成代码(下载方式)
|
||||||
*
|
*
|
||||||
* @param tableName 表名称
|
* @param schemaName 库名称
|
||||||
|
* @param tableName 表名称
|
||||||
* @return 数据
|
* @return 数据
|
||||||
*/
|
*/
|
||||||
public byte[] downloadCode(String tableName);
|
public byte[] downloadCode(String schemaName, String tableName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成代码(自定义路径)
|
* 生成代码(自定义路径)
|
||||||
|
|
@ -95,22 +104,24 @@ public interface IGenTableService
|
||||||
* @param tableName 表名称
|
* @param tableName 表名称
|
||||||
* @return 数据
|
* @return 数据
|
||||||
*/
|
*/
|
||||||
public void generatorCode(String tableName);
|
public void generatorCode(String schemaName, String tableName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步数据库
|
* 同步数据库
|
||||||
*
|
*
|
||||||
* @param tableName 表名称
|
* @param schemaName 数据库的名称
|
||||||
|
* @param tableName 表名称
|
||||||
*/
|
*/
|
||||||
public void synchDb(String tableName);
|
public void synchDb(String schemaName, String tableName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量生成代码(下载方式)
|
* 批量生成代码(下载方式)
|
||||||
*
|
*
|
||||||
|
* @param schemaName 库名称
|
||||||
* @param tableNames 表数组
|
* @param tableNames 表数组
|
||||||
* @return 数据
|
* @return 数据
|
||||||
*/
|
*/
|
||||||
public byte[] downloadCode(String[] tableNames);
|
public byte[] downloadCode(String schemaName, String[] tableNames);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存参数校验
|
* 修改保存参数校验
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
|
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
|
||||||
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
|
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
|
||||||
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
|
from information_schema.columns where table_schema = #{schemaName} and table_name = (#{tableName})
|
||||||
order by ordinal_position
|
order by ordinal_position
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,202 +1,216 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.gen.mapper.GenTableMapper">
|
<mapper namespace="com.ruoyi.gen.mapper.GenTableMapper">
|
||||||
|
|
||||||
<resultMap type="GenTable" id="GenTableResult">
|
<resultMap type="GenTable" id="GenTableResult">
|
||||||
<id property="tableId" column="table_id" />
|
<id property="tableId" column="table_id" />
|
||||||
<result property="tableName" column="table_name" />
|
<result property="schemaName" column="schema_name" />
|
||||||
<result property="tableComment" column="table_comment" />
|
<result property="tableName" column="table_name" />
|
||||||
<result property="subTableName" column="sub_table_name" />
|
<result property="tableComment" column="table_comment" />
|
||||||
<result property="subTableFkName" column="sub_table_fk_name" />
|
<result property="subTableName" column="sub_table_name" />
|
||||||
<result property="className" column="class_name" />
|
<result property="subTableFkName" column="sub_table_fk_name" />
|
||||||
<result property="tplCategory" column="tpl_category" />
|
<result property="className" column="class_name" />
|
||||||
<result property="packageName" column="package_name" />
|
<result property="tplCategory" column="tpl_category" />
|
||||||
<result property="moduleName" column="module_name" />
|
<result property="packageName" column="package_name" />
|
||||||
<result property="businessName" column="business_name" />
|
<result property="moduleName" column="module_name" />
|
||||||
<result property="functionName" column="function_name" />
|
<result property="businessName" column="business_name" />
|
||||||
<result property="functionAuthor" column="function_author" />
|
<result property="functionName" column="function_name" />
|
||||||
<result property="genType" column="gen_type" />
|
<result property="functionAuthor" column="function_author" />
|
||||||
<result property="genPath" column="gen_path" />
|
<result property="genType" column="gen_type" />
|
||||||
<result property="options" column="options" />
|
<result property="genPath" column="gen_path" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="options" column="options" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="remark" column="remark" />
|
<result property="updateTime" column="update_time" />
|
||||||
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
<result property="remark" column="remark" />
|
||||||
</resultMap>
|
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
||||||
|
</resultMap>
|
||||||
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
|
||||||
<id property="columnId" column="column_id" />
|
<resultMap type="GenTableColumn" id="GenTableColumnResult">
|
||||||
<result property="tableId" column="table_id" />
|
<id property="columnId" column="column_id" />
|
||||||
<result property="columnName" column="column_name" />
|
<result property="tableId" column="table_id" />
|
||||||
<result property="columnComment" column="column_comment" />
|
<result property="columnName" column="column_name" />
|
||||||
<result property="columnType" column="column_type" />
|
<result property="columnComment" column="column_comment" />
|
||||||
<result property="javaType" column="java_type" />
|
<result property="columnType" column="column_type" />
|
||||||
<result property="javaField" column="java_field" />
|
<result property="javaType" column="java_type" />
|
||||||
<result property="isPk" column="is_pk" />
|
<result property="javaField" column="java_field" />
|
||||||
<result property="isIncrement" column="is_increment" />
|
<result property="isPk" column="is_pk" />
|
||||||
<result property="isRequired" column="is_required" />
|
<result property="isIncrement" column="is_increment" />
|
||||||
<result property="isInsert" column="is_insert" />
|
<result property="isRequired" column="is_required" />
|
||||||
<result property="isEdit" column="is_edit" />
|
<result property="isInsert" column="is_insert" />
|
||||||
<result property="isList" column="is_list" />
|
<result property="isEdit" column="is_edit" />
|
||||||
<result property="isQuery" column="is_query" />
|
<result property="isList" column="is_list" />
|
||||||
<result property="queryType" column="query_type" />
|
<result property="isQuery" column="is_query" />
|
||||||
<result property="htmlType" column="html_type" />
|
<result property="queryType" column="query_type" />
|
||||||
<result property="dictType" column="dict_type" />
|
<result property="htmlType" column="html_type" />
|
||||||
<result property="sort" column="sort" />
|
<result property="dictType" column="dict_type" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="sort" column="sort" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateBy" column="update_by" />
|
||||||
</resultMap>
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
<sql id="selectGenTableVo">
|
|
||||||
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
<sql id="selectGenTableVo">
|
||||||
</sql>
|
select table_id, schema_name, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
||||||
|
</sql>
|
||||||
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
|
||||||
<include refid="selectGenTableVo"/>
|
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
<where>
|
<include refid="selectGenTableVo"/>
|
||||||
<if test="tableName != null and tableName != ''">
|
<where>
|
||||||
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
<if test="schemaName != null and schemaName != ''">
|
||||||
</if>
|
AND lower(`schema_name`) like lower(concat('%', #{schemaName}, '%'))
|
||||||
<if test="tableComment != null and tableComment != ''">
|
</if>
|
||||||
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
<if test="tableName != null and tableName != ''">
|
||||||
</if>
|
AND lower(`table_name`) like lower(concat('%', #{tableName}, '%'))
|
||||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
</if>
|
||||||
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
<if test="tableComment != null and tableComment != ''">
|
||||||
</if>
|
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
</if>
|
||||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
</if>
|
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
</where>
|
</if>
|
||||||
</select>
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
|
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
</if>
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
</where>
|
||||||
where table_schema = (select database())
|
</select>
|
||||||
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
|
|
||||||
AND table_name NOT IN (select table_name from gen_table)
|
<select id="selectGenSchemaList" resultType="String">
|
||||||
<if test="tableName != null and tableName != ''">
|
SELECT TABLE_SCHEMA
|
||||||
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
FROM information_schema.`TABLES`
|
||||||
</if>
|
WHERE TABLE_SCHEMA NOT IN ( 'ry-config', 'ry-seata' )
|
||||||
<if test="tableComment != null and tableComment != ''">
|
AND TABLE_SCHEMA LIKE 'ry-%'
|
||||||
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
GROUP BY TABLE_SCHEMA
|
||||||
</if>
|
</select>
|
||||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
|
||||||
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
</if>
|
select table_schema as schema_name, table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
where table_schema = #{schemaName}
|
||||||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
|
||||||
</if>
|
AND table_name NOT IN (select table_name from gen_table where schema_name = table_schema)
|
||||||
order by create_time desc
|
<if test="tableName != null and tableName != ''">
|
||||||
</select>
|
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
||||||
|
</if>
|
||||||
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
<if test="tableComment != null and tableComment != ''">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
||||||
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
</if>
|
||||||
and table_name in
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
AND date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
#{name}
|
</if>
|
||||||
</foreach>
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
</select>
|
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
order by create_time desc
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
</select>
|
||||||
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
|
||||||
and table_name = #{tableName}
|
<select id="selectDbTableListByNames" resultMap="GenTableResult">
|
||||||
</select>
|
select table_schema as schema_name, table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
|
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = #{schemaName}
|
||||||
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
and table_name in
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
<foreach collection="tableNames" item="name" open="(" separator="," close=")">
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
#{name}
|
||||||
FROM gen_table t
|
</foreach>
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
</select>
|
||||||
where t.table_id = #{tableId} order by c.sort
|
|
||||||
</select>
|
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
and table_name = #{tableName}
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
</select>
|
||||||
FROM gen_table t
|
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
||||||
where t.table_name = #{tableName} order by c.sort
|
SELECT t.table_id, t.schema_name, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
</select>
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
|
FROM gen_table t
|
||||||
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
where t.table_id = #{tableId} order by c.sort
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
</select>
|
||||||
FROM gen_table t
|
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
order by c.sort
|
SELECT t.table_id, t.schema_name, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
</select>
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
|
FROM gen_table t
|
||||||
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
insert into gen_table (
|
where t.schema_name = #{schemaName} and t.table_name = #{tableName} order by c.sort
|
||||||
<if test="tableName != null">table_name,</if>
|
</select>
|
||||||
<if test="tableComment != null and tableComment != ''">table_comment,</if>
|
|
||||||
<if test="className != null and className != ''">class_name,</if>
|
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
||||||
<if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
||||||
<if test="packageName != null and packageName != ''">package_name,</if>
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
<if test="moduleName != null and moduleName != ''">module_name,</if>
|
FROM gen_table t
|
||||||
<if test="businessName != null and businessName != ''">business_name,</if>
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
<if test="functionName != null and functionName != ''">function_name,</if>
|
order by c.sort
|
||||||
<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
|
</select>
|
||||||
<if test="genType != null and genType != ''">gen_type,</if>
|
|
||||||
<if test="genPath != null and genPath != ''">gen_path,</if>
|
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
insert into gen_table (
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="tableName != null">schema_name ,</if>
|
||||||
create_time
|
<if test="tableName != null">table_name,</if>
|
||||||
)values(
|
<if test="tableComment != null and tableComment != ''">table_comment,</if>
|
||||||
<if test="tableName != null">#{tableName},</if>
|
<if test="className != null and className != ''">class_name,</if>
|
||||||
<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
|
<if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
|
||||||
<if test="className != null and className != ''">#{className},</if>
|
<if test="packageName != null and packageName != ''">package_name,</if>
|
||||||
<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
|
<if test="moduleName != null and moduleName != ''">module_name,</if>
|
||||||
<if test="packageName != null and packageName != ''">#{packageName},</if>
|
<if test="businessName != null and businessName != ''">business_name,</if>
|
||||||
<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
|
<if test="functionName != null and functionName != ''">function_name,</if>
|
||||||
<if test="businessName != null and businessName != ''">#{businessName},</if>
|
<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
|
||||||
<if test="functionName != null and functionName != ''">#{functionName},</if>
|
<if test="genType != null and genType != ''">gen_type,</if>
|
||||||
<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
|
<if test="genPath != null and genPath != ''">gen_path,</if>
|
||||||
<if test="genType != null and genType != ''">#{genType},</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
<if test="genPath != null and genPath != ''">#{genPath},</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
create_time
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
)values(
|
||||||
sysdate()
|
<if test="tableName != null">#{schemaName},</if>
|
||||||
)
|
<if test="tableName != null">#{tableName},</if>
|
||||||
</insert>
|
<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
|
||||||
|
<if test="className != null and className != ''">#{className},</if>
|
||||||
<update id="updateGenTable" parameterType="GenTable">
|
<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
|
||||||
update gen_table
|
<if test="packageName != null and packageName != ''">#{packageName},</if>
|
||||||
<set>
|
<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
|
||||||
<if test="tableName != null">table_name = #{tableName},</if>
|
<if test="businessName != null and businessName != ''">#{businessName},</if>
|
||||||
<if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
|
<if test="functionName != null and functionName != ''">#{functionName},</if>
|
||||||
<if test="subTableName != null">sub_table_name = #{subTableName},</if>
|
<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
|
||||||
<if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if>
|
<if test="genType != null and genType != ''">#{genType},</if>
|
||||||
<if test="className != null and className != ''">class_name = #{className},</if>
|
<if test="genPath != null and genPath != ''">#{genPath},</if>
|
||||||
<if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
<if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
|
sysdate()
|
||||||
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
|
)
|
||||||
<if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
|
</insert>
|
||||||
<if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
|
|
||||||
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
|
<update id="updateGenTable" parameterType="GenTable">
|
||||||
<if test="functionName != null and functionName != ''">function_name = #{functionName},</if>
|
update gen_table
|
||||||
<if test="options != null and options != ''">options = #{options},</if>
|
<set>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="tableName != null">table_name = #{tableName},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
|
||||||
update_time = sysdate()
|
<if test="subTableName != null">sub_table_name = #{subTableName},</if>
|
||||||
</set>
|
<if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if>
|
||||||
where table_id = #{tableId}
|
<if test="className != null and className != ''">class_name = #{className},</if>
|
||||||
</update>
|
<if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
|
||||||
|
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
|
||||||
<delete id="deleteGenTableByIds" parameterType="Long">
|
<if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
|
||||||
delete from gen_table where table_id in
|
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
|
||||||
<foreach collection="array" item="tableId" open="(" separator="," close=")">
|
<if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
|
||||||
#{tableId}
|
<if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
|
||||||
</foreach>
|
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
|
||||||
</delete>
|
<if test="functionName != null and functionName != ''">function_name = #{functionName},</if>
|
||||||
|
<if test="options != null and options != ''">options = #{options},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
|
where table_id = #{tableId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteGenTableByIds" parameterType="Long">
|
||||||
|
delete from gen_table where table_id in
|
||||||
|
<foreach collection="array" item="tableId" open="(" separator="," close=")">
|
||||||
|
#{tableId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -1,76 +1,84 @@
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 查询生成表数据
|
// 查询生成表数据
|
||||||
export function listTable(query) {
|
export function listTable(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/code/gen/list',
|
url: '/code/gen/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 查询db数据库列表
|
|
||||||
export function listDbTable(query) {
|
export function listSchema() {
|
||||||
return request({
|
return request({
|
||||||
url: '/code/gen/db/list',
|
url: '/code/gen/schema/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
})
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
// 查询db数据库列表
|
||||||
// 查询表详细信息
|
export function listDbTable(query) {
|
||||||
export function getGenTable(tableId) {
|
return request({
|
||||||
return request({
|
url: '/code/gen/db/list',
|
||||||
url: '/code/gen/' + tableId,
|
method: 'get',
|
||||||
method: 'get'
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改代码生成信息
|
// 查询表详细信息
|
||||||
export function updateGenTable(data) {
|
export function getGenTable(tableId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/code/gen',
|
url: '/code/gen/' + tableId,
|
||||||
method: 'put',
|
method: 'get'
|
||||||
data: data
|
})
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
// 修改代码生成信息
|
||||||
// 导入表
|
export function updateGenTable(data) {
|
||||||
export function importTable(data) {
|
return request({
|
||||||
return request({
|
url: '/code/gen',
|
||||||
url: '/code/gen/importTable',
|
method: 'put',
|
||||||
method: 'post',
|
data: data
|
||||||
params: data
|
})
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
// 导入表
|
||||||
// 预览生成代码
|
export function importTable(data, schemaName) {
|
||||||
export function previewTable(tableId) {
|
return request({
|
||||||
return request({
|
url: `/code/gen/importTable/${schemaName}`,
|
||||||
url: '/code/gen/preview/' + tableId,
|
method: 'post',
|
||||||
method: 'get'
|
params: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除表数据
|
// 预览生成代码
|
||||||
export function delTable(tableId) {
|
export function previewTable(tableId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/code/gen/' + tableId,
|
url: '/code/gen/preview/' + tableId,
|
||||||
method: 'delete'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成代码(自定义路径)
|
// 删除表数据
|
||||||
export function genCode(tableName) {
|
export function delTable(tableId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/code/gen/genCode/' + tableName,
|
url: '/code/gen/' + tableId,
|
||||||
method: 'get'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 同步数据库
|
// 生成代码(自定义路径)
|
||||||
export function synchDb(tableName) {
|
export function genCode(tableName) {
|
||||||
return request({
|
return request({
|
||||||
url: '/code/gen/synchDb/' + tableName,
|
url: '/code/gen/genCode/' + tableName,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 同步数据库
|
||||||
|
export function synchDb(schemaName, tableName) {
|
||||||
|
return request({
|
||||||
|
url: `/code/gen/synchDb/${schemaName}/${tableName}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,120 +1,151 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 导入表 -->
|
<!-- 导入表 -->
|
||||||
<el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
|
<el-dialog title="导入表" :visible.sync="visible" width="1200px" top="5vh" append-to-body>
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
|
||||||
<el-form-item label="表名称" prop="tableName">
|
<el-form-item label="库名称" prop="schemaName">
|
||||||
<el-input
|
<el-select v-model="queryParams.schemaName" placeholder="请选择库名称">
|
||||||
v-model="queryParams.tableName"
|
<el-option
|
||||||
placeholder="请输入表名称"
|
v-for="item in schemaList"
|
||||||
clearable
|
:key="item"
|
||||||
@keyup.enter.native="handleQuery"
|
:label="item"
|
||||||
/>
|
:value="item">
|
||||||
</el-form-item>
|
</el-option>
|
||||||
<el-form-item label="表描述" prop="tableComment">
|
</el-select>
|
||||||
<el-input
|
</el-form-item>
|
||||||
v-model="queryParams.tableComment"
|
<el-form-item label="表名称" prop="tableName">
|
||||||
placeholder="请输入表描述"
|
<el-input
|
||||||
clearable
|
v-model="queryParams.tableName"
|
||||||
@keyup.enter.native="handleQuery"
|
placeholder="请输入表名称"
|
||||||
/>
|
clearable
|
||||||
</el-form-item>
|
@keyup.enter.native="handleQuery"
|
||||||
<el-form-item>
|
/>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
</el-form-item>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-form-item label="表描述" prop="tableComment">
|
||||||
</el-form-item>
|
<el-input
|
||||||
</el-form>
|
v-model="queryParams.tableComment"
|
||||||
<el-row>
|
placeholder="请输入表描述"
|
||||||
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
|
clearable
|
||||||
<el-table-column type="selection" width="55"></el-table-column>
|
@keyup.enter.native="handleQuery"
|
||||||
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
|
/>
|
||||||
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
|
</el-form-item>
|
||||||
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
<el-form-item>
|
||||||
<el-table-column prop="updateTime" label="更新时间"></el-table-column>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
</el-table>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
<pagination
|
</el-form-item>
|
||||||
v-show="total>0"
|
</el-form>
|
||||||
:total="total"
|
<el-row>
|
||||||
:page.sync="queryParams.pageNum"
|
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
|
||||||
:limit.sync="queryParams.pageSize"
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
@pagination="getList"
|
<el-table-column prop="schemaName" label="库名称" :show-overflow-tooltip="true"></el-table-column>
|
||||||
/>
|
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
|
||||||
</el-row>
|
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<div slot="footer" class="dialog-footer">
|
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
||||||
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
<el-table-column prop="updateTime" label="更新时间"></el-table-column>
|
||||||
<el-button @click="visible = false">取 消</el-button>
|
</el-table>
|
||||||
</div>
|
<pagination
|
||||||
</el-dialog>
|
v-show="total>0"
|
||||||
</template>
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
<script>
|
:limit.sync="queryParams.pageSize"
|
||||||
import { listDbTable, importTable } from "@/api/tool/gen";
|
@pagination="getList"
|
||||||
export default {
|
/>
|
||||||
data() {
|
</el-row>
|
||||||
return {
|
<div slot="footer" class="dialog-footer">
|
||||||
// 遮罩层
|
<el-button type="primary" @click="handleImportTable">确 定</el-button>
|
||||||
visible: false,
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
// 选中数组值
|
</div>
|
||||||
tables: [],
|
</el-dialog>
|
||||||
// 总条数
|
</template>
|
||||||
total: 0,
|
|
||||||
// 表数据
|
<script>
|
||||||
dbTableList: [],
|
import { listSchema, listDbTable, importTable } from "@/api/tool/gen";
|
||||||
// 查询参数
|
export default {
|
||||||
queryParams: {
|
data() {
|
||||||
pageNum: 1,
|
return {
|
||||||
pageSize: 10,
|
// 遮罩层
|
||||||
tableName: undefined,
|
visible: false,
|
||||||
tableComment: undefined
|
// 选中数组值
|
||||||
}
|
tables: [],
|
||||||
};
|
// 总条数
|
||||||
},
|
total: 0,
|
||||||
methods: {
|
// 表数据
|
||||||
// 显示弹框
|
dbTableList: [],
|
||||||
show() {
|
// 数据库列表
|
||||||
this.getList();
|
schemaList: [],
|
||||||
this.visible = true;
|
// 上一次选中数据库的名称,这个名称会在点搜索按钮的时候同步为 queryParams.tableName
|
||||||
},
|
preTableSchema: undefined,
|
||||||
clickRow(row) {
|
// 查询参数
|
||||||
this.$refs.table.toggleRowSelection(row);
|
queryParams: {
|
||||||
},
|
pageNum: 1,
|
||||||
// 多选框选中数据
|
pageSize: 10,
|
||||||
handleSelectionChange(selection) {
|
schemaName: undefined,
|
||||||
this.tables = selection.map(item => item.tableName);
|
tableName: undefined,
|
||||||
},
|
tableComment: undefined
|
||||||
// 查询表数据
|
}
|
||||||
getList() {
|
};
|
||||||
listDbTable(this.queryParams).then(res => {
|
},
|
||||||
if (res.code === 200) {
|
methods: {
|
||||||
this.dbTableList = res.rows;
|
// 显示弹框
|
||||||
this.total = res.total;
|
show() {
|
||||||
}
|
this.getSchemaList();
|
||||||
});
|
this.visible = true;
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
clickRow(row) {
|
||||||
handleQuery() {
|
this.$refs.table.toggleRowSelection(row);
|
||||||
this.queryParams.pageNum = 1;
|
},
|
||||||
this.getList();
|
// 多选框选中数据
|
||||||
},
|
handleSelectionChange(selection) {
|
||||||
/** 重置按钮操作 */
|
this.tables = selection.map(item => item.tableName);
|
||||||
resetQuery() {
|
},
|
||||||
this.resetForm("queryForm");
|
getSchemaList() {
|
||||||
this.handleQuery();
|
// 首先获取数据库信息
|
||||||
},
|
listSchema().then(schemaRes => {
|
||||||
/** 导入按钮操作 */
|
// 至少有一个数据库
|
||||||
handleImportTable() {
|
if (schemaRes.code === 200) {
|
||||||
const tableNames = this.tables.join(",");
|
this.schemaList = schemaRes.data;
|
||||||
if (tableNames == "") {
|
this.queryParams.schemaName = schemaRes.data[0];
|
||||||
this.$modal.msgError("请选择要导入的表");
|
this.getList();
|
||||||
return;
|
}
|
||||||
}
|
})
|
||||||
importTable({ tables: tableNames }).then(res => {
|
},
|
||||||
this.$modal.msgSuccess(res.msg);
|
// 查询表数据
|
||||||
if (res.code === 200) {
|
getList() {
|
||||||
this.visible = false;
|
// 查询之前先要将原有的选中的表空间清空
|
||||||
this.$emit("ok");
|
this.tables = []
|
||||||
}
|
// 同步preSchemaList
|
||||||
});
|
this.preTableSchema = this.queryParams.schemaName
|
||||||
}
|
listDbTable(this.queryParams).then(res => {
|
||||||
}
|
if (res.code === 200) {
|
||||||
};
|
this.dbTableList = res.rows;
|
||||||
</script>
|
this.total = res.total;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 导入按钮操作 */
|
||||||
|
handleImportTable() {
|
||||||
|
const tableNames = this.tables.join(",");
|
||||||
|
if (tableNames == "") {
|
||||||
|
this.$modal.msgError("请选择要导入的表");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
importTable({ tables: tableNames }, this.preTableSchema).then(res => {
|
||||||
|
this.$modal.msgSuccess(res.msg);
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit("ok");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="库名称" prop="schemaName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.schemaName"
|
||||||
|
placeholder="请输入库名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="表名称" prop="tableName">
|
<el-form-item label="表名称" prop="tableName">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.tableName"
|
v-model="queryParams.tableName"
|
||||||
|
|
@ -87,6 +95,13 @@
|
||||||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="库名称"
|
||||||
|
align="center"
|
||||||
|
prop="schemaName"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
width="120"
|
||||||
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="表名称"
|
label="表名称"
|
||||||
align="center"
|
align="center"
|
||||||
|
|
@ -180,6 +195,7 @@ import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/
|
||||||
import importTable from "./importTable";
|
import importTable from "./importTable";
|
||||||
import hljs from "highlight.js/lib/highlight";
|
import hljs from "highlight.js/lib/highlight";
|
||||||
import "highlight.js/styles/github-gist.css";
|
import "highlight.js/styles/github-gist.css";
|
||||||
|
import {MessageBox} from "element-ui";
|
||||||
hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
|
hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
|
||||||
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"));
|
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"));
|
||||||
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));
|
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));
|
||||||
|
|
@ -198,6 +214,8 @@ export default {
|
||||||
uniqueId: "",
|
uniqueId: "",
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
|
// 选中库数组
|
||||||
|
schemaNames: [],
|
||||||
// 选中表数组
|
// 选中表数组
|
||||||
tableNames: [],
|
tableNames: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
|
|
@ -216,6 +234,7 @@ export default {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
schemaName: undefined,
|
||||||
tableName: undefined,
|
tableName: undefined,
|
||||||
tableComment: undefined
|
tableComment: undefined
|
||||||
},
|
},
|
||||||
|
|
@ -257,24 +276,41 @@ export default {
|
||||||
},
|
},
|
||||||
/** 生成代码操作 */
|
/** 生成代码操作 */
|
||||||
handleGenTable(row) {
|
handleGenTable(row) {
|
||||||
|
console.log(schemaName)
|
||||||
|
console.log(this.schemaNames)
|
||||||
const tableNames = row.tableName || this.tableNames;
|
const tableNames = row.tableName || this.tableNames;
|
||||||
if (tableNames == "") {
|
if (tableNames == "") {
|
||||||
this.$modal.msgError("请选择要生成的数据");
|
this.$modal.msgError("请选择要生成的数据");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 获取数据库名字
|
||||||
|
let schemaName = row.schemaName
|
||||||
|
if (schemaName === undefined) {
|
||||||
|
// 居然已经选中生成的表信息了,那么就不会导致 this.schemaNames 为空了
|
||||||
|
schemaName = this.schemaNames[0];
|
||||||
|
for (let i = 1; i < this.schemaNames.length; i++) {
|
||||||
|
if (schemaName != this.schemaNames[i]) {
|
||||||
|
MessageBox.alert("请确保选中的表在同一个数据库当中", {
|
||||||
|
confirmButtonText: '知道了',
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(row.genType === "1") {
|
if(row.genType === "1") {
|
||||||
genCode(row.tableName).then(response => {
|
genCode(schemaName, row.tableName).then(response => {
|
||||||
this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath);
|
this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.$download.zip("/code/gen/batchGenCode?tables=" + tableNames, "ruoyi");
|
this.$download.zip(`/code/gen/batchGenCode/${schemaName}?tables=${tableNames}`, "ruoyi");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/** 同步数据库操作 */
|
/** 同步数据库操作 */
|
||||||
handleSynchDb(row) {
|
handleSynchDb(row) {
|
||||||
const tableName = row.tableName;
|
const tableName = row.tableName;
|
||||||
this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function() {
|
this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function() {
|
||||||
return synchDb(tableName);
|
return synchDb(row.schemaName, tableName);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.$modal.msgSuccess("同步成功");
|
this.$modal.msgSuccess("同步成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
@ -311,6 +347,7 @@ export default {
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.tableId);
|
this.ids = selection.map(item => item.tableId);
|
||||||
|
this.schemaNames = selection.map(item => item.schemaName);
|
||||||
this.tableNames = selection.map(item => item.tableName);
|
this.tableNames = selection.map(item => item.tableName);
|
||||||
this.single = selection.length != 1;
|
this.single = selection.length != 1;
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
|
|
|
||||||
|
|
@ -634,6 +634,7 @@ insert into sys_notice values('2', '维护通知:2018-07-01 若依系统凌晨
|
||||||
drop table if exists gen_table;
|
drop table if exists gen_table;
|
||||||
create table gen_table (
|
create table gen_table (
|
||||||
table_id bigint(20) not null auto_increment comment '编号',
|
table_id bigint(20) not null auto_increment comment '编号',
|
||||||
|
schema_name varchar(200) default '' comment '数据库名称',
|
||||||
table_name varchar(200) default '' comment '表名称',
|
table_name varchar(200) default '' comment '表名称',
|
||||||
table_comment varchar(500) default '' comment '表描述',
|
table_comment varchar(500) default '' comment '表描述',
|
||||||
sub_table_name varchar(64) default null comment '关联子表的表名',
|
sub_table_name varchar(64) default null comment '关联子表的表名',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue