feat: update frontend resources

This commit is contained in:
vran 2022-05-29 21:04:39 +08:00
parent a1a3b3d022
commit 767df70a47
29 changed files with 285 additions and 577 deletions

View File

@ -0,0 +1 @@
.left-menu:not(.el-menu--collapse){height:100vh}.search-item{padding:10px;width:95%;margin-bottom:12px;margin-right:12px;border-radius:8px;border-width:0 0 1px 0;border-color:#ddd;border-style:solid}.search-item:hover{background-color:#f0f2f5;border-color:transparent}.search-item .jump{margin-right:8px}.search-item .header{display:flex;justify-content:space-between}.search-item .content{padding:10px}.search-item .content .item{margin-right:8px}.search-container{max-height:420px;margin-top:12px;overflow-y:auto;overflow-x:hidden}.badge{margin-top:12px;margin-right:20px}.search-container .el-tabs__item{line-height:unset}.second-title{color:#909399;font-size:14px}.databasir-nav{left:0;bottom:0}.databasir-main-header,.databasir-nav{position:fixed;transform:scale(1);top:0}.databasir-main-header{display:flex;justify-content:space-between;align-items:center;right:0;left:50px;padding:30px;margin-left:33px;background:#fff;z-index:100;border-color:#eee;border-width:0 0 1px 0;border-style:solid}.databasir{display:block}.databasir-main{position:relative;margin-left:60px;margin-top:80px;--el-main-padding:0px 20px 20px 20px}.databasir-main-expand{margin-left:50px}.databasir-main-content{max-width:95%;--el-main-padding:0px 20px 20px 20px}.h2{font-size:24px;color:#606266;margin-top:13px;margin-bottom:13px}.h2,.h3{font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,,Arial,sans-serif}.h3{font-size:20px;color:#909399;margin-top:18px;margin-bottom:18px}

View File

@ -1 +0,0 @@
.left-menu:not(.el-menu--collapse){height:100vh}.search-item{padding:10px;width:95%;margin-bottom:12px;margin-right:12px;border-radius:8px;border-width:0 0 1px 0;border-color:#ddd;border-style:solid}.search-item:hover{background-color:#f0f2f5;border-color:transparent}.search-item .jump{margin-right:8px}.search-item .header{display:flex;justify-content:space-between}.search-item .content{padding:10px}.search-item .content .item{margin-right:8px}.search-container{max-height:420px;margin-top:12px;overflow-y:auto;overflow-x:hidden}.badge{margin-top:12px;margin-right:20px}.search-container .el-tabs__item{line-height:unset}.databasir-nav{left:0;bottom:0}.databasir-main-header,.databasir-nav{position:fixed;transform:scale(1);top:0}.databasir-main-header{display:flex;justify-content:space-between;align-items:center;right:0;left:50px;padding:30px;margin-left:33px;background:#fff;z-index:100;border-color:#eee;border-width:0 0 1px 0;border-style:solid}.databasir{display:block}.databasir-main{position:relative;margin-left:60px;margin-top:80px;--el-main-padding:0px 20px 20px 20px}.databasir-main-expand{margin-left:50px}.databasir-main-content{max-width:95%;--el-main-padding:0px 20px 20px 20px}.h2{font-size:24px;color:#606266;margin-top:13px;margin-bottom:13px}.h2,.h3{font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,,Arial,sans-serif}.h3{font-size:20px;color:#909399;margin-top:18px;margin-bottom:18px}

View File

@ -1 +1 @@
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir</title><script defer="defer" type="module" src="/js/chunk-vendors.661f96f0.js"></script><script defer="defer" type="module" src="/js/app.5b1c79c7.js"></script><link href="/css/chunk-vendors.113af7af.css" rel="stylesheet"><link href="/css/app.ad3ed79e.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.fc4c9525.js" nomodule></script><script defer="defer" src="/js/app-legacy.eb7a61a3.js" nomodule></script></head><body><noscript><strong>We're sorry but databasir doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir</title><script defer="defer" type="module" src="/js/chunk-vendors.661f96f0.js"></script><script defer="defer" type="module" src="/js/app.af57a2a1.js"></script><link href="/css/chunk-vendors.113af7af.css" rel="stylesheet"><link href="/css/app.52ed2769.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.fc4c9525.js" nomodule></script><script defer="defer" src="/js/app-legacy.2640eb23.js" nomodule></script></head><body><noscript><strong>We're sorry but databasir doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,21 @@
package com.databasir.core.domain.description.event;public class DescriptionUpdated {
package com.databasir.core.domain.description.event;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class DescriptionUpdated {
private Integer groupId;
private Integer projectId;
private Integer userId;
private String tableName;
private String columnName;
private String description;
}

View File

@ -2,6 +2,8 @@ package com.databasir.core.domain.description.service;
import com.databasir.core.domain.description.converter.DocumentDescriptionPojoConverter;
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest;
import com.databasir.core.domain.description.event.DescriptionUpdated;
import com.databasir.core.infrastructure.event.EventPublisher;
import com.databasir.dao.impl.DocumentDescriptionDao;
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo;
import lombok.RequiredArgsConstructor;
@ -16,6 +18,8 @@ public class DocumentDescriptionService {
private final DocumentDescriptionPojoConverter documentDescriptionPojoConverter;
private final EventPublisher eventPublisher;
@Transactional
public void save(Integer groupId,
Integer projectId,
@ -28,5 +32,14 @@ public class DocumentDescriptionService {
} else {
documentDescriptionDao.update(pojo);
}
DescriptionUpdated event = DescriptionUpdated.builder()
.tableName(request.getTableName())
.columnName(request.getColumnName())
.description(request.getContent())
.userId(userId)
.projectId(projectId)
.groupId(groupId)
.build();
eventPublisher.publish(event);
}
}

View File

@ -32,5 +32,7 @@ public interface DocumentFullTextPojoConverter {
ProjectPojo project,
DatabaseDocumentPojo db,
TableDocumentPojo table,
TableColumnDocumentPojo column);
TableColumnDocumentPojo column,
String tableDescription,
String columnDescription);
}

View File

@ -211,7 +211,20 @@ public class DocumentService {
tableTriggerDocumentDao.batchInsert(triggers);
// save full text
saveDocumentFullText(projectId, dbDocPojo, tableMeta);
var descriptionMapByJoinName = documentDescriptionDao.selectByProjectId(projectId)
.stream()
.collect(Collectors.toMap(
d -> {
if (d.getColumnName() == null) {
return d.getTableName();
}
return String.join(".",
d.getTableName(),
StringUtils.defaultIfBlank(d.getColumnName(), ""));
},
DocumentDescriptionPojo::getContent,
(a, b) -> a));
saveDocumentFullText(projectId, dbDocPojo, tableMeta, descriptionMapByJoinName);
});
log.info("save new version document success: projectId = {}, name = {}, version = {}",
projectId, meta.getDatabaseName(), version);
@ -219,14 +232,21 @@ public class DocumentService {
private void saveDocumentFullText(Integer projectId,
DatabaseDocumentPojo database,
TableDocumentPojo table) {
TableDocumentPojo table,
Map<String, String> descriptionMapByJoinName) {
ProjectPojo project = projectDao.selectById(projectId);
GroupPojo group = groupDao.selectById(project.getGroupId());
List<TableColumnDocumentPojo> columns = tableColumnDocumentDao.selectByTableDocumentId(table.getId());
// clear outdated data before save
documentFullTextDao.deleteByTableId(table.getId());
List<DocumentFullTextPojo> fullTextPojoList = columns.stream()
.map(column -> documentFullTextPojoConverter.toPojo(group, project, database, table, column))
.map(column -> {
String tableName = table.getName();
String tableDescription = descriptionMapByJoinName.get(tableName);
String columnDescription = descriptionMapByJoinName.get(tableName + "." + column.getName());
return documentFullTextPojoConverter.toPojo(group, project, database, table, column,
tableDescription, columnDescription);
})
.collect(Collectors.toList());
documentFullTextDao.batchInsert(fullTextPojoList);
}

View File

@ -55,10 +55,14 @@ public class SearchResponse {
private String tableComment;
private String tableDescription;
private String colName;
private String colComment;
private String colDescription;
}
}

View File

@ -1,2 +1,36 @@
package com.databasir.core.infrastructure.event.subscriber;public class DescriptionEventSubscriber {
package com.databasir.core.infrastructure.event.subscriber;
import com.databasir.core.domain.description.event.DescriptionUpdated;
import com.databasir.dao.impl.DocumentFullTextDao;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
@Slf4j
public class DescriptionEventSubscriber {
private final DocumentFullTextDao documentFullTextDao;
@EventListener(classes = DescriptionUpdated.class)
public void refreshDocumentFullText(DescriptionUpdated event) {
if (event.getColumnName() != null) {
// update column description
int result = documentFullTextDao.updateColumnDescription(event.getGroupId(),
event.getProjectId(),
event.getTableName(),
event.getColumnName(),
event.getDescription());
log.info("update column description full text success by event {}, effect rows {}", event, result);
} else {
// update table description
int result = documentFullTextDao.updateTableDescription(event.getGroupId(),
event.getProjectId(),
event.getTableName(),
event.getDescription());
log.info("update table description full text success by event {}, effect rows {}", event, result);
}
}
}

View File

@ -30,21 +30,21 @@ public class Indexes {
// INDEX definitions
// -------------------------------------------------------------------------
public static final Index DOCUMENT_FULL_TEXT_FIDX_COLUMN = Internal.createIndex(DSL.name("fidx_column"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.COL_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.COL_COMMENT, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_GROUP = Internal.createIndex(DSL.name("fidx_group"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_PROJECT = Internal.createIndex(DSL.name("fidx_project"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION, DocumentFullText.DOCUMENT_FULL_TEXT.SCHEMA_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_TYPE }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_TABLE = Internal.createIndex(DSL.name("fidx_table"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_COMMENT, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_COLUMN = Internal.createIndex(DSL.name("FIDX_COLUMN"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.COL_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.COL_COMMENT, DocumentFullText.DOCUMENT_FULL_TEXT.COL_DESCRIPTION, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_GROUP = Internal.createIndex(DSL.name("FIDX_GROUP"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_PROJECT = Internal.createIndex(DSL.name("FIDX_PROJECT"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION, DocumentFullText.DOCUMENT_FULL_TEXT.SCHEMA_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_TYPE }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_TABLE = Internal.createIndex(DSL.name("FIDX_TABLE"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_COMMENT, DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_DESCRIPTION, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
public static final Index DATA_SOURCE_PROPERTY_IDX_DATA_SOURCE_ID = Internal.createIndex(DSL.name("idx_data_source_id"), DataSourceProperty.DATA_SOURCE_PROPERTY, new OrderField[] { DataSourceProperty.DATA_SOURCE_PROPERTY.DATA_SOURCE_ID }, false);
public static final Index TABLE_COLUMN_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableColumnDocument.TABLE_COLUMN_DOCUMENT, new OrderField[] { TableColumnDocument.TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
public static final Index TABLE_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableDocument.TABLE_DOCUMENT, new OrderField[] { TableDocument.TABLE_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
public static final Index TABLE_FOREIGN_KEY_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT, new OrderField[] { TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
public static final Index TABLE_INDEX_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableIndexDocument.TABLE_INDEX_DOCUMENT, new OrderField[] { TableIndexDocument.TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
public static final Index TABLE_TRIGGER_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableTriggerDocument.TABLE_TRIGGER_DOCUMENT, new OrderField[] { TableTriggerDocument.TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
public static final Index DOCUMENT_FULL_TEXT_IDX_GROUP_ID = Internal.createIndex(DSL.name("idx_group_id"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_ID }, false);
public static final Index DOCUMENT_FULL_TEXT_IDX_GROUP_ID = Internal.createIndex(DSL.name("IDX_GROUP_ID"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_ID }, false);
public static final Index DOCUMENT_DISCUSSION_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DocumentDiscussion.DOCUMENT_DISCUSSION, new OrderField[] { DocumentDiscussion.DOCUMENT_DISCUSSION.PROJECT_ID }, false);
public static final Index DOCUMENT_FULL_TEXT_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_ID }, false);
public static final Index DOCUMENT_FULL_TEXT_IDX_PROJECT_ID = Internal.createIndex(DSL.name("IDX_PROJECT_ID"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_ID }, false);
public static final Index PROJECT_SYNC_TASK_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), ProjectSyncTask.PROJECT_SYNC_TASK, new OrderField[] { ProjectSyncTask.PROJECT_SYNC_TASK.PROJECT_ID }, false);
public static final Index DOCUMENT_FULL_TEXT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID }, false);
public static final Index DOCUMENT_FULL_TEXT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("IDX_TABLE_DOCUMENT_ID"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID }, false);
public static final Index TABLE_COLUMN_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableColumnDocument.TABLE_COLUMN_DOCUMENT, new OrderField[] { TableColumnDocument.TABLE_COLUMN_DOCUMENT.TABLE_DOCUMENT_ID }, false);
public static final Index TABLE_FOREIGN_KEY_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT, new OrderField[] { TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT.TABLE_DOCUMENT_ID }, false);
public static final Index TABLE_INDEX_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableIndexDocument.TABLE_INDEX_DOCUMENT, new OrderField[] { TableIndexDocument.TABLE_INDEX_DOCUMENT.TABLE_DOCUMENT_ID }, false);

View File

@ -8,27 +8,15 @@ import com.databasir.dao.Databasir;
import com.databasir.dao.Indexes;
import com.databasir.dao.Keys;
import com.databasir.dao.tables.records.DocumentFullTextRecord;
import org.jooq.*;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row21;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
/**
* This class is generated by jOOQ.
@ -146,6 +134,11 @@ public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
*/
public final TableField<DocumentFullTextRecord, String> TABLE_COMMENT = createField(DSL.name("table_comment"), SQLDataType.CLOB, this, "");
/**
* The column <code>databasir.document_full_text.table_description</code>.
*/
public final TableField<DocumentFullTextRecord, String> TABLE_DESCRIPTION = createField(DSL.name("table_description"), SQLDataType.CLOB, this, "");
/**
* The column <code>databasir.document_full_text.col_name</code>.
*/
@ -156,6 +149,11 @@ public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
*/
public final TableField<DocumentFullTextRecord, String> COL_COMMENT = createField(DSL.name("col_comment"), SQLDataType.CLOB, this, "");
/**
* The column <code>databasir.document_full_text.col_description</code>.
*/
public final TableField<DocumentFullTextRecord, String> COL_DESCRIPTION = createField(DSL.name("col_description"), SQLDataType.CLOB, this, "");
/**
* The column <code>databasir.document_full_text.update_at</code>.
*/
@ -246,13 +244,4 @@ public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
public DocumentFullText rename(Name name) {
return new DocumentFullText(name, null);
}
// -------------------------------------------------------------------------
// Row21 type methods
// -------------------------------------------------------------------------
@Override
public Row21<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row21) super.fieldsRow();
}
}

View File

@ -33,8 +33,10 @@ public class DocumentFullTextPojo implements Serializable {
private String databaseType;
private String tableName;
private String tableComment;
private String tableDescription;
private String colName;
private String colComment;
private String colDescription;
private LocalDateTime updateAt;
private LocalDateTime createAt;
@ -58,8 +60,10 @@ public class DocumentFullTextPojo implements Serializable {
this.databaseType = value.databaseType;
this.tableName = value.tableName;
this.tableComment = value.tableComment;
this.tableDescription = value.tableDescription;
this.colName = value.colName;
this.colComment = value.colComment;
this.colDescription = value.colDescription;
this.updateAt = value.updateAt;
this.createAt = value.createAt;
}
@ -82,8 +86,10 @@ public class DocumentFullTextPojo implements Serializable {
String databaseType,
String tableName,
String tableComment,
String tableDescription,
String colName,
String colComment,
String colDescription,
LocalDateTime updateAt,
LocalDateTime createAt
) {
@ -104,8 +110,10 @@ public class DocumentFullTextPojo implements Serializable {
this.databaseType = databaseType;
this.tableName = tableName;
this.tableComment = tableComment;
this.tableDescription = tableDescription;
this.colName = colName;
this.colComment = colComment;
this.colDescription = colDescription;
this.updateAt = updateAt;
this.createAt = createAt;
}
@ -368,6 +376,20 @@ public class DocumentFullTextPojo implements Serializable {
this.tableComment = tableComment;
}
/**
* Getter for <code>databasir.document_full_text.table_description</code>.
*/
public String getTableDescription() {
return this.tableDescription;
}
/**
* Setter for <code>databasir.document_full_text.table_description</code>.
*/
public void setTableDescription(String tableDescription) {
this.tableDescription = tableDescription;
}
/**
* Getter for <code>databasir.document_full_text.col_name</code>.
*/
@ -396,6 +418,20 @@ public class DocumentFullTextPojo implements Serializable {
this.colComment = colComment;
}
/**
* Getter for <code>databasir.document_full_text.col_description</code>.
*/
public String getColDescription() {
return this.colDescription;
}
/**
* Setter for <code>databasir.document_full_text.col_description</code>.
*/
public void setColDescription(String colDescription) {
this.colDescription = colDescription;
}
/**
* Getter for <code>databasir.document_full_text.update_at</code>.
*/
@ -445,8 +481,10 @@ public class DocumentFullTextPojo implements Serializable {
sb.append(", ").append(databaseType);
sb.append(", ").append(tableName);
sb.append(", ").append(tableComment);
sb.append(", ").append(tableDescription);
sb.append(", ").append(colName);
sb.append(", ").append(colComment);
sb.append(", ").append(colDescription);
sb.append(", ").append(updateAt);
sb.append(", ").append(createAt);

View File

@ -9,10 +9,7 @@ import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
import java.time.LocalDateTime;
import org.jooq.Field;
import org.jooq.Record1;
import org.jooq.Record21;
import org.jooq.Row21;
import org.jooq.impl.UpdatableRecordImpl;
@ -20,7 +17,7 @@ import org.jooq.impl.UpdatableRecordImpl;
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullTextRecord> implements Record21<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, LocalDateTime, LocalDateTime> {
public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullTextRecord> {
private static final long serialVersionUID = 1L;
@ -282,60 +279,88 @@ public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullText
return (String) get(16);
}
/**
* Setter for <code>databasir.document_full_text.table_description</code>.
*/
public void setTableDescription(String value) {
set(17, value);
}
/**
* Getter for <code>databasir.document_full_text.table_description</code>.
*/
public String getTableDescription() {
return (String) get(17);
}
/**
* Setter for <code>databasir.document_full_text.col_name</code>.
*/
public void setColName(String value) {
set(17, value);
set(18, value);
}
/**
* Getter for <code>databasir.document_full_text.col_name</code>.
*/
public String getColName() {
return (String) get(17);
return (String) get(18);
}
/**
* Setter for <code>databasir.document_full_text.col_comment</code>.
*/
public void setColComment(String value) {
set(18, value);
set(19, value);
}
/**
* Getter for <code>databasir.document_full_text.col_comment</code>.
*/
public String getColComment() {
return (String) get(18);
return (String) get(19);
}
/**
* Setter for <code>databasir.document_full_text.col_description</code>.
*/
public void setColDescription(String value) {
set(20, value);
}
/**
* Getter for <code>databasir.document_full_text.col_description</code>.
*/
public String getColDescription() {
return (String) get(20);
}
/**
* Setter for <code>databasir.document_full_text.update_at</code>.
*/
public void setUpdateAt(LocalDateTime value) {
set(19, value);
set(21, value);
}
/**
* Getter for <code>databasir.document_full_text.update_at</code>.
*/
public LocalDateTime getUpdateAt() {
return (LocalDateTime) get(19);
return (LocalDateTime) get(21);
}
/**
* Setter for <code>databasir.document_full_text.create_at</code>.
*/
public void setCreateAt(LocalDateTime value) {
set(20, value);
set(22, value);
}
/**
* Getter for <code>databasir.document_full_text.create_at</code>.
*/
public LocalDateTime getCreateAt() {
return (LocalDateTime) get(20);
return (LocalDateTime) get(22);
}
// -------------------------------------------------------------------------
@ -347,487 +372,6 @@ public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullText
return (Record1) super.key();
}
// -------------------------------------------------------------------------
// Record21 type implementation
// -------------------------------------------------------------------------
@Override
public Row21<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row21) super.fieldsRow();
}
@Override
public Row21<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, LocalDateTime, LocalDateTime> valuesRow() {
return (Row21) super.valuesRow();
}
@Override
public Field<Integer> field1() {
return DocumentFullText.DOCUMENT_FULL_TEXT.ID;
}
@Override
public Field<Integer> field2() {
return DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_ID;
}
@Override
public Field<Integer> field3() {
return DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_ID;
}
@Override
public Field<Integer> field4() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_DOCUMENT_ID;
}
@Override
public Field<Integer> field5() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_DOCUMENT_VERSION;
}
@Override
public Field<Integer> field6() {
return DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID;
}
@Override
public Field<Integer> field7() {
return DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_COLUMN_DOCUMENT_ID;
}
@Override
public Field<String> field8() {
return DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_NAME;
}
@Override
public Field<String> field9() {
return DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION;
}
@Override
public Field<String> field10() {
return DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_NAME;
}
@Override
public Field<String> field11() {
return DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION;
}
@Override
public Field<String> field12() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_NAME;
}
@Override
public Field<String> field13() {
return DocumentFullText.DOCUMENT_FULL_TEXT.SCHEMA_NAME;
}
@Override
public Field<String> field14() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME;
}
@Override
public Field<String> field15() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_TYPE;
}
@Override
public Field<String> field16() {
return DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_NAME;
}
@Override
public Field<String> field17() {
return DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_COMMENT;
}
@Override
public Field<String> field18() {
return DocumentFullText.DOCUMENT_FULL_TEXT.COL_NAME;
}
@Override
public Field<String> field19() {
return DocumentFullText.DOCUMENT_FULL_TEXT.COL_COMMENT;
}
@Override
public Field<LocalDateTime> field20() {
return DocumentFullText.DOCUMENT_FULL_TEXT.UPDATE_AT;
}
@Override
public Field<LocalDateTime> field21() {
return DocumentFullText.DOCUMENT_FULL_TEXT.CREATE_AT;
}
@Override
public Integer component1() {
return getId();
}
@Override
public Integer component2() {
return getGroupId();
}
@Override
public Integer component3() {
return getProjectId();
}
@Override
public Integer component4() {
return getDatabaseDocumentId();
}
@Override
public Integer component5() {
return getDatabaseDocumentVersion();
}
@Override
public Integer component6() {
return getTableDocumentId();
}
@Override
public Integer component7() {
return getTableColumnDocumentId();
}
@Override
public String component8() {
return getGroupName();
}
@Override
public String component9() {
return getGroupDescription();
}
@Override
public String component10() {
return getProjectName();
}
@Override
public String component11() {
return getProjectDescription();
}
@Override
public String component12() {
return getDatabaseName();
}
@Override
public String component13() {
return getSchemaName();
}
@Override
public String component14() {
return getDatabaseProductName();
}
@Override
public String component15() {
return getDatabaseType();
}
@Override
public String component16() {
return getTableName();
}
@Override
public String component17() {
return getTableComment();
}
@Override
public String component18() {
return getColName();
}
@Override
public String component19() {
return getColComment();
}
@Override
public LocalDateTime component20() {
return getUpdateAt();
}
@Override
public LocalDateTime component21() {
return getCreateAt();
}
@Override
public Integer value1() {
return getId();
}
@Override
public Integer value2() {
return getGroupId();
}
@Override
public Integer value3() {
return getProjectId();
}
@Override
public Integer value4() {
return getDatabaseDocumentId();
}
@Override
public Integer value5() {
return getDatabaseDocumentVersion();
}
@Override
public Integer value6() {
return getTableDocumentId();
}
@Override
public Integer value7() {
return getTableColumnDocumentId();
}
@Override
public String value8() {
return getGroupName();
}
@Override
public String value9() {
return getGroupDescription();
}
@Override
public String value10() {
return getProjectName();
}
@Override
public String value11() {
return getProjectDescription();
}
@Override
public String value12() {
return getDatabaseName();
}
@Override
public String value13() {
return getSchemaName();
}
@Override
public String value14() {
return getDatabaseProductName();
}
@Override
public String value15() {
return getDatabaseType();
}
@Override
public String value16() {
return getTableName();
}
@Override
public String value17() {
return getTableComment();
}
@Override
public String value18() {
return getColName();
}
@Override
public String value19() {
return getColComment();
}
@Override
public LocalDateTime value20() {
return getUpdateAt();
}
@Override
public LocalDateTime value21() {
return getCreateAt();
}
@Override
public DocumentFullTextRecord value1(Integer value) {
setId(value);
return this;
}
@Override
public DocumentFullTextRecord value2(Integer value) {
setGroupId(value);
return this;
}
@Override
public DocumentFullTextRecord value3(Integer value) {
setProjectId(value);
return this;
}
@Override
public DocumentFullTextRecord value4(Integer value) {
setDatabaseDocumentId(value);
return this;
}
@Override
public DocumentFullTextRecord value5(Integer value) {
setDatabaseDocumentVersion(value);
return this;
}
@Override
public DocumentFullTextRecord value6(Integer value) {
setTableDocumentId(value);
return this;
}
@Override
public DocumentFullTextRecord value7(Integer value) {
setTableColumnDocumentId(value);
return this;
}
@Override
public DocumentFullTextRecord value8(String value) {
setGroupName(value);
return this;
}
@Override
public DocumentFullTextRecord value9(String value) {
setGroupDescription(value);
return this;
}
@Override
public DocumentFullTextRecord value10(String value) {
setProjectName(value);
return this;
}
@Override
public DocumentFullTextRecord value11(String value) {
setProjectDescription(value);
return this;
}
@Override
public DocumentFullTextRecord value12(String value) {
setDatabaseName(value);
return this;
}
@Override
public DocumentFullTextRecord value13(String value) {
setSchemaName(value);
return this;
}
@Override
public DocumentFullTextRecord value14(String value) {
setDatabaseProductName(value);
return this;
}
@Override
public DocumentFullTextRecord value15(String value) {
setDatabaseType(value);
return this;
}
@Override
public DocumentFullTextRecord value16(String value) {
setTableName(value);
return this;
}
@Override
public DocumentFullTextRecord value17(String value) {
setTableComment(value);
return this;
}
@Override
public DocumentFullTextRecord value18(String value) {
setColName(value);
return this;
}
@Override
public DocumentFullTextRecord value19(String value) {
setColComment(value);
return this;
}
@Override
public DocumentFullTextRecord value20(LocalDateTime value) {
setUpdateAt(value);
return this;
}
@Override
public DocumentFullTextRecord value21(LocalDateTime value) {
setCreateAt(value);
return this;
}
@Override
public DocumentFullTextRecord values(Integer value1, Integer value2, Integer value3, Integer value4, Integer value5, Integer value6, Integer value7, String value8, String value9, String value10, String value11, String value12, String value13, String value14, String value15, String value16, String value17, String value18, String value19, LocalDateTime value20, LocalDateTime value21) {
value1(value1);
value2(value2);
value3(value3);
value4(value4);
value5(value5);
value6(value6);
value7(value7);
value8(value8);
value9(value9);
value10(value10);
value11(value11);
value12(value12);
value13(value13);
value14(value14);
value15(value15);
value16(value16);
value17(value17);
value18(value18);
value19(value19);
value20(value20);
value21(value21);
return this;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@ -842,7 +386,7 @@ public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullText
/**
* Create a detached, initialised DocumentFullTextRecord
*/
public DocumentFullTextRecord(Integer id, Integer groupId, Integer projectId, Integer databaseDocumentId, Integer databaseDocumentVersion, Integer tableDocumentId, Integer tableColumnDocumentId, String groupName, String groupDescription, String projectName, String projectDescription, String databaseName, String schemaName, String databaseProductName, String databaseType, String tableName, String tableComment, String colName, String colComment, LocalDateTime updateAt, LocalDateTime createAt) {
public DocumentFullTextRecord(Integer id, Integer groupId, Integer projectId, Integer databaseDocumentId, Integer databaseDocumentVersion, Integer tableDocumentId, Integer tableColumnDocumentId, String groupName, String groupDescription, String projectName, String projectDescription, String databaseName, String schemaName, String databaseProductName, String databaseType, String tableName, String tableComment, String tableDescription, String colName, String colComment, String colDescription, LocalDateTime updateAt, LocalDateTime createAt) {
super(DocumentFullText.DOCUMENT_FULL_TEXT);
setId(id);
@ -862,8 +406,10 @@ public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullText
setDatabaseType(databaseType);
setTableName(tableName);
setTableComment(tableComment);
setTableDescription(tableDescription);
setColName(colName);
setColComment(colComment);
setColDescription(colDescription);
setUpdateAt(updateAt);
setCreateAt(createAt);
}
@ -892,8 +438,10 @@ public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullText
setDatabaseType(value.getDatabaseType());
setTableName(value.getTableName());
setTableComment(value.getTableComment());
setTableDescription(value.getTableDescription());
setColName(value.getColName());
setColComment(value.getColComment());
setColDescription(value.getColDescription());
setUpdateAt(value.getUpdateAt());
setCreateAt(value.getCreateAt());
}

View File

@ -1,5 +1,6 @@
package com.databasir.dao.impl;
import com.databasir.dao.Indexes;
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
import com.databasir.dao.value.FullTextProjectInfoUpdatePojo;
import lombok.Getter;
@ -31,13 +32,11 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
}
public Page<DocumentFullTextPojo> selectColumnPage(Pageable pageable, String keyword) {
String[] fullTextMatchCols = new String[]{
DOCUMENT_FULL_TEXT.COL_NAME.getName(),
DOCUMENT_FULL_TEXT.COL_COMMENT.getName(),
DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME.getName()
};
String colSegment = String.join(",", fullTextMatchCols);
String[] matchCols = Indexes.DOCUMENT_FULL_TEXT_FIDX_COLUMN.getFields()
.stream()
.map(f -> f.getName())
.toArray(String[]::new);
String colSegment = String.join(",", matchCols);
// sample: match(col_name, col_comment) against('+databasir' in boolean mode)
String fullTextMatchSqlSegment = new StringBuilder(64)
.append("MATCH(").append(colSegment).append(") ")
@ -58,11 +57,10 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
}
public Page<DocumentFullTextPojo> selectTablePage(Pageable pageable, String keyword) {
String[] matchCols = new String[]{
DOCUMENT_FULL_TEXT.TABLE_NAME.getName(),
DOCUMENT_FULL_TEXT.TABLE_COMMENT.getName(),
DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME.getName()
};
String[] matchCols = Indexes.DOCUMENT_FULL_TEXT_FIDX_TABLE.getFields()
.stream()
.map(f -> f.getName())
.toArray(String[]::new);
TableField[] groupColumns = new TableField[]{
DOCUMENT_FULL_TEXT.GROUP_ID,
DOCUMENT_FULL_TEXT.GROUP_NAME,
@ -76,6 +74,7 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID,
DOCUMENT_FULL_TEXT.TABLE_NAME,
DOCUMENT_FULL_TEXT.TABLE_COMMENT,
DOCUMENT_FULL_TEXT.TABLE_DESCRIPTION,
};
String colSegment = String.join(",", matchCols);
@ -104,13 +103,10 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
}
public Page<DocumentFullTextPojo> selectProjectPage(Pageable pageable, String keyword) {
String[] matchCols = new String[]{
DOCUMENT_FULL_TEXT.PROJECT_NAME.getName(),
DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION.getName(),
DOCUMENT_FULL_TEXT.SCHEMA_NAME.getName(),
DOCUMENT_FULL_TEXT.DATABASE_NAME.getName(),
DOCUMENT_FULL_TEXT.DATABASE_TYPE.getName(),
};
String[] matchCols = Indexes.DOCUMENT_FULL_TEXT_FIDX_PROJECT.getFields()
.stream()
.map(f -> f.getName())
.toArray(String[]::new);
String colSegment = String.join(",", matchCols);
// sample: match(col_name, col_comment) against('+databasir' in boolean mode)
String fullTextMatchSqlSegment = new StringBuilder(64)
@ -136,10 +132,10 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
}
public Page<DocumentFullTextPojo> selectGroupPage(Pageable pageable, String keyword) {
String[] matchCols = new String[]{
DOCUMENT_FULL_TEXT.GROUP_NAME.getName(),
DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION.getName()
};
String[] matchCols = Indexes.DOCUMENT_FULL_TEXT_FIDX_GROUP.getFields()
.stream()
.map(f -> f.getName())
.toArray(String[]::new);
String colSegment = String.join(",", matchCols);
String fullTextMatchSqlSegment = new StringBuilder(64)
@ -198,4 +194,29 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
.and(DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.isNull()))
.execute();
}
public int updateTableDescription(Integer groupId, Integer projectId, String tableName, String description) {
return this.getDslContext()
.update(DOCUMENT_FULL_TEXT)
.set(DOCUMENT_FULL_TEXT.TABLE_DESCRIPTION, description)
.where(DOCUMENT_FULL_TEXT.GROUP_ID.eq(groupId)
.and(DOCUMENT_FULL_TEXT.PROJECT_ID.eq(projectId))
.and(DOCUMENT_FULL_TEXT.TABLE_NAME.eq(tableName)))
.execute();
}
public int updateColumnDescription(Integer groupId,
Integer projectId,
String tableName,
String columnName,
String description) {
return this.getDslContext()
.update(DOCUMENT_FULL_TEXT)
.set(DOCUMENT_FULL_TEXT.COL_DESCRIPTION, description)
.where(DOCUMENT_FULL_TEXT.GROUP_ID.eq(groupId)
.and(DOCUMENT_FULL_TEXT.PROJECT_ID.eq(projectId))
.and(DOCUMENT_FULL_TEXT.TABLE_NAME.eq(tableName))
.and(DOCUMENT_FULL_TEXT.COL_NAME.eq(columnName)))
.execute();
}
}

View File

@ -52,4 +52,22 @@ FROM table_column_document tcd
WHERE pj.deleted = FALSE
AND dd.is_archive = FALSE
AND dft.table_column_document_id IS NULL
AND dft.project_id IS NULL
AND dft.project_id IS NULL;
-- update table description;
UPDATE document_full_text
LEFT JOIN document_description dd ON document_full_text.project_id = dd.project_id
SET table_description=dd.content
WHERE dd.table_name = document_full_text.table_name
AND dd.project_id = document_full_text.project_id
AND dd.column_name IS NULL;
-- update column description;
UPDATE document_full_text
INNER JOIN document_description dd ON document_full_text.project_id = dd.project_id
SET col_description=dd.content
WHERE dd.table_name = document_full_text.table_name
AND dd.column_name = document_full_text.col_name
AND dd.project_id = document_full_text.project_id
AND dd.column_name IS NOT NULL;

View File

@ -17,17 +17,19 @@ CREATE TABLE document_full_text
`database_type` TEXT,
`table_name` TEXT,
`table_comment` TEXT,
`table_description` TEXT,
`col_name` TEXT,
`col_comment` TEXT,
`col_description` TEXT,
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
INDEX IDX_GROUP_ID (group_id),
INDEX IDX_PROJECT_ID (project_id),
INDEX IDX_TABLE_DOCUMENT_ID (table_document_id),
FULLTEXT FIDX_COLUMN (col_name, col_comment, database_product_name) WITH PARSER ngram,
FULLTEXT FIDX_TABLE (`table_name`, table_comment, database_product_name) WITH PARSER ngram,
FULLTEXT FIDX_PROJECT (project_name, project_description, SCHEMA_NAME, database_name,
database_type) WITH PARSER ngram,
FULLTEXT FIDX_GROUP (group_name, group_description) WITH PARSER ngram
INDEX IDX_GROUP_ID (group_id),
INDEX IDX_PROJECT_ID (project_id),
INDEX IDX_TABLE_DOCUMENT_ID (table_document_id),
FULLTEXT FIDX_COLUMN (col_name, col_comment, col_description, database_product_name) WITH PARSER ngram,
FULLTEXT FIDX_TABLE (`table_name`, table_comment, table_description, database_product_name) WITH PARSER ngram,
FULLTEXT FIDX_PROJECT (project_name, project_description, SCHEMA_NAME, database_name,
database_type) WITH PARSER ngram,
FULLTEXT FIDX_GROUP (group_name, group_description) WITH PARSER ngram
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;

@ -1 +1 @@
Subproject commit 7c6bacd74e5a82e754afa4ea26d648e491e5f129
Subproject commit 65d408239bda6947143f09b1445f2f4ad06ba194