feat: support search table, column

This commit is contained in:
vran 2022-05-29 17:30:01 +08:00
parent e9a07b1098
commit 497ad6b58a
32 changed files with 2424 additions and 67 deletions

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,36 @@
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 {
/**
* groupNamegroupDescription, 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);
}

View File

@ -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,28 @@ public class DocumentService {
// trigger
var triggers = documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
tableTriggerDocumentDao.batchInsert(triggers);
// save full text
saveDocumentFullText(projectId, dbDocPojo, tableMeta);
});
log.info("save new version document success: projectId = {}, name = {}, version = {}",
projectId, meta.getDatabaseName(), version);
}
private void saveDocumentFullText(Integer projectId,
DatabaseDocumentPojo database,
TableDocumentPojo table) {
ProjectPojo project = projectDao.selectById(projectId);
GroupPojo group = groupDao.selectById(project.getGroupId());
List<TableColumnDocumentPojo> columns = tableColumnDocumentDao.selectByTableDocumentId(table.getId());
// clear outdated data before save
documentFullTextDao.deleteByTableId(table.getId());
List<DocumentFullTextPojo> fullTextPojoList = columns.stream()
.map(column -> documentFullTextPojoConverter.toPojo(group, project, database, table, column))
.collect(Collectors.toList());
documentFullTextDao.batchInsert(fullTextPojoList);
}
public Optional<DatabaseDocumentSimpleResponse> getSimpleOneByProjectId(Integer projectId,
Long version,
Long originalVersion) {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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(project.getGroupId())
.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) {

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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,18 @@ public class SearchResponse {
private String schemaName;
private String databaseProductName;
private String databaseType;
private String tableName;
private String tableComment;
private String colName;
private String colComment;
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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,

View File

@ -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.DATABASE_PRODUCT_NAME }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_GROUP = Internal.createIndex(DSL.name("fidx_group"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_PROJECT = Internal.createIndex(DSL.name("fidx_project"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION, DocumentFullText.DOCUMENT_FULL_TEXT.SCHEMA_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_TYPE }, false);
public static final Index DOCUMENT_FULL_TEXT_FIDX_TABLE = Internal.createIndex(DSL.name("fidx_table"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_COMMENT, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
public static final Index 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);

View File

@ -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);

View File

@ -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
*/

View File

@ -0,0 +1,258 @@
/*
* 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 java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row21;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;
/**
* This class is generated by jOOQ.
*/
@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.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.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);
}
// -------------------------------------------------------------------------
// Row21 type methods
// -------------------------------------------------------------------------
@Override
public Row21<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row21) super.fieldsRow();
}
}

View File

@ -0,0 +1,456 @@
/*
* 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 colName;
private String colComment;
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.colName = value.colName;
this.colComment = value.colComment;
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 colName,
String colComment,
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.colName = colName;
this.colComment = colComment;
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.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.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(colName);
sb.append(", ").append(colComment);
sb.append(", ").append(updateAt);
sb.append(", ").append(createAt);
sb.append(")");
return sb.toString();
}
}

View File

@ -0,0 +1,901 @@
/*
* 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.Field;
import org.jooq.Record1;
import org.jooq.Record21;
import org.jooq.Row21;
import org.jooq.impl.UpdatableRecordImpl;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DocumentFullTextRecord extends UpdatableRecordImpl<DocumentFullTextRecord> implements Record21<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, LocalDateTime, LocalDateTime> {
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.col_name</code>.
*/
public void setColName(String value) {
set(17, value);
}
/**
* Getter for <code>databasir.document_full_text.col_name</code>.
*/
public String getColName() {
return (String) get(17);
}
/**
* Setter for <code>databasir.document_full_text.col_comment</code>.
*/
public void setColComment(String value) {
set(18, value);
}
/**
* Getter for <code>databasir.document_full_text.col_comment</code>.
*/
public String getColComment() {
return (String) get(18);
}
/**
* Setter for <code>databasir.document_full_text.update_at</code>.
*/
public void setUpdateAt(LocalDateTime value) {
set(19, value);
}
/**
* Getter for <code>databasir.document_full_text.update_at</code>.
*/
public LocalDateTime getUpdateAt() {
return (LocalDateTime) get(19);
}
/**
* Setter for <code>databasir.document_full_text.create_at</code>.
*/
public void setCreateAt(LocalDateTime value) {
set(20, value);
}
/**
* Getter for <code>databasir.document_full_text.create_at</code>.
*/
public LocalDateTime getCreateAt() {
return (LocalDateTime) get(20);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
@Override
public Record1<Integer> key() {
return (Record1) super.key();
}
// -------------------------------------------------------------------------
// Record21 type implementation
// -------------------------------------------------------------------------
@Override
public Row21<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, LocalDateTime, LocalDateTime> fieldsRow() {
return (Row21) super.fieldsRow();
}
@Override
public Row21<Integer, Integer, Integer, Integer, Integer, Integer, Integer, String, String, String, String, String, String, String, String, String, String, String, String, LocalDateTime, LocalDateTime> valuesRow() {
return (Row21) super.valuesRow();
}
@Override
public Field<Integer> field1() {
return DocumentFullText.DOCUMENT_FULL_TEXT.ID;
}
@Override
public Field<Integer> field2() {
return DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_ID;
}
@Override
public Field<Integer> field3() {
return DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_ID;
}
@Override
public Field<Integer> field4() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_DOCUMENT_ID;
}
@Override
public Field<Integer> field5() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_DOCUMENT_VERSION;
}
@Override
public Field<Integer> field6() {
return DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID;
}
@Override
public Field<Integer> field7() {
return DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_COLUMN_DOCUMENT_ID;
}
@Override
public Field<String> field8() {
return DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_NAME;
}
@Override
public Field<String> field9() {
return DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION;
}
@Override
public Field<String> field10() {
return DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_NAME;
}
@Override
public Field<String> field11() {
return DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION;
}
@Override
public Field<String> field12() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_NAME;
}
@Override
public Field<String> field13() {
return DocumentFullText.DOCUMENT_FULL_TEXT.SCHEMA_NAME;
}
@Override
public Field<String> field14() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME;
}
@Override
public Field<String> field15() {
return DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_TYPE;
}
@Override
public Field<String> field16() {
return DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_NAME;
}
@Override
public Field<String> field17() {
return DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_COMMENT;
}
@Override
public Field<String> field18() {
return DocumentFullText.DOCUMENT_FULL_TEXT.COL_NAME;
}
@Override
public Field<String> field19() {
return DocumentFullText.DOCUMENT_FULL_TEXT.COL_COMMENT;
}
@Override
public Field<LocalDateTime> field20() {
return DocumentFullText.DOCUMENT_FULL_TEXT.UPDATE_AT;
}
@Override
public Field<LocalDateTime> field21() {
return DocumentFullText.DOCUMENT_FULL_TEXT.CREATE_AT;
}
@Override
public Integer component1() {
return getId();
}
@Override
public Integer component2() {
return getGroupId();
}
@Override
public Integer component3() {
return getProjectId();
}
@Override
public Integer component4() {
return getDatabaseDocumentId();
}
@Override
public Integer component5() {
return getDatabaseDocumentVersion();
}
@Override
public Integer component6() {
return getTableDocumentId();
}
@Override
public Integer component7() {
return getTableColumnDocumentId();
}
@Override
public String component8() {
return getGroupName();
}
@Override
public String component9() {
return getGroupDescription();
}
@Override
public String component10() {
return getProjectName();
}
@Override
public String component11() {
return getProjectDescription();
}
@Override
public String component12() {
return getDatabaseName();
}
@Override
public String component13() {
return getSchemaName();
}
@Override
public String component14() {
return getDatabaseProductName();
}
@Override
public String component15() {
return getDatabaseType();
}
@Override
public String component16() {
return getTableName();
}
@Override
public String component17() {
return getTableComment();
}
@Override
public String component18() {
return getColName();
}
@Override
public String component19() {
return getColComment();
}
@Override
public LocalDateTime component20() {
return getUpdateAt();
}
@Override
public LocalDateTime component21() {
return getCreateAt();
}
@Override
public Integer value1() {
return getId();
}
@Override
public Integer value2() {
return getGroupId();
}
@Override
public Integer value3() {
return getProjectId();
}
@Override
public Integer value4() {
return getDatabaseDocumentId();
}
@Override
public Integer value5() {
return getDatabaseDocumentVersion();
}
@Override
public Integer value6() {
return getTableDocumentId();
}
@Override
public Integer value7() {
return getTableColumnDocumentId();
}
@Override
public String value8() {
return getGroupName();
}
@Override
public String value9() {
return getGroupDescription();
}
@Override
public String value10() {
return getProjectName();
}
@Override
public String value11() {
return getProjectDescription();
}
@Override
public String value12() {
return getDatabaseName();
}
@Override
public String value13() {
return getSchemaName();
}
@Override
public String value14() {
return getDatabaseProductName();
}
@Override
public String value15() {
return getDatabaseType();
}
@Override
public String value16() {
return getTableName();
}
@Override
public String value17() {
return getTableComment();
}
@Override
public String value18() {
return getColName();
}
@Override
public String value19() {
return getColComment();
}
@Override
public LocalDateTime value20() {
return getUpdateAt();
}
@Override
public LocalDateTime value21() {
return getCreateAt();
}
@Override
public DocumentFullTextRecord value1(Integer value) {
setId(value);
return this;
}
@Override
public DocumentFullTextRecord value2(Integer value) {
setGroupId(value);
return this;
}
@Override
public DocumentFullTextRecord value3(Integer value) {
setProjectId(value);
return this;
}
@Override
public DocumentFullTextRecord value4(Integer value) {
setDatabaseDocumentId(value);
return this;
}
@Override
public DocumentFullTextRecord value5(Integer value) {
setDatabaseDocumentVersion(value);
return this;
}
@Override
public DocumentFullTextRecord value6(Integer value) {
setTableDocumentId(value);
return this;
}
@Override
public DocumentFullTextRecord value7(Integer value) {
setTableColumnDocumentId(value);
return this;
}
@Override
public DocumentFullTextRecord value8(String value) {
setGroupName(value);
return this;
}
@Override
public DocumentFullTextRecord value9(String value) {
setGroupDescription(value);
return this;
}
@Override
public DocumentFullTextRecord value10(String value) {
setProjectName(value);
return this;
}
@Override
public DocumentFullTextRecord value11(String value) {
setProjectDescription(value);
return this;
}
@Override
public DocumentFullTextRecord value12(String value) {
setDatabaseName(value);
return this;
}
@Override
public DocumentFullTextRecord value13(String value) {
setSchemaName(value);
return this;
}
@Override
public DocumentFullTextRecord value14(String value) {
setDatabaseProductName(value);
return this;
}
@Override
public DocumentFullTextRecord value15(String value) {
setDatabaseType(value);
return this;
}
@Override
public DocumentFullTextRecord value16(String value) {
setTableName(value);
return this;
}
@Override
public DocumentFullTextRecord value17(String value) {
setTableComment(value);
return this;
}
@Override
public DocumentFullTextRecord value18(String value) {
setColName(value);
return this;
}
@Override
public DocumentFullTextRecord value19(String value) {
setColComment(value);
return this;
}
@Override
public DocumentFullTextRecord value20(LocalDateTime value) {
setUpdateAt(value);
return this;
}
@Override
public DocumentFullTextRecord value21(LocalDateTime value) {
setCreateAt(value);
return this;
}
@Override
public DocumentFullTextRecord values(Integer value1, Integer value2, Integer value3, Integer value4, Integer value5, Integer value6, Integer value7, String value8, String value9, String value10, String value11, String value12, String value13, String value14, String value15, String value16, String value17, String value18, String value19, LocalDateTime value20, LocalDateTime value21) {
value1(value1);
value2(value2);
value3(value3);
value4(value4);
value5(value5);
value6(value6);
value7(value7);
value8(value8);
value9(value9);
value10(value10);
value11(value11);
value12(value12);
value13(value13);
value14(value14);
value15(value15);
value16(value16);
value17(value17);
value18(value18);
value19(value19);
value20(value20);
value21(value21);
return this;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* 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 colName, String colComment, 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);
setColName(colName);
setColComment(colComment);
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());
setColName(value.getColName());
setColComment(value.getColComment());
setUpdateAt(value.getUpdateAt());
setCreateAt(value.getCreateAt());
}
}
}

View File

@ -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();
}

View File

@ -0,0 +1,201 @@
package com.databasir.dao.impl;
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[] fullTextMatchCols = new String[]{
DOCUMENT_FULL_TEXT.COL_NAME.getName(),
DOCUMENT_FULL_TEXT.COL_COMMENT.getName(),
DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME.getName()
};
String colSegment = String.join(",", fullTextMatchCols);
// 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 = new String[]{
DOCUMENT_FULL_TEXT.TABLE_NAME.getName(),
DOCUMENT_FULL_TEXT.TABLE_COMMENT.getName(),
DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME.getName()
};
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,
};
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 = new String[]{
DOCUMENT_FULL_TEXT.PROJECT_NAME.getName(),
DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION.getName(),
DOCUMENT_FULL_TEXT.SCHEMA_NAME.getName(),
DOCUMENT_FULL_TEXT.DATABASE_NAME.getName(),
DOCUMENT_FULL_TEXT.DATABASE_TYPE.getName(),
};
String 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 = new String[]{
DOCUMENT_FULL_TEXT.GROUP_NAME.getName(),
DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION.getName()
};
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();
}
}

View File

@ -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();
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -0,0 +1,55 @@
-- 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

View File

@ -0,0 +1,33 @@
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;

@ -1 +1 @@
Subproject commit f67d6b70df557fe7f156c23c5b81922bd2fab404
Subproject commit 7c6bacd74e5a82e754afa4ea26d648e491e5f129