commit
92579b93a3
|
@ -19,6 +19,11 @@ import java.util.List;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AssetStructure{
|
public class AssetStructure{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
/** 接入源名称 */
|
/** 接入源名称 */
|
||||||
private String accessSourceName;
|
private String accessSourceName;
|
||||||
|
|
||||||
|
@ -40,10 +45,9 @@ public class AssetStructure{
|
||||||
/**是否核心*/
|
/**是否核心*/
|
||||||
private String coreOrNot;
|
private String coreOrNot;
|
||||||
|
|
||||||
/**表注释*/
|
/**
|
||||||
private String tableComment;
|
* 类型
|
||||||
|
*/
|
||||||
/**类型*/
|
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
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;
|
||||||
|
@ -15,9 +19,11 @@ 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;
|
||||||
|
|
||||||
/**数据库表名*/
|
/**数据库表名*/
|
||||||
|
@ -40,4 +46,16 @@ 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
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,16 +6,10 @@ 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.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
||||||
|
@ -133,20 +127,22 @@ public class DataSourceController extends BaseController {
|
||||||
return dataSourceService.synchronization(dataSource);
|
return dataSourceService.synchronization(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/findDataBaseTable")
|
//查询结构
|
||||||
public Result<List<DatabaseTableModel>> findDataBaseTable(){
|
@PostMapping("/findDataBaseTable")
|
||||||
return dataSourceService.findDataBaseTable();
|
public Result<List<DatabaseTableModel>> findDataBaseTable(@RequestParam("databaseTableName") String databaseTableName){
|
||||||
}
|
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,17 +24,20 @@ 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);
|
void addDatabaseTableInformation(@Param("databaseTableInformationList") List<DatabaseTableInformation> databaseTableInformationList, @Param("id") Integer id);
|
||||||
|
|
||||||
void addDatabaseTableInfo(@Param("databaseTableInformations") ArrayList<DatabaseTableInformation> databaseTableInformations);
|
void addDatabaseTableInfo(@Param("databaseTableInformations") ArrayList<DatabaseTableInformation> databaseTableInformations);
|
||||||
|
|
||||||
List<AssetStructure> findAssetStructure();
|
List<AssetStructure> findAssetStructure();
|
||||||
|
|
||||||
List<DatabaseTableInformation> findInformation();
|
List<DatabaseTableInformation> findInformation(Integer id);
|
||||||
|
|
||||||
|
List<AssetStructure> assetStructureList();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,10 @@ public interface DataSourceService extends IService<DataSource> {
|
||||||
|
|
||||||
Result synchronization(DataSource dataSource);
|
Result synchronization(DataSource dataSource);
|
||||||
|
|
||||||
Result<List<DatabaseTableModel>> findDataBaseTable();
|
Result<List<DatabaseTableModel>> findDataBaseTable(String databaseTableName);
|
||||||
|
|
||||||
Result<List<AssetStructure>> findAssetStructure();
|
|
||||||
|
|
||||||
Result<Structure> findStructure();
|
Result<Structure> findStructure();
|
||||||
|
|
||||||
|
Result<Structure> structureList(Integer id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,10 @@ 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;
|
||||||
|
@ -30,7 +28,6 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询数据源列表
|
* 查询数据源列表
|
||||||
*
|
*
|
||||||
|
@ -119,27 +116,79 @@ 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);
|
|
||||||
Statement stmt=con.createStatement();
|
ArrayList<DatabaseTableInformation> arrayList = new ArrayList<>();
|
||||||
ResultSet rs= stmt.executeQuery(query)) {
|
|
||||||
ResultSetMetaData rsmd = rs.getMetaData();
|
try (Connection con = DriverManager.getConnection(url, user, password)) {
|
||||||
|
// 创建 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 (rs.next()) {
|
while (resultSet.next()) {
|
||||||
String tableName = rs.getString(1);
|
//表名
|
||||||
tableNames.add(tableName);
|
String tableName = resultSet.getString("name");
|
||||||
|
//表备注
|
||||||
|
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());
|
||||||
|
@ -148,11 +197,19 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
|
|
||||||
assetStructure.setDatabaseTableName(rsmd.getTableName(1));
|
assetStructure.setDatabaseTableName(rsmd.getTableName(1));
|
||||||
|
|
||||||
assetStructure.setDataVolume(rsmd.getColumnDisplaySize(1));
|
assetStructure.setDataVolume(arrayList.size());
|
||||||
assetStructure.setDataQuantity(rsmd.getColumnDisplaySize(1));
|
Integer num = 0;
|
||||||
|
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) {
|
||||||
|
@ -163,33 +220,36 @@ public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSou
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<List<DatabaseTableModel>> findDataBaseTable() {
|
public Result<List<DatabaseTableModel>> findDataBaseTable(String databaseTableName) {
|
||||||
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(),assetStructure.getDatabaseTableName());
|
DatabaseTableModel databaseTableModel=dataSourceMapper.findByName(assetStructure.getDatabaseName(),databaseTableName);
|
||||||
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">
|
<insert id="addAssets1" useGeneratedKeys="true" keyProperty="id">
|
||||||
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,13 +65,14 @@ 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`)
|
( `name`, `as`, `dataTotal`,`structure_id`)
|
||||||
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>
|
||||||
|
|
||||||
|
@ -94,9 +95,7 @@ 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',
|
||||||
|
@ -126,18 +125,21 @@ 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
|
select * from database_table_information where structure_id=#{id}
|
||||||
|
</select>
|
||||||
|
<select id="assetStructureList" resultType="com.muyu.data.source.domain.AssetStructure">
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue