|
@@ -3,6 +3,7 @@ package com.ruoyi.web.controller;
|
|
|
|
|
|
import com.ruoyi.common.annotation.Anonymous;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.domain.entity.DataSource;
|
|
|
import com.zkqy.datamodeling.service.ITableInfoService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -17,48 +18,48 @@ public class TableInfoController {
|
|
|
@Resource
|
|
|
private ITableInfoService tableInfoService;
|
|
|
|
|
|
- @PostMapping("/createDatabase")
|
|
|
- public AjaxResult crateDatabase(@RequestBody Map<String, Object> map) {
|
|
|
- String dataBaseName = (String) map.get("dataBaseName");
|
|
|
- String tableName = (String) map.get("tableName");
|
|
|
- if (tableInfoService.mysqlTableExist(dataBaseName, tableName) > 0) {
|
|
|
- return AjaxResult.warn("当前数据库中表已存在");
|
|
|
- }
|
|
|
- tableInfoService.createMysqlDataBase(map);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/createSqlServerDataBase")
|
|
|
- public AjaxResult createSqlServerDataBase(@RequestBody Map<String, Object> map) throws Exception {
|
|
|
- String dataBaseName = (String) map.get("dataBaseName");
|
|
|
- String tableName = (String) map.get("tableName");
|
|
|
- if (tableInfoService.sqlServerTableExist(dataBaseName, tableName) > 0) {
|
|
|
- return AjaxResult.warn("当前数据库中表已存在");
|
|
|
- }
|
|
|
- tableInfoService.createSqlServerDataBase(map);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/createDmDataBase")
|
|
|
- public AjaxResult createDmDataBase(@RequestBody Map<String, Object> map) {
|
|
|
- String dataBaseName = (String) map.get("dataBaseName");
|
|
|
- String tableName = (String) map.get("tableName");
|
|
|
- if (tableInfoService.dmTableExist(dataBaseName, tableName) > 0) {
|
|
|
- return AjaxResult.warn("当前数据库中表已存在");
|
|
|
- }
|
|
|
- tableInfoService.createDmDataBase(map);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping("/createOracleTable")
|
|
|
- public AjaxResult createOracleTable(@RequestBody Map<String, Object> map) {
|
|
|
- String tableName = (String) map.get("tableName");
|
|
|
- if (tableInfoService.oracleTableExist(tableName) > 0) {
|
|
|
- return AjaxResult.warn("当前数据库中表已存在");
|
|
|
- }
|
|
|
- tableInfoService.createOracleTable(map);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
+// @PostMapping("/createDatabase")
|
|
|
+// public AjaxResult crateDatabase(@RequestBody Map<String, Object> map) {
|
|
|
+// String dataBaseName = (String) map.get("dataBaseName");
|
|
|
+// String tableName = (String) map.get("tableName");
|
|
|
+// if (tableInfoService.mysqlTableExist(dataBaseName, tableName) > 0) {
|
|
|
+// return AjaxResult.warn("当前数据库中表已存在");
|
|
|
+// }
|
|
|
+// tableInfoService.createMysqlDataBase(map);
|
|
|
+// return AjaxResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @PostMapping("/createSqlServerDataBase")
|
|
|
+// public AjaxResult createSqlServerDataBase(@RequestBody Map<String, Object> map) throws Exception {
|
|
|
+// String dataBaseName = (String) map.get("dataBaseName");
|
|
|
+// String tableName = (String) map.get("tableName");
|
|
|
+// if (tableInfoService.sqlServerTableExist(dataBaseName, tableName) > 0) {
|
|
|
+// return AjaxResult.warn("当前数据库中表已存在");
|
|
|
+// }
|
|
|
+// tableInfoService.createSqlServerDataBase(map);
|
|
|
+// return AjaxResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @PostMapping("/createDmDataBase")
|
|
|
+// public AjaxResult createDmDataBase(@RequestBody Map<String, Object> map) {
|
|
|
+// String dataBaseName = (String) map.get("dataBaseName");
|
|
|
+// String tableName = (String) map.get("tableName");
|
|
|
+// if (tableInfoService.dmTableExist(dataBaseName, tableName) > 0) {
|
|
|
+// return AjaxResult.warn("当前数据库中表已存在");
|
|
|
+// }
|
|
|
+// tableInfoService.createDmDataBase(map);
|
|
|
+// return AjaxResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @PostMapping("/createOracleTable")
|
|
|
+// public AjaxResult createOracleTable(@RequestBody Map<String, Object> map) {
|
|
|
+// String tableName = (String) map.get("tableName");
|
|
|
+// if (tableInfoService.oracleTableExist(tableName) > 0) {
|
|
|
+// return AjaxResult.warn("当前数据库中表已存在");
|
|
|
+// }
|
|
|
+// tableInfoService.createOracleTable(map);
|
|
|
+// return AjaxResult.success();
|
|
|
+// }
|
|
|
|
|
|
//---------------------------------------通用接口(支持mysql、sqlserver、达梦)-----------------------------------------------------
|
|
|
|
|
@@ -105,42 +106,51 @@ public class TableInfoController {
|
|
|
//---------------------------------------通用接口-----------------------------------------------------
|
|
|
|
|
|
|
|
|
- @PutMapping("/editMysqlTable")
|
|
|
- public AjaxResult editMysqlTable(@RequestBody Map<String, Object> map) {
|
|
|
- String tableName = (String) map.get("tableName");
|
|
|
- if (tableInfoService.selectDataCount(tableName) > 0) {
|
|
|
- return AjaxResult.warn("表中有数据,不能修改!");
|
|
|
- }
|
|
|
- tableInfoService.updateMysqlTable(map);
|
|
|
- return AjaxResult.success();
|
|
|
-
|
|
|
- }
|
|
|
+// @PutMapping("/editMysqlTable")
|
|
|
+// public AjaxResult editMysqlTable(@RequestBody Map<String, Object> map) {
|
|
|
+// String tableName = (String) map.get("tableName");
|
|
|
+// if (tableInfoService.selectDataCount(tableName) > 0) {
|
|
|
+// return AjaxResult.warn("表中有数据,不能修改!");
|
|
|
+// }
|
|
|
+// tableInfoService.updateMysqlTable(map);
|
|
|
+// return AjaxResult.success();
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 删除sqlserver数据表
|
|
|
+// */
|
|
|
+// @DeleteMapping("/dropServerTable/{tableName}")
|
|
|
+// public AjaxResult dropServerTable(@PathVariable String tableName) {
|
|
|
+// if (tableInfoService.selectSqlServerDataCount(tableName) > 0) {
|
|
|
+// return AjaxResult.warn("表中有数据,不能删除!");
|
|
|
+// }
|
|
|
+// tableInfoService.dropSqlserverTable(tableName);
|
|
|
+// return AjaxResult.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 修改sqlserver数据表
|
|
|
+// */
|
|
|
+// @PutMapping("/editSqlserverTable")
|
|
|
+// public AjaxResult editSqlserverTable(@RequestBody Map<String, Object> map) {
|
|
|
+// String tableName = (String) map.get("tableName");
|
|
|
+// if (tableInfoService.selectSqlServerDataCount(tableName) > 0) {
|
|
|
+// return AjaxResult.warn("表中有数据,不能修改!");
|
|
|
+// }
|
|
|
+// tableInfoService.updateSqlserverTable(map);
|
|
|
+// return AjaxResult.success();
|
|
|
+// }
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 删除sqlserver数据表
|
|
|
+ * 初始化数据库,基础表
|
|
|
*/
|
|
|
- @DeleteMapping("/dropServerTable/{tableName}")
|
|
|
- public AjaxResult dropServerTable(@PathVariable String tableName) {
|
|
|
- if (tableInfoService.selectSqlServerDataCount(tableName) > 0) {
|
|
|
- return AjaxResult.warn("表中有数据,不能删除!");
|
|
|
- }
|
|
|
- tableInfoService.dropSqlserverTable(tableName);
|
|
|
- return AjaxResult.success();
|
|
|
- }
|
|
|
+ @PostMapping("/initDatabase")
|
|
|
+ public AjaxResult initDatabase(@RequestBody DataSource dataSource){
|
|
|
+
|
|
|
|
|
|
- /**
|
|
|
- * 修改sqlserver数据表
|
|
|
- */
|
|
|
- @PutMapping("/editSqlserverTable")
|
|
|
- public AjaxResult editSqlserverTable(@RequestBody Map<String, Object> map) {
|
|
|
- String tableName = (String) map.get("tableName");
|
|
|
- if (tableInfoService.selectSqlServerDataCount(tableName) > 0) {
|
|
|
- return AjaxResult.warn("表中有数据,不能修改!");
|
|
|
- }
|
|
|
- tableInfoService.updateSqlserverTable(map);
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|