数据库表信息状态展示
This commit is contained in:
@@ -19,6 +19,7 @@ import com.zyplayer.doc.data.utils.CacheUtil;
|
|||||||
import com.zyplayer.doc.db.controller.vo.DatabaseExportVo;
|
import com.zyplayer.doc.db.controller.vo.DatabaseExportVo;
|
||||||
import com.zyplayer.doc.db.controller.vo.TableColumnVo;
|
import com.zyplayer.doc.db.controller.vo.TableColumnVo;
|
||||||
import com.zyplayer.doc.db.controller.vo.TableColumnVo.TableInfoVo;
|
import com.zyplayer.doc.db.controller.vo.TableColumnVo.TableInfoVo;
|
||||||
|
import com.zyplayer.doc.db.controller.vo.TableStatusVo;
|
||||||
import com.zyplayer.doc.db.framework.consts.DbAuthType;
|
import com.zyplayer.doc.db.framework.consts.DbAuthType;
|
||||||
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean;
|
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean;
|
||||||
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean.DatabaseProduct;
|
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean.DatabaseProduct;
|
||||||
@@ -158,6 +159,13 @@ public class DatabaseDocController {
|
|||||||
return DocDbResponseJson.ok(dbNameDtoList);
|
return DocDbResponseJson.ok(dbNameDtoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/getTableStatus")
|
||||||
|
public ResponseJson getTableStatus(Long sourceId, String dbName, String tableName) {
|
||||||
|
BaseMapper baseMapper = this.getViewAuthBaseMapper(sourceId);
|
||||||
|
TableStatusVo tableStatusVo = baseMapper.getTableStatus(dbName, tableName);
|
||||||
|
return DocDbResponseJson.ok(tableStatusVo);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping(value = "/getTableList")
|
@PostMapping(value = "/getTableList")
|
||||||
public ResponseJson getTableList(Long sourceId, String dbName) {
|
public ResponseJson getTableList(Long sourceId, String dbName) {
|
||||||
BaseMapper baseMapper = this.getBaseMapper(sourceId);
|
BaseMapper baseMapper = this.getBaseMapper(sourceId);
|
||||||
|
|||||||
@@ -0,0 +1,168 @@
|
|||||||
|
package com.zyplayer.doc.db.controller.vo;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class TableStatusVo {
|
||||||
|
private String name;
|
||||||
|
private String engine;
|
||||||
|
private Long version;
|
||||||
|
private String rowFormat;
|
||||||
|
private Long rows;
|
||||||
|
private Long avgRowLength;
|
||||||
|
private Long dataLength;
|
||||||
|
private Long maxDataLength;
|
||||||
|
private Long indexLength;
|
||||||
|
private Long dataFree;
|
||||||
|
private Long autoIncrement;
|
||||||
|
private Date createTime;
|
||||||
|
private Date updateTime;
|
||||||
|
private Date checkTime;
|
||||||
|
private String collation;
|
||||||
|
private String checksum;
|
||||||
|
private String createOptions;
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEngine() {
|
||||||
|
return engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEngine(String engine) {
|
||||||
|
this.engine = engine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(Long version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRowFormat() {
|
||||||
|
return rowFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowFormat(String rowFormat) {
|
||||||
|
this.rowFormat = rowFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRows() {
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRows(Long rows) {
|
||||||
|
this.rows = rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAvgRowLength() {
|
||||||
|
return avgRowLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvgRowLength(Long avgRowLength) {
|
||||||
|
this.avgRowLength = avgRowLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDataLength() {
|
||||||
|
return dataLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataLength(Long dataLength) {
|
||||||
|
this.dataLength = dataLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMaxDataLength() {
|
||||||
|
return maxDataLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxDataLength(Long maxDataLength) {
|
||||||
|
this.maxDataLength = maxDataLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getIndexLength() {
|
||||||
|
return indexLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexLength(Long indexLength) {
|
||||||
|
this.indexLength = indexLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDataFree() {
|
||||||
|
return dataFree;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataFree(Long dataFree) {
|
||||||
|
this.dataFree = dataFree;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getAutoIncrement() {
|
||||||
|
return autoIncrement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoIncrement(Long autoIncrement) {
|
||||||
|
this.autoIncrement = autoIncrement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCheckTime() {
|
||||||
|
return checkTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCheckTime(Date checkTime) {
|
||||||
|
this.checkTime = checkTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCollation() {
|
||||||
|
return collation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollation(String collation) {
|
||||||
|
this.collation = collation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChecksum() {
|
||||||
|
return checksum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChecksum(String checksum) {
|
||||||
|
this.checksum = checksum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreateOptions() {
|
||||||
|
return createOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateOptions(String createOptions) {
|
||||||
|
this.createOptions = createOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComment(String comment) {
|
||||||
|
this.comment = comment;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zyplayer.doc.db.framework.db.mapper.base;
|
package com.zyplayer.doc.db.framework.db.mapper.base;
|
||||||
|
|
||||||
|
import com.zyplayer.doc.db.controller.vo.TableStatusVo;
|
||||||
import com.zyplayer.doc.db.framework.db.dto.*;
|
import com.zyplayer.doc.db.framework.db.dto.*;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -90,5 +91,14 @@ public interface BaseMapper {
|
|||||||
void updateTableColumnDesc(@Param("dbName") String dbName, @Param("tableName") String tableName,
|
void updateTableColumnDesc(@Param("dbName") String dbName, @Param("tableName") String tableName,
|
||||||
@Param("columnName") String columnName, @Param("newDesc") String newDesc,
|
@Param("columnName") String columnName, @Param("newDesc") String newDesc,
|
||||||
@Param("columnInfo") ColumnInfoDto columnInfo);
|
@Param("columnInfo") ColumnInfoDto columnInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取表基本信息
|
||||||
|
*
|
||||||
|
* @author 暮光:城中城
|
||||||
|
* @since 2019年9月1日
|
||||||
|
* @param dbName 数据库名
|
||||||
|
* @param tableName 表名
|
||||||
|
*/
|
||||||
|
TableStatusVo getTableStatus(@Param("dbName") String dbName, @Param("tableName") String tableName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,27 @@
|
|||||||
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />
|
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="TableStatusDtoMap" type="com.zyplayer.doc.db.controller.vo.TableStatusVo">
|
||||||
|
<result column="Name" property="name"/>
|
||||||
|
<result column="Engine" property="engine"/>
|
||||||
|
<result column="Version" property="version"/>
|
||||||
|
<result column="Row_format" property="rowFormat"/>
|
||||||
|
<result column="Rows" property="rows"/>
|
||||||
|
<result column="Avg_row_length" property="avgRowLength"/>
|
||||||
|
<result column="Data_length" property="dataLength"/>
|
||||||
|
<result column="Max_data_length" property="maxDataLength"/>
|
||||||
|
<result column="Index_length" property="indexLength"/>
|
||||||
|
<result column="Data_free" property="dataFree"/>
|
||||||
|
<result column="Auto_increment" property="autoIncrement"/>
|
||||||
|
<result column="Create_time" property="createTime"/>
|
||||||
|
<result column="Update_time" property="updateTime"/>
|
||||||
|
<result column="Check_time" property="checkTime"/>
|
||||||
|
<result column="Collation" property="collation"/>
|
||||||
|
<result column="Checksum" property="checksum"/>
|
||||||
|
<result column="Create_options" property="createOptions"/>
|
||||||
|
<result column="Comment" property="comment"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<select id="getDatabaseList" resultType="com.zyplayer.doc.db.framework.db.dto.DatabaseInfoDto">
|
<select id="getDatabaseList" resultType="com.zyplayer.doc.db.framework.db.dto.DatabaseInfoDto">
|
||||||
select TABLE_SCHEMA dbName
|
select TABLE_SCHEMA dbName
|
||||||
from information_schema.tables
|
from information_schema.tables
|
||||||
@@ -39,6 +60,10 @@
|
|||||||
ORDER BY ordinal_position
|
ORDER BY ordinal_position
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTableStatus" resultMap="TableStatusDtoMap">
|
||||||
|
show table status from ${dbName} like #{tableName}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getTableColumnDescList" resultMap="TableColumnDescDtoMap">
|
<select id="getTableColumnDescList" resultMap="TableColumnDescDtoMap">
|
||||||
select 1
|
select 1
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -1,103 +1,107 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.zyplayer.doc.db.framework.db.mapper.base.BaseMapper">
|
<mapper namespace="com.zyplayer.doc.db.framework.db.mapper.base.BaseMapper">
|
||||||
|
|
||||||
<resultMap id="TableColumnDescDtoMap" type="com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto" >
|
<resultMap id="TableColumnDescDtoMap" type="com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto" >
|
||||||
<result column="NAME" property="name" jdbcType="VARCHAR" />
|
<result column="NAME" property="name" jdbcType="VARCHAR" />
|
||||||
<result column="ISIDENITY" property="isidenity" jdbcType="VARCHAR" />
|
<result column="ISIDENITY" property="isidenity" jdbcType="VARCHAR" />
|
||||||
<result column="TYPE" property="type" jdbcType="VARCHAR" />
|
<result column="TYPE" property="type" jdbcType="VARCHAR" />
|
||||||
<result column="NULLABLE" property="nullable" jdbcType="VARCHAR" />
|
<result column="NULLABLE" property="nullable" jdbcType="VARCHAR" />
|
||||||
<result column="LENGTH" property="length" jdbcType="VARCHAR" />
|
<result column="LENGTH" property="length" jdbcType="VARCHAR" />
|
||||||
<result column="ISPRAMARY" property="ispramary" jdbcType="VARCHAR" />
|
<result column="ISPRAMARY" property="ispramary" jdbcType="VARCHAR" />
|
||||||
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />
|
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="QueryTableColumnDescDtoMap" type="com.zyplayer.doc.db.framework.db.dto.QueryTableColumnDescDto" >
|
<resultMap id="QueryTableColumnDescDtoMap" type="com.zyplayer.doc.db.framework.db.dto.QueryTableColumnDescDto" >
|
||||||
<result column="TABLE_NAME" property="tableName" jdbcType="VARCHAR" />
|
<result column="TABLE_NAME" property="tableName" jdbcType="VARCHAR" />
|
||||||
<result column="COLUMN_NAME" property="columnName" jdbcType="VARCHAR" />
|
<result column="COLUMN_NAME" property="columnName" jdbcType="VARCHAR" />
|
||||||
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />
|
<result column="DESCRIPTION" property="description" jdbcType="VARCHAR" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="getDatabaseList" resultType="com.zyplayer.doc.db.framework.db.dto.DatabaseInfoDto">
|
<select id="getDatabaseList" resultType="com.zyplayer.doc.db.framework.db.dto.DatabaseInfoDto">
|
||||||
SELECT NAME as dbName FROM Master..SysDatabases ORDER BY NAME
|
SELECT NAME as dbName FROM Master..SysDatabases ORDER BY NAME
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getTableList" resultType="com.zyplayer.doc.db.framework.db.dto.TableInfoDto">
|
<select id="getTableStatus" resultType="com.zyplayer.doc.db.controller.vo.TableStatusVo">
|
||||||
SELECT NAME as tableName, ID as tableId
|
select 1
|
||||||
FROM ${dbName}..SysObjects Where XType='U' ORDER BY NAME
|
</select>
|
||||||
</select>
|
|
||||||
|
<select id="getTableList" resultType="com.zyplayer.doc.db.framework.db.dto.TableInfoDto">
|
||||||
<select id="getTableColumnList" resultMap="TableColumnDescDtoMap">
|
SELECT NAME as tableName, ID as tableId
|
||||||
WITH PRIMARYINFO( COLUMNNAME ,ISPRAMARY) AS
|
FROM ${dbName}..SysObjects Where XType='U' ORDER BY NAME
|
||||||
(
|
</select>
|
||||||
SELECT C.NAME,'true' AS COLUMNNAME
|
|
||||||
FROM SYSINDEXES I
|
<select id="getTableColumnList" resultMap="TableColumnDescDtoMap">
|
||||||
JOIN SYSINDEXKEYS K ON I.ID = K.ID AND I.INDID = K.INDID
|
WITH PRIMARYINFO( COLUMNNAME ,ISPRAMARY) AS
|
||||||
JOIN SYSOBJECTS O ON I.ID = O.ID
|
(
|
||||||
JOIN SYSCOLUMNS C ON I.ID=C.ID AND K.COLID = C.COLID
|
SELECT C.NAME,'true' AS COLUMNNAME
|
||||||
WHERE O.XTYPE = 'U'
|
FROM SYSINDEXES I
|
||||||
AND EXISTS(SELECT 1 FROM SYSOBJECTS WHERE XTYPE = 'PK' AND NAME = I.NAME)
|
JOIN SYSINDEXKEYS K ON I.ID = K.ID AND I.INDID = K.INDID
|
||||||
AND O.NAME=#{tableName}
|
JOIN SYSOBJECTS O ON I.ID = O.ID
|
||||||
)
|
JOIN SYSCOLUMNS C ON I.ID=C.ID AND K.COLID = C.COLID
|
||||||
SELECT (
|
WHERE O.XTYPE = 'U'
|
||||||
SELECT IS_IDENTITY FROM SYS.ALL_COLUMNS
|
AND EXISTS(SELECT 1 FROM SYSOBJECTS WHERE XTYPE = 'PK' AND NAME = I.NAME)
|
||||||
WHERE SYS.ALL_COLUMNS.NAME=SYSCOLUMNS.NAME AND OBJECT_ID = OBJECT_ID(#{tableName})
|
AND O.NAME=#{tableName}
|
||||||
) ISIDENTITY,SYSCOLUMNS.NAME NAME,SYSTYPES.NAME TYPE,SYSCOLUMNS.ISNULLABLE NULLABLE,SYSCOLUMNS.LENGTH LENGTH,PRIMARYINFO.ISPRAMARY
|
)
|
||||||
FROM SYSCOLUMNS
|
SELECT (
|
||||||
LEFT JOIN PRIMARYINFO ON PRIMARYINFO.COLUMNNAME=NAME
|
SELECT IS_IDENTITY FROM SYS.ALL_COLUMNS
|
||||||
LEFT JOIN SYSTYPES ON SYSCOLUMNS.XUSERTYPE = SYSTYPES.XUSERTYPE
|
WHERE SYS.ALL_COLUMNS.NAME=SYSCOLUMNS.NAME AND OBJECT_ID = OBJECT_ID(#{tableName})
|
||||||
WHERE SYSCOLUMNS.ID = OBJECT_ID(#{tableName})
|
) ISIDENTITY,SYSCOLUMNS.NAME NAME,SYSTYPES.NAME TYPE,SYSCOLUMNS.ISNULLABLE NULLABLE,SYSCOLUMNS.LENGTH LENGTH,PRIMARYINFO.ISPRAMARY
|
||||||
</select>
|
FROM SYSCOLUMNS
|
||||||
|
LEFT JOIN PRIMARYINFO ON PRIMARYINFO.COLUMNNAME=NAME
|
||||||
<select id="getTableColumnDescList" resultMap="TableColumnDescDtoMap">
|
LEFT JOIN SYSTYPES ON SYSCOLUMNS.XUSERTYPE = SYSTYPES.XUSERTYPE
|
||||||
SELECT B.name AS NAME,C.value AS DESCRIPTION
|
WHERE SYSCOLUMNS.ID = OBJECT_ID(#{tableName})
|
||||||
FROM sys.tables A
|
</select>
|
||||||
INNER JOIN sys.columns B ON B.object_id = A.object_id
|
|
||||||
LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
|
<select id="getTableColumnDescList" resultMap="TableColumnDescDtoMap">
|
||||||
WHERE A.name = #{tableName}
|
SELECT B.name AS NAME,C.value AS DESCRIPTION
|
||||||
</select>
|
FROM sys.tables A
|
||||||
|
INNER JOIN sys.columns B ON B.object_id = A.object_id
|
||||||
<select id="getTableAndColumnBySearch" resultMap="QueryTableColumnDescDtoMap">
|
LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
|
||||||
SELECT top 500
|
WHERE A.name = #{tableName}
|
||||||
A.name AS TABLE_NAME,B.name AS COLUMN_NAME,C.value AS DESCRIPTION
|
</select>
|
||||||
FROM sys.tables A
|
|
||||||
INNER JOIN sys.columns B ON B.object_id = A.object_id
|
<select id="getTableAndColumnBySearch" resultMap="QueryTableColumnDescDtoMap">
|
||||||
LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
|
SELECT top 500
|
||||||
WHERE convert(nvarchar(max),C.value) like #{searchText} OR B.name like #{searchText}
|
A.name AS TABLE_NAME,B.name AS COLUMN_NAME,C.value AS DESCRIPTION
|
||||||
</select>
|
FROM sys.tables A
|
||||||
|
INNER JOIN sys.columns B ON B.object_id = A.object_id
|
||||||
<select id="getTableDescList" resultType="com.zyplayer.doc.db.framework.db.dto.TableDescDto">
|
LEFT JOIN sys.extended_properties C ON C.major_id = B.object_id AND C.minor_id = B.column_id
|
||||||
select 'TABLEDESC_SYS' as tableName, value as description, major_id as majorId
|
WHERE convert(nvarchar(max),C.value) like #{searchText} OR B.name like #{searchText}
|
||||||
from sys.extended_properties
|
</select>
|
||||||
WHERE minor_id=0
|
|
||||||
<if test="tableName != null">
|
<select id="getTableDescList" resultType="com.zyplayer.doc.db.framework.db.dto.TableDescDto">
|
||||||
and major_id=object_id(#{tableName})
|
select 'TABLEDESC_SYS' as tableName, value as description, major_id as majorId
|
||||||
</if>
|
from sys.extended_properties
|
||||||
</select>
|
WHERE minor_id=0
|
||||||
|
<if test="tableName != null">
|
||||||
<insert id="updateTableDesc">
|
and major_id=object_id(#{tableName})
|
||||||
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 'SCHEMA', 'dbo', 'TABLE', #{tableName}, NULL, NULL)) > 0)
|
</if>
|
||||||
EXEC sp_updateextendedproperty @name = 'MS_Description', @value = #{newDesc}
|
</select>
|
||||||
, @level0type = 'SCHEMA', @level0name = 'dbo'
|
|
||||||
, @level1type = 'TABLE', @level1name = #{tableName}
|
<insert id="updateTableDesc">
|
||||||
ELSE
|
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 'SCHEMA', 'dbo', 'TABLE', #{tableName}, NULL, NULL)) > 0)
|
||||||
EXEC sp_addextendedproperty @name = 'MS_Description', @value = #{newDesc}
|
EXEC sp_updateextendedproperty @name = 'MS_Description', @value = #{newDesc}
|
||||||
, @level0type = 'SCHEMA', @level0name = 'dbo'
|
, @level0type = 'SCHEMA', @level0name = 'dbo'
|
||||||
, @level1type = 'TABLE', @level1name = #{tableName}
|
, @level1type = 'TABLE', @level1name = #{tableName}
|
||||||
</insert>
|
ELSE
|
||||||
|
EXEC sp_addextendedproperty @name = 'MS_Description', @value = #{newDesc}
|
||||||
<insert id="updateTableColumnDesc">
|
, @level0type = 'SCHEMA', @level0name = 'dbo'
|
||||||
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 'SCHEMA', 'dbo', 'TABLE', #{tableName}, 'COLUMN', #{columnName})) > 0)
|
, @level1type = 'TABLE', @level1name = #{tableName}
|
||||||
EXEC sp_updateextendedproperty @name = 'MS_Description', @value = #{newDesc}
|
|
||||||
, @level0type = 'SCHEMA', @level0name = 'dbo'
|
|
||||||
, @level1type = 'TABLE', @level1name = #{tableName}
|
|
||||||
, @level2type = 'COLUMN', @level2name = #{columnName}
|
|
||||||
ELSE
|
|
||||||
EXEC sp_addextendedproperty @name = 'MS_Description', @value = #{newDesc}
|
|
||||||
, @level0type = 'SCHEMA', @level0name = 'dbo'
|
|
||||||
, @level1type = 'TABLE', @level1name = #{tableName}
|
|
||||||
, @level2type = 'COLUMN', @level2name = #{columnName}
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
<insert id="updateTableColumnDesc">
|
||||||
|
IF ((SELECT COUNT(*) from fn_listextendedproperty('MS_Description', 'SCHEMA', 'dbo', 'TABLE', #{tableName}, 'COLUMN', #{columnName})) > 0)
|
||||||
|
EXEC sp_updateextendedproperty @name = 'MS_Description', @value = #{newDesc}
|
||||||
|
, @level0type = 'SCHEMA', @level0name = 'dbo'
|
||||||
|
, @level1type = 'TABLE', @level1name = #{tableName}
|
||||||
|
, @level2type = 'COLUMN', @level2name = #{columnName}
|
||||||
|
ELSE
|
||||||
|
EXEC sp_addextendedproperty @name = 'MS_Description', @value = #{newDesc}
|
||||||
|
, @level0type = 'SCHEMA', @level0name = 'dbo'
|
||||||
|
, @level1type = 'TABLE', @level1name = #{tableName}
|
||||||
|
, @level2type = 'COLUMN', @level2name = #{columnName}
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,2 +1,2 @@
|
|||||||
!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var i,a,f,l=0,s=[];l<t.length;l++)a=t[l],o[a]&&s.push(o[a][0]),o[a]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,u);s.length;)s.shift()();if(u)for(l=0;l<u.length;l++)f=n(n.s=u[l]);return f};var t={},o={2:0};n.e=function(e){function r(){i.onerror=i.onload=null,clearTimeout(a);var n=o[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}var t=o[e];if(0===t)return new Promise(function(e){e()});if(t)return t[2];var c=new Promise(function(n,r){t=o[e]=[n,r]});t[2]=c;var u=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.charset="utf-8",i.async=!0,i.timeout=12e4,n.nc&&i.setAttribute("nonce",n.nc),i.src=n.p+""+e+".js?"+{0:"80bc97c8e1f56e403c39",1:"0a0403eb1820498dc9bc"}[e];var a=setTimeout(r,12e4);return i.onerror=i.onload=r,u.appendChild(i),c},n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n.oe=function(e){throw console.error(e),e}}([]);
|
!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var i,a,f,l=0,s=[];l<t.length;l++)a=t[l],o[a]&&s.push(o[a][0]),o[a]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,u);s.length;)s.shift()();if(u)for(l=0;l<u.length;l++)f=n(n.s=u[l]);return f};var t={},o={2:0};n.e=function(e){function r(){i.onerror=i.onload=null,clearTimeout(a);var n=o[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}var t=o[e];if(0===t)return new Promise(function(e){e()});if(t)return t[2];var c=new Promise(function(n,r){t=o[e]=[n,r]});t[2]=c;var u=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.charset="utf-8",i.async=!0,i.timeout=12e4,n.nc&&i.setAttribute("nonce",n.nc),i.src=n.p+""+e+".js?"+{0:"ea7225220eb365539ffe",1:"0a0403eb1820498dc9bc"}[e];var a=setTimeout(r,12e4);return i.onerror=i.onload=r,u.appendChild(i),c},n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n.oe=function(e){throw console.error(e),e}}([]);
|
||||||
//# sourceMappingURL=doc-db-manifest.js.map?42eca50901b3d81e2837
|
//# sourceMappingURL=doc-db-manifest.js.map?468c61085fdba28ab9e4
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="text/javascript" src="doc-db-manifest.js?42eca50901b3d81e2837"></script><script type="text/javascript" src="doc-db-vendor.js?0a0403eb1820498dc9bc"></script><script type="text/javascript" src="doc-db-index.js?80bc97c8e1f56e403c39"></script></body>
|
<script type="text/javascript" src="doc-db-manifest.js?468c61085fdba28ab9e4"></script><script type="text/javascript" src="doc-db-vendor.js?0a0403eb1820498dc9bc"></script><script type="text/javascript" src="doc-db-index.js?ea7225220eb365539ffe"></script></body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ public class MgDocumentController {
|
|||||||
*/
|
*/
|
||||||
private Map<String, String> getGlobalParamMap(List<GlobalParamVo> globalParamList, String paramIn) {
|
private Map<String, String> getGlobalParamMap(List<GlobalParamVo> globalParamList, String paramIn) {
|
||||||
Map<String, String> paramMap = globalParamList.stream().filter(val -> Objects.equals(val.getParamIn(), paramIn))
|
Map<String, String> paramMap = globalParamList.stream().filter(val -> Objects.equals(val.getParamIn(), paramIn))
|
||||||
.collect(Collectors.toMap(GlobalParamVo::getKey, GlobalParamVo::getValue));
|
.collect(Collectors.toMap(GlobalParamVo::getKey, GlobalParamVo::getValue, (val1, val2) -> val1, HashMap::new));
|
||||||
return paramMap;
|
return paramMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,7 +598,7 @@ public class MgDocumentController {
|
|||||||
*/
|
*/
|
||||||
private Map<String, Object> getGlobalParamObjMap(List<GlobalParamVo> globalParamList, String paramIn) {
|
private Map<String, Object> getGlobalParamObjMap(List<GlobalParamVo> globalParamList, String paramIn) {
|
||||||
Map<String, Object> paramMap = globalParamList.stream().filter(val -> Objects.equals(val.getParamIn(), paramIn))
|
Map<String, Object> paramMap = globalParamList.stream().filter(val -> Objects.equals(val.getParamIn(), paramIn))
|
||||||
.collect(Collectors.toMap(GlobalParamVo::getKey, GlobalParamVo::getValue));
|
.collect(Collectors.toMap(GlobalParamVo::getKey, GlobalParamVo::getValue, (val1, val2) -> val1, HashMap::new));
|
||||||
return paramMap;
|
return paramMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ var URL = {
|
|||||||
databaseList: '/zyplayer-doc-db/doc-db/getDatabaseList',
|
databaseList: '/zyplayer-doc-db/doc-db/getDatabaseList',
|
||||||
tableList: '/zyplayer-doc-db/doc-db/getTableList',
|
tableList: '/zyplayer-doc-db/doc-db/getTableList',
|
||||||
tableColumnList: '/zyplayer-doc-db/doc-db/getTableColumnList',
|
tableColumnList: '/zyplayer-doc-db/doc-db/getTableColumnList',
|
||||||
|
tableStatus: '/zyplayer-doc-db/doc-db/getTableStatus',
|
||||||
tableAndColumnBySearch: '/zyplayer-doc-db/doc-db/getTableAndColumnBySearch',
|
tableAndColumnBySearch: '/zyplayer-doc-db/doc-db/getTableAndColumnBySearch',
|
||||||
updateTableDesc: '/zyplayer-doc-db/doc-db/updateTableDesc',
|
updateTableDesc: '/zyplayer-doc-db/doc-db/updateTableDesc',
|
||||||
updateTableColumnDesc: '/zyplayer-doc-db/doc-db/updateTableColumnDesc',
|
updateTableColumnDesc: '/zyplayer-doc-db/doc-db/updateTableColumnDesc',
|
||||||
|
|||||||
@@ -2,17 +2,41 @@
|
|||||||
<div class="table-info-vue">
|
<div class="table-info-vue">
|
||||||
<el-card style="margin: 10px;">
|
<el-card style="margin: 10px;">
|
||||||
<div slot="header" class="clearfix">表信息</div>
|
<div slot="header" class="clearfix">表信息</div>
|
||||||
<el-form label-width="100px">
|
<el-row class="status-info-row">
|
||||||
<el-form-item label="数据源:">{{vueQueryParam.host}}</el-form-item>
|
<el-col :span="24"><span class="label">数据源:</span>{{vueQueryParam.host}}</el-col>
|
||||||
<el-form-item label="数据库:">{{vueQueryParam.dbName}}</el-form-item>
|
</el-row>
|
||||||
<el-form-item label="数据表:">{{vueQueryParam.tableName}}</el-form-item>
|
<el-row class="status-info-row">
|
||||||
<el-form-item label="表注释:">
|
<el-col :span="6"><span class="label">数据库:</span>{{vueQueryParam.dbName}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">数据表:</span>{{vueQueryParam.tableName}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">引擎:</span>{{tableStatusInfo.engine}}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row class="status-info-row">
|
||||||
|
<el-col :span="6"><span class="label">行数:</span>{{tableStatusInfo.rows||0}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">自动递增:</span>{{tableStatusInfo.avgRowLength||0}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">行格式:</span>{{tableStatusInfo.rowFormat}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">排序规则:</span>{{tableStatusInfo.collation}}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row class="status-info-row">
|
||||||
|
<el-col :span="6"><span class="label">索引长度:</span>{{getBytesSize(tableStatusInfo.indexLength)}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">数据长度:</span>{{getBytesSize(tableStatusInfo.dataLength)}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">最大长度:</span>{{getBytesSize(tableStatusInfo.maxDataLength)}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">可用空间:</span>{{getBytesSize(tableStatusInfo.dataFree)}}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row class="status-info-row">
|
||||||
|
<el-col :span="6"><span class="label">创建时间:</span>{{tableStatusInfo.createTime}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">修改时间:</span>{{tableStatusInfo.updateTime}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">检查时间:</span>{{tableStatusInfo.checkTime}}</el-col>
|
||||||
|
<el-col :span="6"><span class="label">创建选项:</span>{{tableStatusInfo.createOptions}}</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row class="status-info-row">
|
||||||
|
<el-col :span="24">
|
||||||
|
<span class="label">表注释:</span>
|
||||||
<span v-if="tableInfo.inEdit == 1" @keyup.enter="saveTableDescription">
|
<span v-if="tableInfo.inEdit == 1" @keyup.enter="saveTableDescription">
|
||||||
<el-input v-model="tableInfo.newDesc" placeholder="输入表注释" v-on:blur="saveTableDescription" style="width: 500px;"></el-input>
|
<el-input v-model="tableInfo.newDesc" placeholder="输入表注释" v-on:blur="saveTableDescription" style="width: 500px;"></el-input>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>{{tableInfo.description || '暂无注释'}} <i class="el-icon-edit edit-table-desc" v-on:click="tableInfo.inEdit = 1"></i></span>
|
<span v-else>{{tableInfo.description || '暂无注释'}} <i class="el-icon-edit edit-table-desc" v-on:click="tableInfo.inEdit = 1"></i></span>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
</el-form>
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card style="margin: 10px;">
|
<el-card style="margin: 10px;">
|
||||||
<div slot="header" class="clearfix">字段信息</div>
|
<div slot="header" class="clearfix">字段信息</div>
|
||||||
@@ -53,6 +77,7 @@
|
|||||||
return {
|
return {
|
||||||
columnListLoading: false,
|
columnListLoading: false,
|
||||||
vueQueryParam: {},
|
vueQueryParam: {},
|
||||||
|
tableStatusInfo: {},
|
||||||
columnList: [],
|
columnList: [],
|
||||||
tableInfo: [],
|
tableInfo: [],
|
||||||
};
|
};
|
||||||
@@ -86,11 +111,23 @@
|
|||||||
app.tableInfo = tableInfo;
|
app.tableInfo = tableInfo;
|
||||||
app.columnListLoading = false;
|
app.columnListLoading = false;
|
||||||
});
|
});
|
||||||
|
this.common.post(this.apilist1.tableStatus, this.vueQueryParam, function (json) {
|
||||||
|
app.tableStatusInfo = json.data || {};
|
||||||
|
});
|
||||||
},
|
},
|
||||||
descBoxClick(row) {
|
descBoxClick(row) {
|
||||||
// row.newDesc = row.description;
|
// row.newDesc = row.description;
|
||||||
row.inEdit = 1;
|
row.inEdit = 1;
|
||||||
},
|
},
|
||||||
|
getBytesSize(size) {
|
||||||
|
if (!size) return "0 bytes";
|
||||||
|
var num = 1024.00;
|
||||||
|
if (size < num) return size + " bytes";
|
||||||
|
if (size < Math.pow(num, 2)) return (size / num).toFixed(2) + "KB";
|
||||||
|
if (size < Math.pow(num, 3)) return (size / Math.pow(num, 2)).toFixed(2) + "MB";
|
||||||
|
if (size < Math.pow(num, 4)) return (size / Math.pow(num, 3)).toFixed(2) + "GB";
|
||||||
|
return (size / Math.pow(num, 4)).toFixed(2) + "TB";
|
||||||
|
},
|
||||||
saveColumnDescription(row) {
|
saveColumnDescription(row) {
|
||||||
if (row.inEdit == 0 || row.description == row.newDesc) {
|
if (row.inEdit == 0 || row.description == row.newDesc) {
|
||||||
row.inEdit = 0;
|
row.inEdit = 0;
|
||||||
@@ -124,5 +161,7 @@
|
|||||||
.table-info-vue .edit-table-desc{cursor: pointer; color: #409EFF;}
|
.table-info-vue .edit-table-desc{cursor: pointer; color: #409EFF;}
|
||||||
.table-info-vue .description{cursor: pointer;}
|
.table-info-vue .description{cursor: pointer;}
|
||||||
.table-info-vue .el-table td, .table-info-vue .el-table th{padding: 5px 0;}
|
.table-info-vue .el-table td, .table-info-vue .el-table th{padding: 5px 0;}
|
||||||
|
.table-info-vue .status-info-row{padding: 8px 0;}
|
||||||
|
.table-info-vue .status-info-row .label{width: 80px;display: inline-block;text-align: right;color: #606266;}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user