Compare commits
No commits in common. "8ddd6a86092e81b098d463fd32637a4e493f02ab" and "76070d738d4bd4c22caf5971f4c3b4f6c60ac42a" have entirely different histories.
8ddd6a8609
...
76070d738d
|
@ -19,11 +19,6 @@ import java.util.List;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AssetStructure{
|
public class AssetStructure{
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息id
|
|
||||||
*/
|
|
||||||
private Integer id;
|
|
||||||
/** 接入源名称 */
|
/** 接入源名称 */
|
||||||
private String accessSourceName;
|
private String accessSourceName;
|
||||||
|
|
||||||
|
@ -45,9 +40,10 @@ public class AssetStructure{
|
||||||
/**是否核心*/
|
/**是否核心*/
|
||||||
private String coreOrNot;
|
private String coreOrNot;
|
||||||
|
|
||||||
/**
|
/**表注释*/
|
||||||
* 类型
|
private String tableComment;
|
||||||
*/
|
|
||||||
|
/**类型*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package com.muyu.data.source.domain;
|
package com.muyu.data.source.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -19,11 +15,9 @@ import lombok.NoArgsConstructor;
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@TableName(value = "database_table_information")
|
|
||||||
public class DatabaseTableInformation {
|
public class DatabaseTableInformation {
|
||||||
|
|
||||||
/**数据库信息id*/
|
/**数据库信息id*/
|
||||||
@TableId(value = "id",type = IdType.AUTO)
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**数据库表名*/
|
/**数据库表名*/
|
||||||
|
@ -46,16 +40,4 @@ public class DatabaseTableInformation {
|
||||||
|
|
||||||
/**类型*/
|
/**类型*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
/**
|
|
||||||
* ID
|
|
||||||
*/
|
|
||||||
private Integer structureId;
|
|
||||||
|
|
||||||
public DatabaseTableInformation databaseTableInformation (String tableName, String tableComment, int tableRows) {
|
|
||||||
return DatabaseTableInformation.builder()
|
|
||||||
.name(tableName)
|
|
||||||
.as(tableComment)
|
|
||||||
.dataTotal(tableRows)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
package com.muyu.data.source.domain.req;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 接参
|
|
||||||
*
|
|
||||||
* @ClassName DatabaseConnect
|
|
||||||
* @Author AnNan.Wang
|
|
||||||
* @Date 2024/4/25 21:14
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class DatabaseConnect {
|
|
||||||
/**
|
|
||||||
* 用户名
|
|
||||||
*/
|
|
||||||
private String username;
|
|
||||||
/**
|
|
||||||
* 密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
/**
|
|
||||||
* 主机地址
|
|
||||||
*/
|
|
||||||
private String host;
|
|
||||||
/**
|
|
||||||
* 类型
|
|
||||||
*/
|
|
||||||
private String type;
|
|
||||||
/**
|
|
||||||
* 数据库名称
|
|
||||||
*/
|
|
||||||
private String databaseName;
|
|
||||||
/**
|
|
||||||
* 端口
|
|
||||||
*/
|
|
||||||
private String port;
|
|
||||||
|
|
||||||
}
|
|
|
@ -6,10 +6,16 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import com.muyu.data.source.domain.*;
|
import com.muyu.data.source.domain.*;
|
||||||
import com.muyu.data.source.domain.model.DataBaseModel;
|
import com.muyu.data.source.domain.model.DataBaseModel;
|
||||||
import com.muyu.data.source.domain.model.DatabaseTableModel;
|
import com.muyu.data.source.domain.model.DatabaseTableModel;
|
||||||
import com.muyu.data.source.domain.req.DatabaseConnect;
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
@ -127,22 +133,20 @@ public class DataSourceController extends BaseController {
|
||||||
return dataSourceService.synchronization(dataSource);
|
return dataSourceService.synchronization(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询结构
|
@GetMapping("/findDataBaseTable")
|
||||||
@PostMapping("/findDataBaseTable")
|
public Result<List<DatabaseTableModel>> findDataBaseTable(){
|
||||||
public Result<List<DatabaseTableModel>> findDataBaseTable(@RequestParam("databaseTableName") String databaseTableName){
|
return dataSourceService.findDataBaseTable();
|
||||||
return dataSourceService.findDataBaseTable(databaseTableName);
|
}
|
||||||
|
|
||||||
|
@GetMapping("/findAssetStructure")
|
||||||
|
public Result<List<AssetStructure>> findAssetStructure(){
|
||||||
|
return dataSourceService.findAssetStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//查询接入源信息
|
|
||||||
@GetMapping("/findStructure")
|
@GetMapping("/findStructure")
|
||||||
public Result<Structure> findStructure(){
|
public Result<Structure> findStructure(){
|
||||||
return dataSourceService.findStructure();
|
return dataSourceService.findStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
//点击查询表
|
|
||||||
@PostMapping("/structureList")
|
|
||||||
public Result<Structure> structureList(@RequestParam("id") Integer id){
|
|
||||||
return dataSourceService.structureList(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,20 +24,17 @@ public interface DataSourceMapper extends BaseMapper<DataSource> {
|
||||||
|
|
||||||
void addAssets1(AssetStructure assetStructure);
|
void addAssets1(AssetStructure assetStructure);
|
||||||
|
|
||||||
|
List<AssetStructure> assetStructureList();
|
||||||
|
|
||||||
DatabaseTableModel findByName(@Param("databaseName") String databaseName, @Param("databaseTableName") String databaseTableName);
|
DatabaseTableModel findByName(@Param("databaseName") String databaseName, @Param("databaseTableName") String databaseTableName);
|
||||||
|
|
||||||
List<DatabaseTableInformation> findByBaseName(@Param("databaseName") String databaseName);
|
List<DatabaseTableInformation> findByBaseName(@Param("databaseName") String databaseName);
|
||||||
|
|
||||||
void addDatabaseTableInformation(@Param("databaseTableInformationList") List<DatabaseTableInformation> databaseTableInformationList, @Param("id") Integer id);
|
void addDatabaseTableInformation(@Param("databaseTableInformationList") List<DatabaseTableInformation> databaseTableInformationList);
|
||||||
|
|
||||||
void addDatabaseTableInfo(@Param("databaseTableInformations") ArrayList<DatabaseTableInformation> databaseTableInformations);
|
void addDatabaseTableInfo(@Param("databaseTableInformations") ArrayList<DatabaseTableInformation> databaseTableInformations);
|
||||||
|
|
||||||
List<AssetStructure> findAssetStructure();
|
List<AssetStructure> findAssetStructure();
|
||||||
|
|
||||||
List<DatabaseTableInformation> findInformation(Integer id);
|
List<DatabaseTableInformation> findInformation();
|
||||||
|
|
||||||
List<AssetStructure> assetStructureList();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,9 @@ public interface DataSourceService extends IService<DataSource> {
|
||||||
|
|
||||||
Result synchronization(DataSource dataSource);
|
Result synchronization(DataSource dataSource);
|
||||||
|
|
||||||
Result<List<DatabaseTableModel>> findDataBaseTable(String databaseTableName);
|
Result<List<DatabaseTableModel>> findDataBaseTable();
|
||||||
|
|
||||||
|
Result<List<AssetStructure>> findAssetStructure();
|
||||||
|
|
||||||
Result<Structure> findStructure();
|
Result<Structure> findStructure();
|
||||||
|
|
||||||
Result<Structure> structureList(Integer id);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,12 @@ package com.muyu.data.source.service.impl;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.ObjUtils;
|
import com.muyu.common.core.utils.ObjUtils;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.data.source.domain.*;
|
import com.muyu.data.source.domain.*;
|
||||||
import com.muyu.data.source.domain.model.DatabaseTableModel;
|
import com.muyu.data.source.domain.model.DatabaseTableModel;
|
||||||
import com.muyu.data.source.domain.req.DataSourceSaveReq;
|
import com.muyu.data.source.domain.req.DataSourceSaveReq;
|
||||||
|
@ -28,6 +30,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSource> implements DataSourceService {
|
public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSource> implements DataSourceService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataSourceMapper dataSourceMapper;
|
private DataSourceMapper dataSourceMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据源列表
|
* 查询数据源列表
|
||||||
*
|
*
|
||||||
|
@ -116,79 +119,27 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result synchronization(DataSource dataSource) {
|
public Result synchronization(DataSource dataSource) {
|
||||||
|
|
||||||
AssetStructure assetStructure = new AssetStructure();
|
AssetStructure assetStructure = new AssetStructure();
|
||||||
|
|
||||||
|
ArrayList<String> tableNames = new ArrayList<>();
|
||||||
|
List<DatabaseTableInformation> databaseTableInformationList=dataSourceMapper.findByBaseName(dataSource.getDatabaseName());
|
||||||
|
dataSourceMapper.addDatabaseTableInformation(databaseTableInformationList);
|
||||||
|
List<AssetStructure> list = new ArrayList<>();
|
||||||
|
|
||||||
String user=dataSource.getDatabaseUserName();
|
String user=dataSource.getDatabaseUserName();
|
||||||
String password=dataSource.getDatabaseUserPassword();
|
String password=dataSource.getDatabaseUserPassword();
|
||||||
String jdbcDriver="com.mysql.cj.jdbc.Driver";
|
String jdbcDriver="com.mysql.cj.jdbc.Driver";
|
||||||
String url = "jdbc:mysql://" + dataSource.getHostAddress() + ":" + dataSource.getHostPort() + "/" + dataSource.getDatabaseName();
|
String url = "jdbc:mysql://" + dataSource.getHostAddress() + ":" + dataSource.getHostPort() + "/" + dataSource.getDatabaseName();
|
||||||
String query="show tables ";
|
String query="show tables ";
|
||||||
|
try(Connection con=DriverManager.getConnection(url,user,password);
|
||||||
ArrayList<DatabaseTableInformation> arrayList = new ArrayList<>();
|
Statement stmt=con.createStatement();
|
||||||
|
ResultSet rs= stmt.executeQuery(query)) {
|
||||||
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
ResultSetMetaData rsmd = rs.getMetaData();
|
||||||
// 创建 PreparedStatement,并设置参数
|
|
||||||
PreparedStatement prepared = con.prepareStatement("SELECT " +
|
|
||||||
" TABLE_NAME AS `name`, " +
|
|
||||||
" TABLE_COMMENT AS `as`, " +
|
|
||||||
" TABLE_ROWS AS `dataTotal` " +
|
|
||||||
" FROM INFORMATION_SCHEMA.TABLES " +
|
|
||||||
" WHERE TABLE_SCHEMA = ?");
|
|
||||||
prepared.setString(1, dataSource.getDatabaseName()); // 设置数据库名称参数
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 执行查询
|
|
||||||
ResultSet resultSet = prepared.executeQuery();
|
|
||||||
|
|
||||||
ResultSetMetaData rsmd = resultSet.getMetaData();
|
|
||||||
// 5. 处理查询结果
|
// 5. 处理查询结果
|
||||||
while (resultSet.next()) {
|
while (rs.next()) {
|
||||||
//表名
|
String tableName = rs.getString(1);
|
||||||
String tableName = resultSet.getString("name");
|
tableNames.add(tableName);
|
||||||
//表备注
|
|
||||||
String tableComment = resultSet.getString("as");
|
|
||||||
//表条数
|
|
||||||
int tableRows = resultSet.getInt("dataTotal");
|
|
||||||
//查询出表结构
|
|
||||||
PreparedStatement preparedStatement = con.prepareStatement(" SELECT " +
|
|
||||||
" TABLE_NAME AS 'tableName', " +
|
|
||||||
" COLUMN_NAME AS 'name', " +
|
|
||||||
" COLUMN_COMMENT AS 'comment', " +
|
|
||||||
" CASE WHEN COLUMN_KEY = 'PRI' THEN '是' ELSE '否' END AS 'isPrimaryKey', " +
|
|
||||||
" CASE " +
|
|
||||||
" WHEN DATA_TYPE = 'int' THEN 'Integer' " +
|
|
||||||
" WHEN DATA_TYPE = 'varchar' THEN 'String' " +
|
|
||||||
" WHEN DATA_TYPE = 'decimal' THEN 'BigDecimal' " +
|
|
||||||
" WHEN DATA_TYPE = 'tinyint' AND COLUMN_TYPE = 'tinyint(1)' THEN 'Boolean' " +
|
|
||||||
" ELSE DATA_TYPE " +
|
|
||||||
" END AS 'type', " +
|
|
||||||
" DATA_TYPE AS 'mappingType', " +
|
|
||||||
" COLUMN_TYPE AS 'detailType', " +
|
|
||||||
" CHARACTER_MAXIMUM_LENGTH AS 'length', " +
|
|
||||||
" NUMERIC_SCALE AS 'decimalPlaces', " +
|
|
||||||
" IS_NULLABLE AS 'isNull', " +
|
|
||||||
" COLUMN_DEFAULT AS 'defaultValue' " +
|
|
||||||
"FROM " +
|
|
||||||
" INFORMATION_SCHEMA.COLUMNS " +
|
|
||||||
"WHERE " +
|
|
||||||
" TABLE_SCHEMA = ? " +
|
|
||||||
" AND TABLE_NAME = ?");
|
|
||||||
|
|
||||||
preparedStatement.setString(1,dataSource.getDatabaseName());
|
|
||||||
preparedStatement.setString(2,tableName);
|
|
||||||
ResultSet executed = preparedStatement.executeQuery();
|
|
||||||
ResultSetMetaData metaData = executed.getMetaData();
|
|
||||||
|
|
||||||
|
|
||||||
// 创建 DatabaseTableInformation对象
|
|
||||||
DatabaseTableInformation build = DatabaseTableInformation.builder()
|
|
||||||
.name(tableName)
|
|
||||||
.as(tableComment)
|
|
||||||
.dataTotal(tableRows)
|
|
||||||
.build();
|
|
||||||
// 将对象添加到 ArrayList 中
|
|
||||||
arrayList.add(build);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assetStructure.setAccessSourceName(dataSource.getAccessSourceName());
|
assetStructure.setAccessSourceName(dataSource.getAccessSourceName());
|
||||||
|
@ -197,19 +148,11 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
|
|
||||||
assetStructure.setDatabaseTableName(rsmd.getTableName(1));
|
assetStructure.setDatabaseTableName(rsmd.getTableName(1));
|
||||||
|
|
||||||
assetStructure.setDataVolume(arrayList.size());
|
assetStructure.setDataVolume(rsmd.getColumnDisplaySize(1));
|
||||||
Integer num = 0;
|
assetStructure.setDataQuantity(rsmd.getColumnDisplaySize(1));
|
||||||
for (DatabaseTableInformation databaseTableInformation : arrayList) {
|
|
||||||
num+=databaseTableInformation.getDataTotal();
|
|
||||||
}
|
|
||||||
System.out.println(num);
|
|
||||||
assetStructure.setDataQuantity(num);
|
|
||||||
|
|
||||||
dataSourceMapper.addAssets1(assetStructure);
|
dataSourceMapper.addAssets1(assetStructure);
|
||||||
|
|
||||||
Integer id = assetStructure.getId();
|
|
||||||
|
|
||||||
dataSourceMapper.addDatabaseTableInformation(arrayList,id);
|
|
||||||
return Result.success("同步成功");
|
return Result.success("同步成功");
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
@ -220,36 +163,33 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<List<DatabaseTableModel>> findDataBaseTable(String databaseTableName) {
|
public Result<List<DatabaseTableModel>> findDataBaseTable() {
|
||||||
List<AssetStructure> assetStructureList=dataSourceMapper.assetStructureList();
|
List<AssetStructure> assetStructureList=dataSourceMapper.assetStructureList();
|
||||||
List<DatabaseTableModel> databaseTableList = new ArrayList<>();
|
List<DatabaseTableModel> databaseTableList = new ArrayList<>();
|
||||||
for (AssetStructure assetStructure : assetStructureList) {
|
for (AssetStructure assetStructure : assetStructureList) {
|
||||||
DatabaseTableModel databaseTableModel=dataSourceMapper.findByName(assetStructure.getDatabaseName(),databaseTableName);
|
DatabaseTableModel databaseTableModel=dataSourceMapper.findByName(assetStructure.getDatabaseName(),assetStructure.getDatabaseTableName());
|
||||||
|
System.out.println(databaseTableModel);
|
||||||
databaseTableList.add(databaseTableModel);
|
databaseTableList.add(databaseTableModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(databaseTableList);
|
|
||||||
|
|
||||||
return Result.success(databaseTableList);
|
return Result.success(databaseTableList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<AssetStructure>> findAssetStructure() {
|
||||||
|
List<AssetStructure> assetStructureList=dataSourceMapper.assetStructureList();
|
||||||
|
return Result.success(assetStructureList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<Structure> findStructure() {
|
public Result<Structure> findStructure() {
|
||||||
Structure structure = new Structure();
|
Structure structure = new Structure();
|
||||||
List<AssetStructure> assetStructure = dataSourceMapper.findAssetStructure();
|
List<AssetStructure> assetStructure = dataSourceMapper.findAssetStructure();
|
||||||
structure.setAssetStructureList(assetStructure);
|
structure.setAssetStructureList(assetStructure);
|
||||||
|
List<DatabaseTableInformation> databaseTableInformationList=dataSourceMapper.findInformation();
|
||||||
|
structure.setDatabaseTableInformationList(databaseTableInformationList);
|
||||||
return Result.success(structure);
|
return Result.success(structure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<Structure> structureList(Integer id) {
|
|
||||||
List<DatabaseTableInformation> information = dataSourceMapper.findInformation(id);
|
|
||||||
Structure structure = new Structure();
|
|
||||||
structure.setDatabaseTableInformationList(information);
|
|
||||||
return Result.success(structure);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="addAssets1" useGeneratedKeys="true" keyProperty="id">
|
<insert id="addAssets1">
|
||||||
INSERT INTO `data_management`.`asset_structure`
|
INSERT INTO `data_management`.`asset_structure`
|
||||||
(`access_source_name`, `data_source_system_name`, `database_name`, `data_volume`, `data_quantity`, `core_or_not`)
|
(`access_source_name`, `data_source_system_name`, `database_name`, `data_volume`, `data_quantity`, `core_or_not`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -65,14 +65,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="addDatabaseTableInformation">
|
<insert id="addDatabaseTableInformation">
|
||||||
INSERT INTO `data_management`.`database_table_information`
|
INSERT INTO `data_management`.`database_table_information`
|
||||||
( `name`, `as`, `dataTotal`,`structure_id`)
|
( `name`, `as`, `dataTotal`)
|
||||||
VALUES
|
VALUES
|
||||||
<foreach collection="databaseTableInformationList" item="databaseTableInformationList" separator=",">
|
<foreach collection="databaseTableInformationList" item="databaseTableInformationList" separator=",">
|
||||||
(
|
(
|
||||||
#{databaseTableInformationList.name},
|
#{databaseTableInformationList.name},
|
||||||
#{databaseTableInformationList.as},
|
#{databaseTableInformationList.as},
|
||||||
#{databaseTableInformationList.dataTotal},
|
#{databaseTableInformationList.dataTotal}
|
||||||
#{id}
|
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
||||||
|
@ -95,7 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="findAccessType" resultType="com.muyu.data.source.domain.AccessType">
|
<select id="findAccessType" resultType="com.muyu.data.source.domain.AccessType">
|
||||||
select * from access_type
|
select * from access_type
|
||||||
</select>
|
</select>
|
||||||
|
<select id="assetStructureList" resultType="com.muyu.data.source.domain.AssetStructure">
|
||||||
|
select * from asset_structure
|
||||||
|
</select>
|
||||||
<select id="findByName" resultType="com.muyu.data.source.domain.model.DatabaseTableModel">
|
<select id="findByName" resultType="com.muyu.data.source.domain.model.DatabaseTableModel">
|
||||||
SELECT
|
SELECT
|
||||||
TABLE_NAME AS 'tableName',
|
TABLE_NAME AS 'tableName',
|
||||||
|
@ -125,21 +126,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
<select id="findByBaseName" resultType="com.muyu.data.source.domain.DatabaseTableInformation">
|
<select id="findByBaseName" resultType="com.muyu.data.source.domain.DatabaseTableInformation">
|
||||||
SELECT
|
SELECT
|
||||||
TABLE_NAME AS `name`,
|
TABLE_NAME as 'name',
|
||||||
TABLE_COMMENT AS `as`,
|
TABLE_COMMENT as 'as',
|
||||||
TABLE_ROWS AS `dataTotal`
|
TABLE_ROWS as 'dataTotal'
|
||||||
FROM INFORMATION_SCHEMA.TABLES
|
FROM INFORMATION_SCHEMA.TABLES
|
||||||
WHERE
|
WHERE
|
||||||
TABLE_SCHEMA = ${databaseName}
|
TABLE_SCHEMA = #{databaseName}
|
||||||
</select>
|
</select>
|
||||||
<select id="findAssetStructure" resultType="com.muyu.data.source.domain.AssetStructure">
|
<select id="findAssetStructure" resultType="com.muyu.data.source.domain.AssetStructure">
|
||||||
select * from asset_structure
|
select * from asset_structure
|
||||||
</select>
|
</select>
|
||||||
<select id="findInformation" resultType="com.muyu.data.source.domain.DatabaseTableInformation">
|
<select id="findInformation" resultType="com.muyu.data.source.domain.DatabaseTableInformation">
|
||||||
select * from database_table_information where structure_id=#{id}
|
select * from database_table_information
|
||||||
</select>
|
|
||||||
<select id="assetStructureList" resultType="com.muyu.data.source.domain.AssetStructure">
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue