Merge pull request #218 from vran-dev/issue-217
feature: support search group, project, table, col
This commit is contained in:
commit
9ab15514b5
|
@ -6,6 +6,8 @@ import com.databasir.core.domain.search.data.SearchResponse;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
@ -21,7 +23,8 @@ public class SearchController {
|
|||
|
||||
@GetMapping(Routes.Search.SEARCH)
|
||||
@Operation(summary = "搜索")
|
||||
public JsonData<SearchResponse> search(@RequestParam(name = "query") String keyword) {
|
||||
return JsonData.ok(searchService.search(keyword));
|
||||
public JsonData<SearchResponse> search(@PageableDefault(size = 50) Pageable pageable,
|
||||
@RequestParam(name = "query") String keyword) {
|
||||
return JsonData.ok(searchService.search(pageable, keyword));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}
|
|
@ -1 +0,0 @@
|
|||
.left-menu:not(.el-menu--collapse){height:100vh}.search-item{padding:10px;width:99%;margin-bottom:12px;margin-right:12px;display:flex;justify-content:space-between;border-radius:8px}.search-item:hover{background-color:#f0f2f5}.search-item .jump{margin-right:8px}.search-container{max-height:420px;overflow-y:auto;overflow-x:hidden}.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}
|
|
@ -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.b62e398c.js"></script><link href="/css/chunk-vendors.113af7af.css" rel="stylesheet"><link href="/css/app.ee11d130.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.fc4c9525.js" nomodule></script><script defer="defer" src="/js/app-legacy.08e14aa6.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
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
|
@ -28,4 +28,16 @@ public class AsyncConfig implements AsyncConfigurer {
|
|||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
|
||||
return executor;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Executor fullTextRefreshThreadPoolTaskExecutor() {
|
||||
final int maxCorePoolSize = 8;
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
int availableProcessorCount = Runtime.getRuntime().availableProcessors();
|
||||
int corePoolSize = Math.min(maxCorePoolSize, availableProcessorCount);
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
executor.setAllowCoreThreadTimeOut(true);
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
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;
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package com.databasir.core.domain.document.converter;
|
||||
|
||||
import com.databasir.dao.tables.pojos.*;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DocumentFullTextPojoConverter {
|
||||
|
||||
/**
|
||||
* groupName、groupDescription, projectName, projectDescription 等信息需要动态获取,所以不保存
|
||||
*/
|
||||
@Mapping(target = "groupId", source = "group.id")
|
||||
@Mapping(target = "projectId", source = "db.projectId")
|
||||
@Mapping(target = "databaseDocumentId", source = "db.id")
|
||||
@Mapping(target = "databaseDocumentVersion", source = "db.version")
|
||||
@Mapping(target = "databaseProductName", source = "db.productName")
|
||||
@Mapping(target = "tableDocumentId", source = "table.id")
|
||||
@Mapping(target = "tableColumnDocumentId", source = "column.id")
|
||||
@Mapping(target = "tableName", source = "table.name")
|
||||
@Mapping(target = "tableComment", source = "table.comment")
|
||||
@Mapping(target = "colName", source = "column.name")
|
||||
@Mapping(target = "colComment", source = "column.comment")
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "createAt", ignore = true)
|
||||
@Mapping(target = "updateAt", ignore = true)
|
||||
@Mapping(target = "groupName", ignore = true)
|
||||
@Mapping(target = "groupDescription", ignore = true)
|
||||
@Mapping(target = "projectName", ignore = true)
|
||||
@Mapping(target = "projectDescription", ignore = true)
|
||||
DocumentFullTextPojo toPojo(GroupPojo group,
|
||||
ProjectPojo project,
|
||||
DatabaseDocumentPojo db,
|
||||
TableDocumentPojo table,
|
||||
TableColumnDocumentPojo column,
|
||||
String tableDescription,
|
||||
String columnDescription);
|
||||
}
|
|
@ -49,6 +49,8 @@ import static java.util.Collections.emptyList;
|
|||
@Slf4j
|
||||
public class DocumentService {
|
||||
|
||||
private final GroupDao groupDao;
|
||||
|
||||
private final ProjectDao projectDao;
|
||||
|
||||
private final ProjectSyncRuleDao projectSyncRuleDao;
|
||||
|
@ -73,10 +75,14 @@ public class DocumentService {
|
|||
|
||||
private final DocumentDiscussionDao documentDiscussionDao;
|
||||
|
||||
private final DocumentFullTextDao documentFullTextDao;
|
||||
|
||||
private final DocumentDescriptionDao documentDescriptionDao;
|
||||
|
||||
private final DocumentPojoConverter documentPojoConverter;
|
||||
|
||||
private final DocumentFullTextPojoConverter documentFullTextPojoConverter;
|
||||
|
||||
private final DocumentResponseConverter documentResponseConverter;
|
||||
|
||||
private final DocumentSimpleResponseConverter documentSimpleResponseConverter;
|
||||
|
@ -166,10 +172,11 @@ public class DocumentService {
|
|||
Long version,
|
||||
Integer projectId) {
|
||||
|
||||
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, version);
|
||||
var dbDocPojo = documentPojoConverter.toDatabasePojo(projectId, meta, version);
|
||||
final Integer docId;
|
||||
try {
|
||||
docId = databaseDocumentDao.insertAndReturnId(pojo);
|
||||
docId = databaseDocumentDao.insertAndReturnId(dbDocPojo);
|
||||
dbDocPojo.setId(docId);
|
||||
} catch (DuplicateKeyException e) {
|
||||
log.warn("ignore insert database document projectId={} version={}", projectId, version);
|
||||
throw new DatabasirException(DomainErrors.DATABASE_DOCUMENT_DUPLICATE_KEY);
|
||||
|
@ -178,6 +185,7 @@ public class DocumentService {
|
|||
TableDocumentPojo tableMeta =
|
||||
documentPojoConverter.toTablePojo(docId, table);
|
||||
Integer tableMetaId = tableDocumentDao.insertAndReturnId(tableMeta);
|
||||
tableMeta.setId(tableMetaId);
|
||||
// column
|
||||
var columns = documentPojoConverter.toColumnPojo(docId, tableMetaId, table.getColumns());
|
||||
tableColumnDocumentDao.batchInsert(columns);
|
||||
|
@ -201,11 +209,48 @@ public class DocumentService {
|
|||
// trigger
|
||||
var triggers = documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
|
||||
tableTriggerDocumentDao.batchInsert(triggers);
|
||||
|
||||
// save full text
|
||||
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);
|
||||
}
|
||||
|
||||
private void saveDocumentFullText(Integer projectId,
|
||||
DatabaseDocumentPojo database,
|
||||
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 -> {
|
||||
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);
|
||||
}
|
||||
|
||||
public Optional<DatabaseDocumentSimpleResponse> getSimpleOneByProjectId(Integer projectId,
|
||||
Long version,
|
||||
Long originalVersion) {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.databasir.core.domain.group.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GroupCreated {
|
||||
|
||||
private Integer groupId;
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String groupDescription;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.databasir.core.domain.group.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class GroupDeleted {
|
||||
|
||||
private Integer groupId;
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.databasir.core.domain.group.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GroupUpdated {
|
||||
|
||||
private Integer groupId;
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String groupDescription;
|
||||
}
|
|
@ -4,6 +4,10 @@ import com.databasir.core.domain.DomainErrors;
|
|||
import com.databasir.core.domain.group.converter.GroupPojoConverter;
|
||||
import com.databasir.core.domain.group.converter.GroupResponseConverter;
|
||||
import com.databasir.core.domain.group.data.*;
|
||||
import com.databasir.core.domain.group.event.GroupCreated;
|
||||
import com.databasir.core.domain.group.event.GroupDeleted;
|
||||
import com.databasir.core.domain.group.event.GroupUpdated;
|
||||
import com.databasir.core.infrastructure.event.EventPublisher;
|
||||
import com.databasir.dao.impl.*;
|
||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
||||
import com.databasir.dao.tables.pojos.UserPojo;
|
||||
|
@ -34,6 +38,8 @@ public class GroupService {
|
|||
|
||||
private final ProjectDao projectDao;
|
||||
|
||||
private final EventPublisher eventPublisher;
|
||||
|
||||
private final ProjectSyncRuleDao projectSyncRuleDao;
|
||||
|
||||
private final GroupPojoConverter groupPojoConverter;
|
||||
|
@ -55,6 +61,7 @@ public class GroupService {
|
|||
})
|
||||
.collect(Collectors.toList());
|
||||
userRoleDao.batchInsert(roles);
|
||||
eventPublisher.publish(new GroupCreated(groupId, request.getName(), request.getDescription()));
|
||||
return groupId;
|
||||
}
|
||||
|
||||
|
@ -74,6 +81,7 @@ public class GroupService {
|
|||
})
|
||||
.collect(Collectors.toList());
|
||||
userRoleDao.batchInsert(roles);
|
||||
eventPublisher.publish(new GroupUpdated(request.getId(), request.getName(), request.getDescription()));
|
||||
}
|
||||
|
||||
public void delete(Integer groupId) {
|
||||
|
@ -82,6 +90,7 @@ public class GroupService {
|
|||
List<Integer> projectIds = projectDao.selectProjectIdsByGroupId(groupId);
|
||||
projectSyncRuleDao.disableAutoSyncByProjectIds(projectIds);
|
||||
projectDao.deleteByGroupId(groupId);
|
||||
eventPublisher.publish(new GroupDeleted(groupId));
|
||||
}
|
||||
|
||||
public Page<GroupPageResponse> list(Pageable pageable, GroupPageCondition condition) {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.databasir.core.domain.project.event;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ProjectDeleted {
|
||||
|
||||
private Integer projectId;
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.databasir.core.domain.project.event;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ProjectSaved {
|
||||
|
||||
private Integer groupId;
|
||||
|
||||
private Integer projectId;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String projectDescription;
|
||||
|
||||
private String databaseType;
|
||||
|
||||
private String databaseName;
|
||||
|
||||
private String schemaName;
|
||||
|
||||
}
|
|
@ -9,7 +9,10 @@ import com.databasir.core.domain.project.converter.ProjectSimpleTaskResponseConv
|
|||
import com.databasir.core.domain.project.data.*;
|
||||
import com.databasir.core.domain.project.data.task.ProjectSimpleTaskResponse;
|
||||
import com.databasir.core.domain.project.data.task.ProjectTaskListCondition;
|
||||
import com.databasir.core.domain.project.event.ProjectDeleted;
|
||||
import com.databasir.core.domain.project.event.ProjectSaved;
|
||||
import com.databasir.core.infrastructure.connection.DatabaseConnectionService;
|
||||
import com.databasir.core.infrastructure.event.EventPublisher;
|
||||
import com.databasir.dao.enums.ProjectSyncTaskStatus;
|
||||
import com.databasir.dao.impl.*;
|
||||
import com.databasir.dao.tables.pojos.*;
|
||||
|
@ -55,6 +58,8 @@ public class ProjectService {
|
|||
|
||||
private final ProjectSimpleTaskResponseConverter projectSimpleTaskResponseConverter;
|
||||
|
||||
private final EventPublisher eventPublisher;
|
||||
|
||||
public ProjectDetailResponse getOne(Integer id) {
|
||||
return projectDao.selectOptionalById(id)
|
||||
.map(schemaSource -> {
|
||||
|
@ -88,6 +93,17 @@ public class ProjectService {
|
|||
|
||||
ProjectSyncRulePojo syncRule = projectPojoConverter.of(request.getProjectSyncRule(), projectId);
|
||||
projectSyncRuleDao.insertAndReturnId(syncRule);
|
||||
|
||||
var event = ProjectSaved.builder()
|
||||
.groupId(project.getGroupId())
|
||||
.projectId(projectId)
|
||||
.projectName(project.getName())
|
||||
.projectDescription(project.getDescription())
|
||||
.databaseType(request.getDataSource().getDatabaseType())
|
||||
.databaseName(dataSource.getDatabaseName())
|
||||
.schemaName(dataSource.getSchemaName())
|
||||
.build();
|
||||
eventPublisher.publish(event);
|
||||
return projectId;
|
||||
}
|
||||
|
||||
|
@ -119,6 +135,17 @@ public class ProjectService {
|
|||
// update project info
|
||||
ProjectPojo project = projectPojoConverter.of(request);
|
||||
projectDao.updateById(project);
|
||||
|
||||
ProjectSaved event = ProjectSaved.builder()
|
||||
.groupId(groupId)
|
||||
.projectId(project.getId())
|
||||
.projectName(project.getName())
|
||||
.projectDescription(project.getDescription())
|
||||
.databaseType(request.getDataSource().getDatabaseType())
|
||||
.databaseName(dataSource.getDatabaseName())
|
||||
.schemaName(dataSource.getSchemaName())
|
||||
.build();
|
||||
eventPublisher.publish(event);
|
||||
} else {
|
||||
throw DomainErrors.PROJECT_NOT_FOUND.exception();
|
||||
}
|
||||
|
@ -137,6 +164,7 @@ public class ProjectService {
|
|||
public void delete(Integer projectId) {
|
||||
projectDao.updateDeletedById(true, projectId);
|
||||
projectSyncRuleDao.disableAutoSyncByProjectId(projectId);
|
||||
eventPublisher.publish(new ProjectDeleted(projectId));
|
||||
}
|
||||
|
||||
public Page<ProjectSimpleResponse> list(Integer userId, Pageable page, ProjectListCondition condition) {
|
||||
|
|
|
@ -2,32 +2,72 @@ package com.databasir.core.domain.search;
|
|||
|
||||
import com.databasir.core.domain.search.converter.SearchResponseConverter;
|
||||
import com.databasir.core.domain.search.data.SearchResponse;
|
||||
import com.databasir.dao.impl.DocumentFullTextDao;
|
||||
import com.databasir.dao.impl.GroupDao;
|
||||
import com.databasir.dao.impl.ProjectDao;
|
||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SearchService {
|
||||
|
||||
private final ProjectDao projectDao;
|
||||
private final SearchResponseConverter searchResponseConverter;
|
||||
|
||||
private final DocumentFullTextDao documentFullTextDao;
|
||||
|
||||
private final GroupDao groupDao;
|
||||
|
||||
private final SearchResponseConverter searchResponseConverter;
|
||||
private final ProjectDao projectDao;
|
||||
|
||||
public SearchResponse search(String query) {
|
||||
var groupPojoList = groupDao.selectByName(query);
|
||||
var groupResults = searchResponseConverter.toGroupResults(groupPojoList);
|
||||
var projectList = projectDao.selectByProjectNameOrDatabaseOrSchemaOrGroup(query);
|
||||
var projectResults = searchResponseConverter.toProjectResults(projectList);
|
||||
public SearchResponse search(Pageable pageable, String query) {
|
||||
Page<DocumentFullTextPojo> columnPageData = documentFullTextDao.selectColumnPage(pageable, query);
|
||||
Page<DocumentFullTextPojo> tablePageData = documentFullTextDao.selectTablePage(pageable, query);
|
||||
|
||||
// table 和 column 的项目名、组名等信息需要从关联表取
|
||||
Set<Integer> projectIds = new HashSet<>();
|
||||
projectIds.addAll(columnPageData.getContent()
|
||||
.stream().map(o -> o.getProjectId()).collect(Collectors.toList()));
|
||||
projectIds.addAll(tablePageData.getContent()
|
||||
.stream().map(o -> o.getProjectId()).collect(Collectors.toList()));
|
||||
Map<Integer, ProjectPojo> projectMapById = projectDao.selectInIds(projectIds)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(o -> o.getId(), o -> o));
|
||||
|
||||
Page<DocumentFullTextPojo> projectPageData = documentFullTextDao.selectProjectPage(pageable, query);
|
||||
Set<Integer> groupIds = new HashSet<>();
|
||||
groupIds.addAll(columnPageData.getContent()
|
||||
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
||||
groupIds.addAll(tablePageData.getContent()
|
||||
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
||||
groupIds.addAll(projectPageData.getContent()
|
||||
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
||||
Map<Integer, GroupPojo> groupMapById = groupDao.selectInIds(groupIds)
|
||||
.stream()
|
||||
.collect(Collectors.toMap(o -> o.getId(), o -> o));
|
||||
|
||||
// convert
|
||||
var columns = columnPageData.map(item -> searchResponseConverter.toItem(item, projectMapById, groupMapById));
|
||||
var tables = tablePageData.map(item -> searchResponseConverter.toItem(item, projectMapById, groupMapById));
|
||||
var projects = projectPageData.map(item -> searchResponseConverter.toItem(item, groupMapById));
|
||||
var groups = documentFullTextDao.selectGroupPage(pageable, query)
|
||||
.map(searchResponseConverter::toItem);
|
||||
// build response
|
||||
SearchResponse response = new SearchResponse();
|
||||
response.setGroups(groupResults);
|
||||
response.setProjects(projectResults);
|
||||
// TODO support Table search
|
||||
response.setColumnPageData(columns);
|
||||
response.setProjectPageData(projects);
|
||||
response.setTablePageData(tables);
|
||||
response.setGroupPageData(groups);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,44 @@
|
|||
package com.databasir.core.domain.search.converter;
|
||||
|
||||
import com.databasir.core.domain.search.data.SearchResponse;
|
||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
||||
import com.databasir.dao.value.ProjectQueryPojo;
|
||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface SearchResponseConverter {
|
||||
|
||||
List<SearchResponse.GroupSearchResult> toGroupResults(List<GroupPojo> groups);
|
||||
default SearchResponse.Item toItem(DocumentFullTextPojo pojo,
|
||||
Map<Integer, ProjectPojo> projectMapById,
|
||||
Map<Integer, GroupPojo> groupMapById) {
|
||||
ProjectPojo project = projectMapById.get(pojo.getProjectId());
|
||||
GroupPojo group = groupMapById.get(pojo.getGroupId());
|
||||
return toItem(pojo, group.getName(), group.getDescription(), project.getName(), project.getDescription());
|
||||
}
|
||||
|
||||
List<SearchResponse.ProjectSearchResult> toProjectResults(List<ProjectQueryPojo> projects);
|
||||
default SearchResponse.Item toItem(DocumentFullTextPojo pojo,
|
||||
Map<Integer, GroupPojo> groupMapById) {
|
||||
var group = groupMapById.get(pojo.getGroupId());
|
||||
return toItem(pojo,
|
||||
group.getName(),
|
||||
group.getDescription(),
|
||||
pojo.getProjectName(),
|
||||
pojo.getProjectDescription());
|
||||
}
|
||||
|
||||
@Mapping(target = "groupName", source = "groupName")
|
||||
@Mapping(target = "groupDescription", source = "groupDescription")
|
||||
@Mapping(target = "projectName", source = "projectName")
|
||||
@Mapping(target = "projectDescription", source = "projectDescription")
|
||||
SearchResponse.Item toItem(DocumentFullTextPojo item,
|
||||
String groupName,
|
||||
String groupDescription,
|
||||
String projectName,
|
||||
String projectDescription);
|
||||
|
||||
SearchResponse.Item toItem(DocumentFullTextPojo pojo);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
@ -14,31 +12,33 @@ import java.util.List;
|
|||
@Builder
|
||||
public class SearchResponse {
|
||||
|
||||
@Builder.Default
|
||||
private List<GroupSearchResult> groups = Collections.emptyList();
|
||||
private Page<Item> groupPageData;
|
||||
|
||||
@Builder.Default
|
||||
private List<ProjectSearchResult> projects = Collections.emptyList();
|
||||
private Page<Item> projectPageData;
|
||||
|
||||
private Page<Item> tablePageData;
|
||||
|
||||
private Page<Item> columnPageData;
|
||||
|
||||
@Data
|
||||
public static class GroupSearchResult {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ProjectSearchResult {
|
||||
|
||||
private Integer projectId;
|
||||
public static class Item {
|
||||
|
||||
private Integer groupId;
|
||||
|
||||
private Integer projectId;
|
||||
|
||||
private Integer databaseDocumentId;
|
||||
|
||||
private Integer databaseDocumentVersion;
|
||||
|
||||
private Integer tableDocumentId;
|
||||
|
||||
private Integer tableColumnDocumentId;
|
||||
|
||||
private String groupName;
|
||||
|
||||
private String groupDescription;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String projectDescription;
|
||||
|
@ -47,5 +47,22 @@ public class SearchResponse {
|
|||
|
||||
private String schemaName;
|
||||
|
||||
private String databaseProductName;
|
||||
|
||||
private String databaseType;
|
||||
|
||||
private String tableName;
|
||||
|
||||
private String tableComment;
|
||||
|
||||
private String tableDescription;
|
||||
|
||||
private String colName;
|
||||
|
||||
private String colComment;
|
||||
|
||||
private String colDescription;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.databasir.core.infrastructure.event.subscriber;
|
||||
|
||||
import com.databasir.core.domain.group.event.GroupCreated;
|
||||
import com.databasir.core.domain.group.event.GroupDeleted;
|
||||
import com.databasir.core.domain.group.event.GroupUpdated;
|
||||
import com.databasir.dao.Tables;
|
||||
import com.databasir.dao.impl.DocumentFullTextDao;
|
||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Async("fullTextRefreshThreadPoolTaskExecutor")
|
||||
public class GroupEventSubscriber {
|
||||
|
||||
private final DocumentFullTextDao documentFullTextDao;
|
||||
|
||||
@EventListener(classes = GroupUpdated.class)
|
||||
public void refreshFullTextWhenUpdated(GroupUpdated event) {
|
||||
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.GROUP_ID.eq(event.getGroupId())
|
||||
.and(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.isNull()))) {
|
||||
DocumentFullTextPojo pojo = new DocumentFullTextPojo();
|
||||
pojo.setGroupId(event.getGroupId());
|
||||
pojo.setGroupName(event.getGroupName());
|
||||
pojo.setGroupDescription(event.getGroupDescription());
|
||||
documentFullTextDao.insertAndReturnId(pojo);
|
||||
log.info("group not exists, save new full text by event({}) success", event);
|
||||
} else {
|
||||
int result = documentFullTextDao.updateGroupInfoByGroupId(event.getGroupName(),
|
||||
event.getGroupDescription(),
|
||||
event.getGroupId());
|
||||
log.info("update full text group({}) info success, effect rows {}", event.getGroupId(), result);
|
||||
}
|
||||
}
|
||||
|
||||
@EventListener(classes = GroupDeleted.class)
|
||||
public void deleteFullTextWhenDeleted(GroupDeleted event) {
|
||||
int result = documentFullTextDao.deleteByGroupId(event.getGroupId());
|
||||
log.info("delete full text by group({}) success, effect rows {}", event.getGroupId(), result);
|
||||
}
|
||||
|
||||
@EventListener(classes = GroupCreated.class)
|
||||
public void addFullTextWhenCreated(GroupCreated event) {
|
||||
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.GROUP_ID.eq(event.getGroupId())
|
||||
.and(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.isNull()))) {
|
||||
DocumentFullTextPojo pojo = new DocumentFullTextPojo();
|
||||
pojo.setGroupId(event.getGroupId());
|
||||
pojo.setGroupName(event.getGroupName());
|
||||
pojo.setGroupDescription(event.getGroupDescription());
|
||||
documentFullTextDao.insertAndReturnId(pojo);
|
||||
log.info("save full text by event({}) success", event);
|
||||
} else {
|
||||
log.warn("ignore event {} because document already exists", event);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.databasir.core.infrastructure.event.subscriber;
|
||||
|
||||
import com.databasir.core.domain.project.event.ProjectDeleted;
|
||||
import com.databasir.core.domain.project.event.ProjectSaved;
|
||||
import com.databasir.dao.Tables;
|
||||
import com.databasir.dao.impl.DocumentFullTextDao;
|
||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
||||
import com.databasir.dao.value.FullTextProjectInfoUpdatePojo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Async("fullTextRefreshThreadPoolTaskExecutor")
|
||||
public class ProjectEventSubscriber {
|
||||
|
||||
private final DocumentFullTextDao documentFullTextDao;
|
||||
|
||||
@EventListener(classes = ProjectSaved.class)
|
||||
@Transactional
|
||||
public void refreshFullTextWhenUpdated(ProjectSaved event) {
|
||||
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.eq(event.getProjectId())
|
||||
.and(Tables.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.isNull()))) {
|
||||
DocumentFullTextPojo pojo = new DocumentFullTextPojo();
|
||||
pojo.setGroupId(event.getGroupId());
|
||||
pojo.setProjectId(event.getProjectId());
|
||||
pojo.setProjectName(event.getProjectName());
|
||||
pojo.setProjectDescription(event.getProjectDescription());
|
||||
pojo.setDatabaseName(event.getDatabaseName());
|
||||
pojo.setSchemaName(event.getSchemaName());
|
||||
pojo.setDatabaseType(event.getDatabaseType());
|
||||
documentFullTextDao.insertAndReturnId(pojo);
|
||||
log.info("save full text by event ({}) success", event);
|
||||
} else {
|
||||
FullTextProjectInfoUpdatePojo updatePojo = FullTextProjectInfoUpdatePojo.builder()
|
||||
.projectId(event.getProjectId())
|
||||
.projectName(event.getProjectName())
|
||||
.projectDescription(event.getProjectDescription())
|
||||
.databaseType(event.getDatabaseType())
|
||||
.databaseName(event.getDatabaseName())
|
||||
.schemaName(event.getSchemaName())
|
||||
.build();
|
||||
int result = documentFullTextDao.updateProjectInfoByProjectId(updatePojo);
|
||||
log.info("update full text project({}) info success, effect rows {}", event, result);
|
||||
}
|
||||
}
|
||||
|
||||
@EventListener(classes = ProjectDeleted.class)
|
||||
public void deleteFullTextWhenDeleted(ProjectDeleted event) {
|
||||
int result = documentFullTextDao.deleteByProjectId(event.getProjectId());
|
||||
log.info("delete full text by project({}) success, effect rows {}", event.getProjectId(), result);
|
||||
}
|
||||
|
||||
}
|
|
@ -10,6 +10,7 @@ import com.databasir.dao.tables.DatabaseDocument;
|
|||
import com.databasir.dao.tables.DatabaseType;
|
||||
import com.databasir.dao.tables.DocumentDescription;
|
||||
import com.databasir.dao.tables.DocumentDiscussion;
|
||||
import com.databasir.dao.tables.DocumentFullText;
|
||||
import com.databasir.dao.tables.DocumentTemplateProperty;
|
||||
import com.databasir.dao.tables.Group;
|
||||
import com.databasir.dao.tables.Login;
|
||||
|
@ -81,6 +82,11 @@ public class Databasir extends SchemaImpl {
|
|||
*/
|
||||
public final DocumentDiscussion DOCUMENT_DISCUSSION = DocumentDiscussion.DOCUMENT_DISCUSSION;
|
||||
|
||||
/**
|
||||
* The table <code>databasir.document_full_text</code>.
|
||||
*/
|
||||
public final DocumentFullText DOCUMENT_FULL_TEXT = DocumentFullText.DOCUMENT_FULL_TEXT;
|
||||
|
||||
/**
|
||||
* template property
|
||||
*/
|
||||
|
@ -198,6 +204,7 @@ public class Databasir extends SchemaImpl {
|
|||
DatabaseType.DATABASE_TYPE,
|
||||
DocumentDescription.DOCUMENT_DESCRIPTION,
|
||||
DocumentDiscussion.DOCUMENT_DISCUSSION,
|
||||
DocumentFullText.DOCUMENT_FULL_TEXT,
|
||||
DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY,
|
||||
Group.GROUP,
|
||||
Login.LOGIN,
|
||||
|
|
|
@ -6,6 +6,7 @@ package com.databasir.dao;
|
|||
|
||||
import com.databasir.dao.tables.DataSourceProperty;
|
||||
import com.databasir.dao.tables.DocumentDiscussion;
|
||||
import com.databasir.dao.tables.DocumentFullText;
|
||||
import com.databasir.dao.tables.ProjectSyncTask;
|
||||
import com.databasir.dao.tables.TableColumnDocument;
|
||||
import com.databasir.dao.tables.TableDocument;
|
||||
|
@ -29,14 +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.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_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 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 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);
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.databasir.dao.tables.DatabaseDocument;
|
|||
import com.databasir.dao.tables.DatabaseType;
|
||||
import com.databasir.dao.tables.DocumentDescription;
|
||||
import com.databasir.dao.tables.DocumentDiscussion;
|
||||
import com.databasir.dao.tables.DocumentFullText;
|
||||
import com.databasir.dao.tables.DocumentTemplateProperty;
|
||||
import com.databasir.dao.tables.Group;
|
||||
import com.databasir.dao.tables.Login;
|
||||
|
@ -35,6 +36,7 @@ import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
|||
import com.databasir.dao.tables.records.DatabaseTypeRecord;
|
||||
import com.databasir.dao.tables.records.DocumentDescriptionRecord;
|
||||
import com.databasir.dao.tables.records.DocumentDiscussionRecord;
|
||||
import com.databasir.dao.tables.records.DocumentFullTextRecord;
|
||||
import com.databasir.dao.tables.records.DocumentTemplatePropertyRecord;
|
||||
import com.databasir.dao.tables.records.GroupRecord;
|
||||
import com.databasir.dao.tables.records.LoginRecord;
|
||||
|
@ -82,6 +84,7 @@ public class Keys {
|
|||
public static final UniqueKey<DocumentDescriptionRecord> KEY_DOCUMENT_DESCRIPTION_PRIMARY = Internal.createUniqueKey(DocumentDescription.DOCUMENT_DESCRIPTION, DSL.name("KEY_document_description_PRIMARY"), new TableField[] { DocumentDescription.DOCUMENT_DESCRIPTION.ID }, true);
|
||||
public static final UniqueKey<DocumentDescriptionRecord> KEY_DOCUMENT_DESCRIPTION_UK_PROJECT_ID_TABLE_NAME_COLUMN_NAME = Internal.createUniqueKey(DocumentDescription.DOCUMENT_DESCRIPTION, DSL.name("KEY_document_description_uk_project_id_table_name_column_name"), new TableField[] { DocumentDescription.DOCUMENT_DESCRIPTION.PROJECT_ID, DocumentDescription.DOCUMENT_DESCRIPTION.TABLE_NAME, DocumentDescription.DOCUMENT_DESCRIPTION.COLUMN_NAME }, true);
|
||||
public static final UniqueKey<DocumentDiscussionRecord> KEY_DOCUMENT_DISCUSSION_PRIMARY = Internal.createUniqueKey(DocumentDiscussion.DOCUMENT_DISCUSSION, DSL.name("KEY_document_discussion_PRIMARY"), new TableField[] { DocumentDiscussion.DOCUMENT_DISCUSSION.ID }, true);
|
||||
public static final UniqueKey<DocumentFullTextRecord> KEY_DOCUMENT_FULL_TEXT_PRIMARY = Internal.createUniqueKey(DocumentFullText.DOCUMENT_FULL_TEXT, DSL.name("KEY_document_full_text_PRIMARY"), new TableField[] { DocumentFullText.DOCUMENT_FULL_TEXT.ID }, true);
|
||||
public static final UniqueKey<DocumentTemplatePropertyRecord> KEY_DOCUMENT_TEMPLATE_PROPERTY_PRIMARY = Internal.createUniqueKey(DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY, DSL.name("KEY_document_template_property_PRIMARY"), new TableField[] { DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY.ID }, true);
|
||||
public static final UniqueKey<DocumentTemplatePropertyRecord> KEY_DOCUMENT_TEMPLATE_PROPERTY_UK_TYPE_KEY = Internal.createUniqueKey(DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY, DSL.name("KEY_document_template_property_uk_type_key"), new TableField[] { DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY.TYPE, DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY.KEY }, true);
|
||||
public static final UniqueKey<GroupRecord> KEY_GROUP_PRIMARY = Internal.createUniqueKey(Group.GROUP, DSL.name("KEY_group_PRIMARY"), new TableField[] { Group.GROUP.ID }, true);
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.databasir.dao.tables.DatabaseDocument;
|
|||
import com.databasir.dao.tables.DatabaseType;
|
||||
import com.databasir.dao.tables.DocumentDescription;
|
||||
import com.databasir.dao.tables.DocumentDiscussion;
|
||||
import com.databasir.dao.tables.DocumentFullText;
|
||||
import com.databasir.dao.tables.DocumentTemplateProperty;
|
||||
import com.databasir.dao.tables.Group;
|
||||
import com.databasir.dao.tables.Login;
|
||||
|
@ -67,6 +68,11 @@ public class Tables {
|
|||
*/
|
||||
public static final DocumentDiscussion DOCUMENT_DISCUSSION = DocumentDiscussion.DOCUMENT_DISCUSSION;
|
||||
|
||||
/**
|
||||
* The table <code>databasir.document_full_text</code>.
|
||||
*/
|
||||
public static final DocumentFullText DOCUMENT_FULL_TEXT = DocumentFullText.DOCUMENT_FULL_TEXT;
|
||||
|
||||
/**
|
||||
* template property
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,247 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package com.databasir.dao.tables;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The reference instance of <code>databasir.document_full_text</code>
|
||||
*/
|
||||
public static final DocumentFullText DOCUMENT_FULL_TEXT = new DocumentFullText();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public Class<DocumentFullTextRecord> getRecordType() {
|
||||
return DocumentFullTextRecord.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.id</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, Integer> ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.group_id</code>. ref to
|
||||
* group.id
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, Integer> GROUP_ID = createField(DSL.name("group_id"), SQLDataType.INTEGER.nullable(false), this, "ref to group.id");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.project_id</code>. ref to
|
||||
* project.id, may null
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, Integer> PROJECT_ID = createField(DSL.name("project_id"), SQLDataType.INTEGER, this, "ref to project.id, may null");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>databasir.document_full_text.database_document_id</code>. ref to
|
||||
* database_document.id, may null
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, Integer> DATABASE_DOCUMENT_ID = createField(DSL.name("database_document_id"), SQLDataType.INTEGER, this, "ref to database_document.id, may null");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>databasir.document_full_text.database_document_version</code>. rf
|
||||
* to database_document.version, may null
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, Integer> DATABASE_DOCUMENT_VERSION = createField(DSL.name("database_document_version"), SQLDataType.INTEGER, this, "rf to database_document.version, may null");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.table_document_id</code>.
|
||||
* ref to table_document.id, may null
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, Integer> TABLE_DOCUMENT_ID = createField(DSL.name("table_document_id"), SQLDataType.INTEGER, this, "ref to table_document.id, may null");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>databasir.document_full_text.table_column_document_id</code>. ref
|
||||
* to table_column_document.id, may null
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, Integer> TABLE_COLUMN_DOCUMENT_ID = createField(DSL.name("table_column_document_id"), SQLDataType.INTEGER, this, "ref to table_column_document.id, may null");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.group_name</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> GROUP_NAME = createField(DSL.name("group_name"), SQLDataType.VARCHAR(255), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.group_description</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> GROUP_DESCRIPTION = createField(DSL.name("group_description"), SQLDataType.VARCHAR(512), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.project_name</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> PROJECT_NAME = createField(DSL.name("project_name"), SQLDataType.VARCHAR(255), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.project_description</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> PROJECT_DESCRIPTION = createField(DSL.name("project_description"), SQLDataType.CLOB, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.database_name</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> DATABASE_NAME = createField(DSL.name("database_name"), SQLDataType.CLOB, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.schema_name</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> SCHEMA_NAME = createField(DSL.name("schema_name"), SQLDataType.CLOB, this, "");
|
||||
|
||||
/**
|
||||
* The column
|
||||
* <code>databasir.document_full_text.database_product_name</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> DATABASE_PRODUCT_NAME = createField(DSL.name("database_product_name"), SQLDataType.CLOB, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.database_type</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> DATABASE_TYPE = createField(DSL.name("database_type"), SQLDataType.CLOB, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.table_name</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.CLOB, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.table_comment</code>.
|
||||
*/
|
||||
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>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, String> COL_NAME = createField(DSL.name("col_name"), SQLDataType.CLOB, this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.col_comment</code>.
|
||||
*/
|
||||
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>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, LocalDateTime> UPDATE_AT = createField(DSL.name("update_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>databasir.document_full_text.create_at</code>.
|
||||
*/
|
||||
public final TableField<DocumentFullTextRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||
|
||||
private DocumentFullText(Name alias, Table<DocumentFullTextRecord> aliased) {
|
||||
this(alias, aliased, null);
|
||||
}
|
||||
|
||||
private DocumentFullText(Name alias, Table<DocumentFullTextRecord> aliased, Field<?>[] parameters) {
|
||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>databasir.document_full_text</code> table
|
||||
* reference
|
||||
*/
|
||||
public DocumentFullText(String alias) {
|
||||
this(DSL.name(alias), DOCUMENT_FULL_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an aliased <code>databasir.document_full_text</code> table
|
||||
* reference
|
||||
*/
|
||||
public DocumentFullText(Name alias) {
|
||||
this(alias, DOCUMENT_FULL_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a <code>databasir.document_full_text</code> table reference
|
||||
*/
|
||||
public DocumentFullText() {
|
||||
this(DSL.name("document_full_text"), null);
|
||||
}
|
||||
|
||||
public <O extends Record> DocumentFullText(Table<O> child, ForeignKey<O, DocumentFullTextRecord> key) {
|
||||
super(child, key, DOCUMENT_FULL_TEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema getSchema() {
|
||||
return aliased() ? null : Databasir.DATABASIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Index> getIndexes() {
|
||||
return Arrays.asList(Indexes.DOCUMENT_FULL_TEXT_FIDX_COLUMN, Indexes.DOCUMENT_FULL_TEXT_FIDX_GROUP, Indexes.DOCUMENT_FULL_TEXT_FIDX_PROJECT, Indexes.DOCUMENT_FULL_TEXT_FIDX_TABLE, Indexes.DOCUMENT_FULL_TEXT_IDX_GROUP_ID, Indexes.DOCUMENT_FULL_TEXT_IDX_PROJECT_ID, Indexes.DOCUMENT_FULL_TEXT_IDX_TABLE_DOCUMENT_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identity<DocumentFullTextRecord, Integer> getIdentity() {
|
||||
return (Identity<DocumentFullTextRecord, Integer>) super.getIdentity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UniqueKey<DocumentFullTextRecord> getPrimaryKey() {
|
||||
return Keys.KEY_DOCUMENT_FULL_TEXT_PRIMARY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentFullText as(String alias) {
|
||||
return new DocumentFullText(DSL.name(alias), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DocumentFullText as(Name alias) {
|
||||
return new DocumentFullText(alias, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public DocumentFullText rename(String name) {
|
||||
return new DocumentFullText(DSL.name(name), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public DocumentFullText rename(Name name) {
|
||||
return new DocumentFullText(name, null);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,494 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package com.databasir.dao.tables.pojos;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class DocumentFullTextPojo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
private Integer groupId;
|
||||
private Integer projectId;
|
||||
private Integer databaseDocumentId;
|
||||
private Integer databaseDocumentVersion;
|
||||
private Integer tableDocumentId;
|
||||
private Integer tableColumnDocumentId;
|
||||
private String groupName;
|
||||
private String groupDescription;
|
||||
private String projectName;
|
||||
private String projectDescription;
|
||||
private String databaseName;
|
||||
private String schemaName;
|
||||
private String databaseProductName;
|
||||
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;
|
||||
|
||||
public DocumentFullTextPojo() {}
|
||||
|
||||
public DocumentFullTextPojo(DocumentFullTextPojo value) {
|
||||
this.id = value.id;
|
||||
this.groupId = value.groupId;
|
||||
this.projectId = value.projectId;
|
||||
this.databaseDocumentId = value.databaseDocumentId;
|
||||
this.databaseDocumentVersion = value.databaseDocumentVersion;
|
||||
this.tableDocumentId = value.tableDocumentId;
|
||||
this.tableColumnDocumentId = value.tableColumnDocumentId;
|
||||
this.groupName = value.groupName;
|
||||
this.groupDescription = value.groupDescription;
|
||||
this.projectName = value.projectName;
|
||||
this.projectDescription = value.projectDescription;
|
||||
this.databaseName = value.databaseName;
|
||||
this.schemaName = value.schemaName;
|
||||
this.databaseProductName = value.databaseProductName;
|
||||
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;
|
||||
}
|
||||
|
||||
public DocumentFullTextPojo(
|
||||
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
|
||||
) {
|
||||
this.id = id;
|
||||
this.groupId = groupId;
|
||||
this.projectId = projectId;
|
||||
this.databaseDocumentId = databaseDocumentId;
|
||||
this.databaseDocumentVersion = databaseDocumentVersion;
|
||||
this.tableDocumentId = tableDocumentId;
|
||||
this.tableColumnDocumentId = tableColumnDocumentId;
|
||||
this.groupName = groupName;
|
||||
this.groupDescription = groupDescription;
|
||||
this.projectName = projectName;
|
||||
this.projectDescription = projectDescription;
|
||||
this.databaseName = databaseName;
|
||||
this.schemaName = schemaName;
|
||||
this.databaseProductName = databaseProductName;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.id</code>.
|
||||
*/
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.id</code>.
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.group_id</code>. ref to
|
||||
* group.id
|
||||
*/
|
||||
public Integer getGroupId() {
|
||||
return this.groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.group_id</code>. ref to
|
||||
* group.id
|
||||
*/
|
||||
public void setGroupId(Integer groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.project_id</code>. ref to
|
||||
* project.id, may null
|
||||
*/
|
||||
public Integer getProjectId() {
|
||||
return this.projectId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.project_id</code>. ref to
|
||||
* project.id, may null
|
||||
*/
|
||||
public void setProjectId(Integer projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>databasir.document_full_text.database_document_id</code>. ref to
|
||||
* database_document.id, may null
|
||||
*/
|
||||
public Integer getDatabaseDocumentId() {
|
||||
return this.databaseDocumentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>databasir.document_full_text.database_document_id</code>. ref to
|
||||
* database_document.id, may null
|
||||
*/
|
||||
public void setDatabaseDocumentId(Integer databaseDocumentId) {
|
||||
this.databaseDocumentId = databaseDocumentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>databasir.document_full_text.database_document_version</code>. rf
|
||||
* to database_document.version, may null
|
||||
*/
|
||||
public Integer getDatabaseDocumentVersion() {
|
||||
return this.databaseDocumentVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>databasir.document_full_text.database_document_version</code>. rf
|
||||
* to database_document.version, may null
|
||||
*/
|
||||
public void setDatabaseDocumentVersion(Integer databaseDocumentVersion) {
|
||||
this.databaseDocumentVersion = databaseDocumentVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.table_document_id</code>.
|
||||
* ref to table_document.id, may null
|
||||
*/
|
||||
public Integer getTableDocumentId() {
|
||||
return this.tableDocumentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.table_document_id</code>.
|
||||
* ref to table_document.id, may null
|
||||
*/
|
||||
public void setTableDocumentId(Integer tableDocumentId) {
|
||||
this.tableDocumentId = tableDocumentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>databasir.document_full_text.table_column_document_id</code>. ref
|
||||
* to table_column_document.id, may null
|
||||
*/
|
||||
public Integer getTableColumnDocumentId() {
|
||||
return this.tableColumnDocumentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>databasir.document_full_text.table_column_document_id</code>. ref
|
||||
* to table_column_document.id, may null
|
||||
*/
|
||||
public void setTableColumnDocumentId(Integer tableColumnDocumentId) {
|
||||
this.tableColumnDocumentId = tableColumnDocumentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.group_name</code>.
|
||||
*/
|
||||
public String getGroupName() {
|
||||
return this.groupName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.group_name</code>.
|
||||
*/
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.group_description</code>.
|
||||
*/
|
||||
public String getGroupDescription() {
|
||||
return this.groupDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.group_description</code>.
|
||||
*/
|
||||
public void setGroupDescription(String groupDescription) {
|
||||
this.groupDescription = groupDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.project_name</code>.
|
||||
*/
|
||||
public String getProjectName() {
|
||||
return this.projectName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.project_name</code>.
|
||||
*/
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.project_description</code>.
|
||||
*/
|
||||
public String getProjectDescription() {
|
||||
return this.projectDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.project_description</code>.
|
||||
*/
|
||||
public void setProjectDescription(String projectDescription) {
|
||||
this.projectDescription = projectDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.database_name</code>.
|
||||
*/
|
||||
public String getDatabaseName() {
|
||||
return this.databaseName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.database_name</code>.
|
||||
*/
|
||||
public void setDatabaseName(String databaseName) {
|
||||
this.databaseName = databaseName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.schema_name</code>.
|
||||
*/
|
||||
public String getSchemaName() {
|
||||
return this.schemaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.schema_name</code>.
|
||||
*/
|
||||
public void setSchemaName(String schemaName) {
|
||||
this.schemaName = schemaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>databasir.document_full_text.database_product_name</code>.
|
||||
*/
|
||||
public String getDatabaseProductName() {
|
||||
return this.databaseProductName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>databasir.document_full_text.database_product_name</code>.
|
||||
*/
|
||||
public void setDatabaseProductName(String databaseProductName) {
|
||||
this.databaseProductName = databaseProductName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.database_type</code>.
|
||||
*/
|
||||
public String getDatabaseType() {
|
||||
return this.databaseType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.database_type</code>.
|
||||
*/
|
||||
public void setDatabaseType(String databaseType) {
|
||||
this.databaseType = databaseType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.table_name</code>.
|
||||
*/
|
||||
public String getTableName() {
|
||||
return this.tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.table_name</code>.
|
||||
*/
|
||||
public void setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.table_comment</code>.
|
||||
*/
|
||||
public String getTableComment() {
|
||||
return this.tableComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.table_comment</code>.
|
||||
*/
|
||||
public void setTableComment(String tableComment) {
|
||||
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>.
|
||||
*/
|
||||
public String getColName() {
|
||||
return this.colName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.col_name</code>.
|
||||
*/
|
||||
public void setColName(String colName) {
|
||||
this.colName = colName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.col_comment</code>.
|
||||
*/
|
||||
public String getColComment() {
|
||||
return this.colComment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.col_comment</code>.
|
||||
*/
|
||||
public void setColComment(String colComment) {
|
||||
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>.
|
||||
*/
|
||||
public LocalDateTime getUpdateAt() {
|
||||
return this.updateAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.update_at</code>.
|
||||
*/
|
||||
public void setUpdateAt(LocalDateTime updateAt) {
|
||||
this.updateAt = updateAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.create_at</code>.
|
||||
*/
|
||||
public LocalDateTime getCreateAt() {
|
||||
return this.createAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.create_at</code>.
|
||||
*/
|
||||
public void setCreateAt(LocalDateTime createAt) {
|
||||
this.createAt = createAt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("DocumentFullTextPojo (");
|
||||
|
||||
sb.append(id);
|
||||
sb.append(", ").append(groupId);
|
||||
sb.append(", ").append(projectId);
|
||||
sb.append(", ").append(databaseDocumentId);
|
||||
sb.append(", ").append(databaseDocumentVersion);
|
||||
sb.append(", ").append(tableDocumentId);
|
||||
sb.append(", ").append(tableColumnDocumentId);
|
||||
sb.append(", ").append(groupName);
|
||||
sb.append(", ").append(groupDescription);
|
||||
sb.append(", ").append(projectName);
|
||||
sb.append(", ").append(projectDescription);
|
||||
sb.append(", ").append(databaseName);
|
||||
sb.append(", ").append(schemaName);
|
||||
sb.append(", ").append(databaseProductName);
|
||||
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);
|
||||
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,449 @@
|
|||
/*
|
||||
* This file is generated by jOOQ.
|
||||
*/
|
||||
package com.databasir.dao.tables.records;
|
||||
|
||||
|
||||
import com.databasir.dao.tables.DocumentFullText;
|
||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.jooq.Record1;
|
||||
import org.jooq.impl.UpdatableRecordImpl;
|
||||
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullTextRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.id</code>.
|
||||
*/
|
||||
public void setId(Integer value) {
|
||||
set(0, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.id</code>.
|
||||
*/
|
||||
public Integer getId() {
|
||||
return (Integer) get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.group_id</code>. ref to
|
||||
* group.id
|
||||
*/
|
||||
public void setGroupId(Integer value) {
|
||||
set(1, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.group_id</code>. ref to
|
||||
* group.id
|
||||
*/
|
||||
public Integer getGroupId() {
|
||||
return (Integer) get(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.project_id</code>. ref to
|
||||
* project.id, may null
|
||||
*/
|
||||
public void setProjectId(Integer value) {
|
||||
set(2, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.project_id</code>. ref to
|
||||
* project.id, may null
|
||||
*/
|
||||
public Integer getProjectId() {
|
||||
return (Integer) get(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>databasir.document_full_text.database_document_id</code>. ref to
|
||||
* database_document.id, may null
|
||||
*/
|
||||
public void setDatabaseDocumentId(Integer value) {
|
||||
set(3, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>databasir.document_full_text.database_document_id</code>. ref to
|
||||
* database_document.id, may null
|
||||
*/
|
||||
public Integer getDatabaseDocumentId() {
|
||||
return (Integer) get(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>databasir.document_full_text.database_document_version</code>. rf
|
||||
* to database_document.version, may null
|
||||
*/
|
||||
public void setDatabaseDocumentVersion(Integer value) {
|
||||
set(4, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>databasir.document_full_text.database_document_version</code>. rf
|
||||
* to database_document.version, may null
|
||||
*/
|
||||
public Integer getDatabaseDocumentVersion() {
|
||||
return (Integer) get(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.table_document_id</code>.
|
||||
* ref to table_document.id, may null
|
||||
*/
|
||||
public void setTableDocumentId(Integer value) {
|
||||
set(5, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.table_document_id</code>.
|
||||
* ref to table_document.id, may null
|
||||
*/
|
||||
public Integer getTableDocumentId() {
|
||||
return (Integer) get(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>databasir.document_full_text.table_column_document_id</code>. ref
|
||||
* to table_column_document.id, may null
|
||||
*/
|
||||
public void setTableColumnDocumentId(Integer value) {
|
||||
set(6, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>databasir.document_full_text.table_column_document_id</code>. ref
|
||||
* to table_column_document.id, may null
|
||||
*/
|
||||
public Integer getTableColumnDocumentId() {
|
||||
return (Integer) get(6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.group_name</code>.
|
||||
*/
|
||||
public void setGroupName(String value) {
|
||||
set(7, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.group_name</code>.
|
||||
*/
|
||||
public String getGroupName() {
|
||||
return (String) get(7);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.group_description</code>.
|
||||
*/
|
||||
public void setGroupDescription(String value) {
|
||||
set(8, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.group_description</code>.
|
||||
*/
|
||||
public String getGroupDescription() {
|
||||
return (String) get(8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.project_name</code>.
|
||||
*/
|
||||
public void setProjectName(String value) {
|
||||
set(9, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.project_name</code>.
|
||||
*/
|
||||
public String getProjectName() {
|
||||
return (String) get(9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.project_description</code>.
|
||||
*/
|
||||
public void setProjectDescription(String value) {
|
||||
set(10, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.project_description</code>.
|
||||
*/
|
||||
public String getProjectDescription() {
|
||||
return (String) get(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.database_name</code>.
|
||||
*/
|
||||
public void setDatabaseName(String value) {
|
||||
set(11, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.database_name</code>.
|
||||
*/
|
||||
public String getDatabaseName() {
|
||||
return (String) get(11);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.schema_name</code>.
|
||||
*/
|
||||
public void setSchemaName(String value) {
|
||||
set(12, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.schema_name</code>.
|
||||
*/
|
||||
public String getSchemaName() {
|
||||
return (String) get(12);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for
|
||||
* <code>databasir.document_full_text.database_product_name</code>.
|
||||
*/
|
||||
public void setDatabaseProductName(String value) {
|
||||
set(13, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for
|
||||
* <code>databasir.document_full_text.database_product_name</code>.
|
||||
*/
|
||||
public String getDatabaseProductName() {
|
||||
return (String) get(13);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.database_type</code>.
|
||||
*/
|
||||
public void setDatabaseType(String value) {
|
||||
set(14, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.database_type</code>.
|
||||
*/
|
||||
public String getDatabaseType() {
|
||||
return (String) get(14);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.table_name</code>.
|
||||
*/
|
||||
public void setTableName(String value) {
|
||||
set(15, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.table_name</code>.
|
||||
*/
|
||||
public String getTableName() {
|
||||
return (String) get(15);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.table_comment</code>.
|
||||
*/
|
||||
public void setTableComment(String value) {
|
||||
set(16, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.table_comment</code>.
|
||||
*/
|
||||
public String getTableComment() {
|
||||
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(18, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.col_name</code>.
|
||||
*/
|
||||
public String getColName() {
|
||||
return (String) get(18);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.col_comment</code>.
|
||||
*/
|
||||
public void setColComment(String value) {
|
||||
set(19, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.col_comment</code>.
|
||||
*/
|
||||
public String getColComment() {
|
||||
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(21, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.update_at</code>.
|
||||
*/
|
||||
public LocalDateTime getUpdateAt() {
|
||||
return (LocalDateTime) get(21);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>databasir.document_full_text.create_at</code>.
|
||||
*/
|
||||
public void setCreateAt(LocalDateTime value) {
|
||||
set(22, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>databasir.document_full_text.create_at</code>.
|
||||
*/
|
||||
public LocalDateTime getCreateAt() {
|
||||
return (LocalDateTime) get(22);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Primary key information
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public Record1<Integer> key() {
|
||||
return (Record1) super.key();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Constructors
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create a detached DocumentFullTextRecord
|
||||
*/
|
||||
public DocumentFullTextRecord() {
|
||||
super(DocumentFullText.DOCUMENT_FULL_TEXT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 tableDescription, String colName, String colComment, String colDescription, LocalDateTime updateAt, LocalDateTime createAt) {
|
||||
super(DocumentFullText.DOCUMENT_FULL_TEXT);
|
||||
|
||||
setId(id);
|
||||
setGroupId(groupId);
|
||||
setProjectId(projectId);
|
||||
setDatabaseDocumentId(databaseDocumentId);
|
||||
setDatabaseDocumentVersion(databaseDocumentVersion);
|
||||
setTableDocumentId(tableDocumentId);
|
||||
setTableColumnDocumentId(tableColumnDocumentId);
|
||||
setGroupName(groupName);
|
||||
setGroupDescription(groupDescription);
|
||||
setProjectName(projectName);
|
||||
setProjectDescription(projectDescription);
|
||||
setDatabaseName(databaseName);
|
||||
setSchemaName(schemaName);
|
||||
setDatabaseProductName(databaseProductName);
|
||||
setDatabaseType(databaseType);
|
||||
setTableName(tableName);
|
||||
setTableComment(tableComment);
|
||||
setTableDescription(tableDescription);
|
||||
setColName(colName);
|
||||
setColComment(colComment);
|
||||
setColDescription(colDescription);
|
||||
setUpdateAt(updateAt);
|
||||
setCreateAt(createAt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a detached, initialised DocumentFullTextRecord
|
||||
*/
|
||||
public DocumentFullTextRecord(DocumentFullTextPojo value) {
|
||||
super(DocumentFullText.DOCUMENT_FULL_TEXT);
|
||||
|
||||
if (value != null) {
|
||||
setId(value.getId());
|
||||
setGroupId(value.getGroupId());
|
||||
setProjectId(value.getProjectId());
|
||||
setDatabaseDocumentId(value.getDatabaseDocumentId());
|
||||
setDatabaseDocumentVersion(value.getDatabaseDocumentVersion());
|
||||
setTableDocumentId(value.getTableDocumentId());
|
||||
setTableColumnDocumentId(value.getTableColumnDocumentId());
|
||||
setGroupName(value.getGroupName());
|
||||
setGroupDescription(value.getGroupDescription());
|
||||
setProjectName(value.getProjectName());
|
||||
setProjectDescription(value.getProjectDescription());
|
||||
setDatabaseName(value.getDatabaseName());
|
||||
setSchemaName(value.getSchemaName());
|
||||
setDatabaseProductName(value.getDatabaseProductName());
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -100,7 +100,7 @@ public abstract class BaseDao<R> {
|
|||
+ condition));
|
||||
}
|
||||
|
||||
public List<R> selectInIds(List<? extends Serializable> ids) {
|
||||
public List<R> selectInIds(Collection<? extends Serializable> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,222 @@
|
|||
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;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.TableField;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.databasir.dao.Tables.DOCUMENT_FULL_TEXT;
|
||||
|
||||
@Repository
|
||||
public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
|
||||
|
||||
public static final String[] EMPTY = new String[0];
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DocumentFullTextDao() {
|
||||
super(DOCUMENT_FULL_TEXT, DocumentFullTextPojo.class);
|
||||
}
|
||||
|
||||
public Page<DocumentFullTextPojo> selectColumnPage(Pageable pageable, String keyword) {
|
||||
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(") ")
|
||||
.append("AGAINST('+").append(keyword).append("' IN BOOLEAN MODE)")
|
||||
.toString();
|
||||
// count
|
||||
Integer total = dslContext.selectDistinct(DSL.count(DOCUMENT_FULL_TEXT.TABLE_COLUMN_DOCUMENT_ID))
|
||||
.from(DOCUMENT_FULL_TEXT)
|
||||
.where(DOCUMENT_FULL_TEXT.TABLE_COLUMN_DOCUMENT_ID.isNotNull().and(fullTextMatchSqlSegment))
|
||||
.fetchOne(0, int.class);
|
||||
// content
|
||||
List<DocumentFullTextPojo> content = dslContext.select(DOCUMENT_FULL_TEXT.fields())
|
||||
.from(DOCUMENT_FULL_TEXT)
|
||||
.where(DOCUMENT_FULL_TEXT.TABLE_COLUMN_DOCUMENT_ID.isNotNull().and(fullTextMatchSqlSegment))
|
||||
.limit(pageable.getOffset(), pageable.getPageSize())
|
||||
.fetchInto(DocumentFullTextPojo.class);
|
||||
return new PageImpl<>(content, pageable, total.longValue());
|
||||
}
|
||||
|
||||
public Page<DocumentFullTextPojo> selectTablePage(Pageable pageable, String keyword) {
|
||||
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,
|
||||
DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION,
|
||||
DOCUMENT_FULL_TEXT.PROJECT_ID,
|
||||
DOCUMENT_FULL_TEXT.PROJECT_NAME,
|
||||
DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION,
|
||||
DOCUMENT_FULL_TEXT.DATABASE_NAME,
|
||||
DOCUMENT_FULL_TEXT.SCHEMA_NAME,
|
||||
DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME,
|
||||
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);
|
||||
|
||||
// sample: match(col_name, col_comment) against('+databasir' in boolean mode)
|
||||
String fullTextMatchSqlSegment = new StringBuilder(64)
|
||||
.append("MATCH(").append(colSegment).append(") ")
|
||||
.append("AGAINST('+").append(keyword).append("' IN BOOLEAN MODE)")
|
||||
.toString();
|
||||
// count
|
||||
Integer total = dslContext.selectDistinct(DSL.count(DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID))
|
||||
.from(DOCUMENT_FULL_TEXT)
|
||||
.where(DOCUMENT_FULL_TEXT.PROJECT_ID.isNotNull()
|
||||
.and(DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.isNull())
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.fetchOne(0, int.class);
|
||||
// content
|
||||
List<DocumentFullTextPojo> content = dslContext.select(groupColumns)
|
||||
.from(DOCUMENT_FULL_TEXT)
|
||||
.where(DOCUMENT_FULL_TEXT.PROJECT_ID.isNotNull()
|
||||
.and(DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.isNotNull())
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.groupBy(groupColumns)
|
||||
.limit(pageable.getOffset(), pageable.getPageSize())
|
||||
.fetchInto(DocumentFullTextPojo.class);
|
||||
return new PageImpl<>(content, pageable, total.longValue());
|
||||
}
|
||||
|
||||
public Page<DocumentFullTextPojo> selectProjectPage(Pageable pageable, String keyword) {
|
||||
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)
|
||||
.append("MATCH(").append(colSegment).append(") ")
|
||||
.append("AGAINST('+").append(keyword).append("' IN BOOLEAN MODE)")
|
||||
.toString();
|
||||
// count
|
||||
Integer total = dslContext.selectDistinct(DSL.count(DOCUMENT_FULL_TEXT.PROJECT_ID))
|
||||
.from(DOCUMENT_FULL_TEXT)
|
||||
.where(DOCUMENT_FULL_TEXT.PROJECT_ID.isNotNull()
|
||||
.and(DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.isNull())
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.fetchOne(0, int.class);
|
||||
// content
|
||||
List<DocumentFullTextPojo> content = dslContext.select(DOCUMENT_FULL_TEXT.fields())
|
||||
.from(DOCUMENT_FULL_TEXT)
|
||||
.where(DOCUMENT_FULL_TEXT.PROJECT_ID.isNotNull()
|
||||
.and(DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.isNull())
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.limit(pageable.getOffset(), pageable.getPageSize())
|
||||
.fetchInto(DocumentFullTextPojo.class);
|
||||
return new PageImpl<>(content, pageable, total.longValue());
|
||||
}
|
||||
|
||||
public Page<DocumentFullTextPojo> selectGroupPage(Pageable pageable, String keyword) {
|
||||
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)
|
||||
.append("MATCH(").append(colSegment).append(") ")
|
||||
.append("AGAINST('+").append(keyword).append("' IN BOOLEAN MODE)")
|
||||
.toString();
|
||||
// count
|
||||
Integer total = dslContext.selectDistinct(DSL.count(DOCUMENT_FULL_TEXT.GROUP_ID))
|
||||
.from(DOCUMENT_FULL_TEXT)
|
||||
.where(DOCUMENT_FULL_TEXT.GROUP_ID.isNotNull()
|
||||
.and(DOCUMENT_FULL_TEXT.PROJECT_ID.isNull())
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.fetchOne(0, int.class);
|
||||
// content
|
||||
List<DocumentFullTextPojo> content = dslContext.select(DOCUMENT_FULL_TEXT.fields())
|
||||
.from(DOCUMENT_FULL_TEXT)
|
||||
.where(DOCUMENT_FULL_TEXT.GROUP_ID.isNotNull()
|
||||
.and(DOCUMENT_FULL_TEXT.PROJECT_ID.isNull())
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.limit(pageable.getOffset(), pageable.getPageSize())
|
||||
.fetchInto(DocumentFullTextPojo.class);
|
||||
return new PageImpl<>(content, pageable, total.longValue());
|
||||
}
|
||||
|
||||
public int deleteByTableId(Integer tableDocumentId) {
|
||||
return this.delete(DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.eq(tableDocumentId));
|
||||
}
|
||||
|
||||
public int deleteByGroupId(Integer groupId) {
|
||||
return this.delete(DOCUMENT_FULL_TEXT.GROUP_ID.eq(groupId));
|
||||
}
|
||||
|
||||
public int deleteByProjectId(Integer projectId) {
|
||||
return this.delete(DOCUMENT_FULL_TEXT.PROJECT_ID.eq(projectId));
|
||||
}
|
||||
|
||||
public int updateGroupInfoByGroupId(String groupName, String groupDescription, Integer groupId) {
|
||||
String description = Objects.requireNonNullElse(groupDescription, "");
|
||||
return this.getDslContext()
|
||||
.update(DOCUMENT_FULL_TEXT)
|
||||
.set(DOCUMENT_FULL_TEXT.GROUP_NAME, groupName)
|
||||
.set(DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION, description)
|
||||
.where(DOCUMENT_FULL_TEXT.GROUP_ID.eq(groupId).and(DOCUMENT_FULL_TEXT.PROJECT_ID.isNull()))
|
||||
.execute();
|
||||
}
|
||||
|
||||
public int updateProjectInfoByProjectId(FullTextProjectInfoUpdatePojo updatePojo) {
|
||||
return this.getDslContext()
|
||||
.update(DOCUMENT_FULL_TEXT)
|
||||
.set(DOCUMENT_FULL_TEXT.PROJECT_NAME, updatePojo.getProjectName())
|
||||
.set(DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION, updatePojo.getProjectDescription())
|
||||
.set(DOCUMENT_FULL_TEXT.DATABASE_NAME, updatePojo.getDatabaseName())
|
||||
.set(DOCUMENT_FULL_TEXT.SCHEMA_NAME, updatePojo.getSchemaName())
|
||||
.set(DOCUMENT_FULL_TEXT.DATABASE_TYPE, updatePojo.getDatabaseType())
|
||||
.where(DOCUMENT_FULL_TEXT.PROJECT_ID.eq(updatePojo.getProjectId())
|
||||
.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();
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -47,7 +48,7 @@ public class GroupDao extends BaseDao<GroupPojo> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<GroupPojo> selectInIds(List<? extends Serializable> ids) {
|
||||
public List<GroupPojo> selectInIds(Collection<? extends Serializable> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.databasir.dao.impl;
|
|||
|
||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
||||
import com.databasir.dao.value.GroupProjectCountPojo;
|
||||
import com.databasir.dao.value.ProjectQueryPojo;
|
||||
import lombok.Getter;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.DSLContext;
|
||||
|
@ -20,7 +19,8 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.databasir.dao.Tables.*;
|
||||
import static com.databasir.dao.Tables.DATA_SOURCE;
|
||||
import static com.databasir.dao.Tables.PROJECT;
|
||||
|
||||
@Repository
|
||||
public class ProjectDao extends BaseDao<ProjectPojo> {
|
||||
|
@ -127,27 +127,4 @@ public class ProjectDao extends BaseDao<ProjectPojo> {
|
|||
.fetchMap(PROJECT.ID, PROJECT.GROUP_ID);
|
||||
}
|
||||
|
||||
public List<ProjectQueryPojo> selectByProjectNameOrDatabaseOrSchemaOrGroup(String query) {
|
||||
return getDslContext()
|
||||
.select(
|
||||
PROJECT.ID.as("project_id"),
|
||||
PROJECT.NAME.as("project_name"),
|
||||
PROJECT.DESCRIPTION.as("project_description"),
|
||||
DATA_SOURCE.DATABASE_NAME,
|
||||
DATA_SOURCE.SCHEMA_NAME,
|
||||
GROUP.NAME.as("group_name"),
|
||||
GROUP.ID.as("group_id")
|
||||
)
|
||||
.from(PROJECT)
|
||||
.leftJoin(DATA_SOURCE).on(DATA_SOURCE.PROJECT_ID.eq(PROJECT.ID))
|
||||
.leftJoin(GROUP).on(GROUP.ID.eq(PROJECT.GROUP_ID))
|
||||
.where(PROJECT.DELETED.eq(false)
|
||||
.and(GROUP.DELETED.eq(false))
|
||||
.and(PROJECT.NAME.contains(query)
|
||||
.or(DATA_SOURCE.DATABASE_NAME.contains(query))
|
||||
.or(DATA_SOURCE.SCHEMA_NAME.contains(query))
|
||||
.or(GROUP.NAME.contains(query)))
|
||||
)
|
||||
.fetchInto(ProjectQueryPojo.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.databasir.dao.value;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class FullTextProjectInfoUpdatePojo {
|
||||
|
||||
private Integer projectId;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String projectDescription;
|
||||
|
||||
private String databaseType;
|
||||
|
||||
private String databaseName;
|
||||
|
||||
private String schemaName;
|
||||
}
|
|
@ -378,4 +378,38 @@ CREATE TABLE IF NOT EXISTS project_sync_task
|
|||
INDEX idx_project_id (project_id),
|
||||
INDEX idx_user_id (user_id)
|
||||
) CHARSET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci;
|
||||
COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE document_full_text
|
||||
(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
`group_id` INT NOT NULL COMMENT 'ref to group.id',
|
||||
`project_id` INT COMMENT 'ref to project.id, may null',
|
||||
`database_document_id` INT COMMENT 'ref to database_document.id, may null',
|
||||
`database_document_version` INT COMMENT 'rf to database_document.version, may null',
|
||||
`table_document_id` INT COMMENT 'ref to table_document.id, may null',
|
||||
`table_column_document_id` INT COMMENT 'ref to table_column_document.id, may null',
|
||||
`group_name` VARCHAR(255),
|
||||
`group_description` VARCHAR(512),
|
||||
`project_name` VARCHAR(255),
|
||||
`project_description` TEXT,
|
||||
`database_name` TEXT,
|
||||
`schema_name` TEXT,
|
||||
`database_product_name` TEXT,
|
||||
`database_type` TEXT,
|
||||
`table_name` TEXT,
|
||||
`table_comment` TEXT,
|
||||
`col_name` TEXT,
|
||||
`col_comment` 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
|
||||
) CHARSET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci;
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
-- migration group info
|
||||
INSERT INTO document_full_text(group_id, group_name, group_description)
|
||||
SELECT `group`.id, `group`.name, `group`.description
|
||||
FROM `group`
|
||||
LEFT JOIN document_full_text dft ON `group`.id = dft.group_id
|
||||
WHERE dft.group_id IS NULL
|
||||
AND `group`.deleted = FALSE;
|
||||
|
||||
-- migration project info
|
||||
INSERT INTO document_full_text(group_id, project_id, project_name, project_description, database_name, schema_name,
|
||||
database_type)
|
||||
SELECT project.group_id,
|
||||
project.id,
|
||||
project.name,
|
||||
project.description,
|
||||
ds.database_name,
|
||||
ds.schema_name,
|
||||
ds.database_type
|
||||
FROM project
|
||||
LEFT JOIN document_full_text ON project.id = document_full_text.project_id
|
||||
LEFT JOIN `group` g ON project.group_id = g.id
|
||||
LEFT JOIN data_source ds ON project.id = ds.project_id
|
||||
WHERE project.deleted = FALSE
|
||||
AND g.deleted = FALSE
|
||||
AND document_full_text.table_document_id IS NULL
|
||||
AND document_full_text.project_id IS NULL;
|
||||
|
||||
|
||||
-- migration column
|
||||
INSERT INTO document_full_text(group_id, project_id, database_document_id, database_document_version,
|
||||
table_document_id, table_column_document_id, database_name, schema_name,
|
||||
database_product_name, table_name, table_comment, col_name, col_comment)
|
||||
SELECT pj.group_id,
|
||||
pj.id,
|
||||
dd.id,
|
||||
dd.version,
|
||||
td.id,
|
||||
tcd.id,
|
||||
ds.database_type,
|
||||
ds.schema_name,
|
||||
dd.product_name,
|
||||
td.name,
|
||||
td.comment,
|
||||
tcd.name,
|
||||
tcd.comment
|
||||
FROM table_column_document tcd
|
||||
LEFT JOIN document_full_text dft ON dft.table_column_document_id = tcd.id
|
||||
INNER JOIN table_document td ON tcd.table_document_id = td.id
|
||||
INNER JOIN database_document dd ON tcd.database_document_id = dd.id
|
||||
INNER JOIN project pj ON dd.project_id = pj.id
|
||||
INNER JOIN data_source ds ON pj.id = ds.project_id
|
||||
WHERE pj.deleted = FALSE
|
||||
AND dd.is_archive = FALSE
|
||||
AND dft.table_column_document_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;
|
|
@ -0,0 +1,35 @@
|
|||
CREATE TABLE document_full_text
|
||||
(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
`group_id` INT NOT NULL COMMENT 'ref to group.id',
|
||||
`project_id` INT COMMENT 'ref to project.id, may null',
|
||||
`database_document_id` INT COMMENT 'ref to database_document.id, may null',
|
||||
`database_document_version` INT COMMENT 'rf to database_document.version, may null',
|
||||
`table_document_id` INT COMMENT 'ref to table_document.id, may null',
|
||||
`table_column_document_id` INT COMMENT 'ref to table_column_document.id, may null',
|
||||
`group_name` VARCHAR(255),
|
||||
`group_description` VARCHAR(512),
|
||||
`project_name` VARCHAR(255),
|
||||
`project_description` TEXT,
|
||||
`database_name` TEXT,
|
||||
`schema_name` TEXT,
|
||||
`database_product_name` 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, 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 f67d6b70df557fe7f156c23c5b81922bd2fab404
|
||||
Subproject commit 65d408239bda6947143f09b1445f2f4ad06ba194
|
Loading…
Reference in New Issue