refactor: redesign document history model
This commit is contained in:
parent
fca7bd788e
commit
6a3c5fe311
|
@ -3,6 +3,7 @@ package com.databasir.api;
|
||||||
import com.databasir.common.JsonData;
|
import com.databasir.common.JsonData;
|
||||||
import com.databasir.common.SystemException;
|
import com.databasir.common.SystemException;
|
||||||
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
|
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
|
||||||
|
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
|
||||||
import com.databasir.core.domain.document.data.DatabaseDocumentVersionResponse;
|
import com.databasir.core.domain.document.data.DatabaseDocumentVersionResponse;
|
||||||
import com.databasir.core.domain.document.service.DocumentService;
|
import com.databasir.core.domain.document.service.DocumentService;
|
||||||
import com.databasir.core.domain.log.annotation.Operation;
|
import com.databasir.core.domain.log.annotation.Operation;
|
||||||
|
@ -54,7 +55,7 @@ public class DocumentController {
|
||||||
@PageableDefault(sort = "id",
|
@PageableDefault(sort = "id",
|
||||||
direction = DESC)
|
direction = DESC)
|
||||||
Pageable page) {
|
Pageable page) {
|
||||||
return JsonData.ok(documentService.getVersionsBySchemaSourceId(projectId, page));
|
return JsonData.ok(documentService.getVersionsByProjectId(projectId, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(Routes.Document.EXPORT)
|
@GetMapping(Routes.Document.EXPORT)
|
||||||
|
@ -79,4 +80,16 @@ public class DocumentController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(Routes.Document.GET_SIMPLE_ONE)
|
||||||
|
public JsonData<DatabaseDocumentSimpleResponse> getSimpleByProjectId(@PathVariable Integer projectId,
|
||||||
|
@RequestParam(required = false) Long version) {
|
||||||
|
return JsonData.ok(documentService.getSimpleOneByProjectId(projectId, version));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(Routes.Document.GET_TABLE_DETAIL)
|
||||||
|
public JsonData<DatabaseDocumentResponse.TableDocumentResponse> getTableDocument(@PathVariable Integer projectId,
|
||||||
|
@PathVariable Integer tableId) {
|
||||||
|
return JsonData.ok(documentService.getTableDetails(projectId, tableId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,10 @@ public interface Routes {
|
||||||
|
|
||||||
String LIST_VERSIONS = BASE + "/projects/{projectId}/document_versions";
|
String LIST_VERSIONS = BASE + "/projects/{projectId}/document_versions";
|
||||||
|
|
||||||
|
String GET_SIMPLE_ONE = BASE + "/projects/{projectId}/documents/simple";
|
||||||
|
|
||||||
|
String GET_TABLE_DETAIL = BASE + "/projects/{projectId}/table_documents/{tableId}";
|
||||||
|
|
||||||
String EXPORT = BASE + "/projects/{projectId}/document_files";
|
String EXPORT = BASE + "/projects/{projectId}/document_files";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.databasir.core.domain.document.converter;
|
|
||||||
|
|
||||||
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
|
|
||||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
|
||||||
import com.databasir.dao.tables.pojos.DatabaseDocumentHistoryPojo;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.Mapping;
|
|
||||||
import org.mapstruct.ReportingPolicy;
|
|
||||||
|
|
||||||
@Mapper(componentModel = "spring", uses = JsonConverter.class, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
|
||||||
public interface DocumentHistoryPojoConverter {
|
|
||||||
|
|
||||||
@Mapping(target = "databaseDocumentObject", source = "databaseMetaObject")
|
|
||||||
@Mapping(target = "id", ignore = true)
|
|
||||||
@Mapping(target = "createAt", ignore = true)
|
|
||||||
DatabaseDocumentHistoryPojo of(DatabaseDocumentResponse databaseMetaObject,
|
|
||||||
Integer projectId,
|
|
||||||
Integer databaseDocumentId,
|
|
||||||
Long version);
|
|
||||||
}
|
|
|
@ -16,16 +16,11 @@ import java.util.stream.Collectors;
|
||||||
public interface DocumentPojoConverter extends BaseConverter {
|
public interface DocumentPojoConverter extends BaseConverter {
|
||||||
|
|
||||||
@Mapping(target = "databaseName", source = "meta.databaseName")
|
@Mapping(target = "databaseName", source = "meta.databaseName")
|
||||||
|
@Mapping(target = "isArchive", constant = "false")
|
||||||
DatabaseDocumentPojo toDatabasePojo(Integer projectId,
|
DatabaseDocumentPojo toDatabasePojo(Integer projectId,
|
||||||
com.databasir.core.meta.data.DatabaseMeta meta,
|
com.databasir.core.meta.data.DatabaseMeta meta,
|
||||||
Long version);
|
Long version);
|
||||||
|
|
||||||
@Mapping(target = "databaseName", source = "meta.databaseName")
|
|
||||||
DatabaseDocumentPojo toDatabasePojo(Integer projectId,
|
|
||||||
com.databasir.core.meta.data.DatabaseMeta meta,
|
|
||||||
Integer id,
|
|
||||||
Long version);
|
|
||||||
|
|
||||||
@Mapping(target = "comment", qualifiedBy = NullToEmpty.class)
|
@Mapping(target = "comment", qualifiedBy = NullToEmpty.class)
|
||||||
TableDocumentPojo toTablePojo(Integer databaseDocumentId,
|
TableDocumentPojo toTablePojo(Integer databaseDocumentId,
|
||||||
com.databasir.core.meta.data.TableMeta meta);
|
com.databasir.core.meta.data.TableMeta meta);
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.databasir.core.domain.document.converter;
|
||||||
|
|
||||||
|
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
|
||||||
|
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||||
|
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
|
||||||
|
import com.databasir.dao.tables.pojos.TableDocumentPojo;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper(componentModel = "spring", uses = JsonConverter.class, unmappedTargetPolicy = ReportingPolicy.WARN)
|
||||||
|
public interface DocumentSimpleResponseConverter {
|
||||||
|
|
||||||
|
@Mapping(target = "id", source = "databaseDocument.id")
|
||||||
|
@Mapping(target = "createAt", source = "databaseDocument.createAt")
|
||||||
|
@Mapping(target = "documentVersion", source = "databaseDocument.version")
|
||||||
|
DatabaseDocumentSimpleResponse of(DatabaseDocumentPojo databaseDocument,
|
||||||
|
List<TableDocumentPojo> tables);
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.databasir.core.domain.document.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DatabaseDocumentSimpleResponse {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String databaseName;
|
||||||
|
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
private String productVersion;
|
||||||
|
|
||||||
|
private Integer documentVersion;
|
||||||
|
|
||||||
|
private List<TableData> tables = new ArrayList<>();
|
||||||
|
|
||||||
|
private LocalDateTime createAt;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class TableData {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String comment;
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,6 +13,8 @@ import java.time.LocalDateTime;
|
||||||
@Builder
|
@Builder
|
||||||
public class DatabaseDocumentVersionResponse {
|
public class DatabaseDocumentVersionResponse {
|
||||||
|
|
||||||
|
private Integer databaseDocumentId;
|
||||||
|
|
||||||
private Long version;
|
private Long version;
|
||||||
|
|
||||||
private LocalDateTime createAt;
|
private LocalDateTime createAt;
|
||||||
|
|
|
@ -3,10 +3,11 @@ package com.databasir.core.domain.document.service;
|
||||||
import com.databasir.core.Databasir;
|
import com.databasir.core.Databasir;
|
||||||
import com.databasir.core.DatabasirConfig;
|
import com.databasir.core.DatabasirConfig;
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.document.converter.DocumentHistoryPojoConverter;
|
|
||||||
import com.databasir.core.domain.document.converter.DocumentPojoConverter;
|
import com.databasir.core.domain.document.converter.DocumentPojoConverter;
|
||||||
import com.databasir.core.domain.document.converter.DocumentResponseConverter;
|
import com.databasir.core.domain.document.converter.DocumentResponseConverter;
|
||||||
|
import com.databasir.core.domain.document.converter.DocumentSimpleResponseConverter;
|
||||||
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
|
import com.databasir.core.domain.document.data.DatabaseDocumentResponse;
|
||||||
|
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
|
||||||
import com.databasir.core.domain.document.data.DatabaseDocumentVersionResponse;
|
import com.databasir.core.domain.document.data.DatabaseDocumentVersionResponse;
|
||||||
import com.databasir.core.infrastructure.connection.DatabaseConnectionService;
|
import com.databasir.core.infrastructure.connection.DatabaseConnectionService;
|
||||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||||
|
@ -53,30 +54,28 @@ public class DocumentService {
|
||||||
|
|
||||||
private final TableTriggerDocumentDao tableTriggerDocumentDao;
|
private final TableTriggerDocumentDao tableTriggerDocumentDao;
|
||||||
|
|
||||||
private final DatabaseDocumentHistoryDao databaseDocumentHistoryDao;
|
|
||||||
|
|
||||||
private final DocumentPojoConverter documentPojoConverter;
|
private final DocumentPojoConverter documentPojoConverter;
|
||||||
|
|
||||||
private final DocumentResponseConverter documentResponseConverter;
|
private final DocumentResponseConverter documentResponseConverter;
|
||||||
|
|
||||||
private final DocumentHistoryPojoConverter documentHistoryPojoConverter;
|
private final DocumentSimpleResponseConverter documentSimpleResponseConverter;
|
||||||
|
|
||||||
private final JsonConverter jsonConverter;
|
private final JsonConverter jsonConverter;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void syncByProjectId(Integer projectId) {
|
public void syncByProjectId(Integer projectId) {
|
||||||
ProjectPojo project = projectDao.selectOptionalById(projectId)
|
projectDao.selectOptionalById(projectId)
|
||||||
.orElseThrow(DomainErrors.PROJECT_NOT_FOUND::exception);
|
.orElseThrow(DomainErrors.PROJECT_NOT_FOUND::exception);
|
||||||
DatabaseMeta meta = retrieveDatabaseMeta(projectId);
|
DatabaseMeta meta = retrieveDatabaseMeta(projectId);
|
||||||
Optional<DatabaseDocumentPojo> historyDocumentOpt = databaseDocumentDao.selectOptionalByProjectId(projectId);
|
Optional<DatabaseDocumentPojo> latestDocumentOpt = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
||||||
if (historyDocumentOpt.isPresent()) {
|
if (latestDocumentOpt.isPresent()) {
|
||||||
DatabaseDocumentPojo historyDocument = historyDocumentOpt.get();
|
DatabaseDocumentPojo latestDocument = latestDocumentOpt.get();
|
||||||
Integer previousDocumentId = historyDocument.getId();
|
Integer previousDocumentId = latestDocument.getId();
|
||||||
saveAsHistory(historyDocument);
|
// archive old version
|
||||||
deleteDeprecatedDocument(previousDocumentId);
|
databaseDocumentDao.updateIsArchiveById(previousDocumentId, true);
|
||||||
saveNewDocument(meta, historyDocument.getVersion() + 1, historyDocument.getProjectId(), previousDocumentId);
|
saveNewDocument(meta, latestDocument.getVersion() + 1, latestDocument.getProjectId());
|
||||||
} else {
|
} else {
|
||||||
saveNewDocument(meta, 1L, projectId, null);
|
saveNewDocument(meta, 1L, projectId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,42 +92,12 @@ public class DocumentService {
|
||||||
.orElseThrow(DomainErrors.DATABASE_META_NOT_FOUND::exception);
|
.orElseThrow(DomainErrors.DATABASE_META_NOT_FOUND::exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveAsHistory(DatabaseDocumentPojo databaseDocument) {
|
|
||||||
// save history
|
|
||||||
Integer projectId = databaseDocument.getProjectId();
|
|
||||||
Integer databaseMetaId = databaseDocument.getId();
|
|
||||||
DatabaseDocumentResponse databaseDocumentResponse = getOneByProjectId(projectId, null).orElse(null);
|
|
||||||
Long currVersion = databaseDocument.getVersion();
|
|
||||||
DatabaseDocumentHistoryPojo documentHistoryPojo =
|
|
||||||
documentHistoryPojoConverter.of(databaseDocumentResponse, projectId, databaseMetaId, currVersion);
|
|
||||||
databaseDocumentHistoryDao.insertAndReturnId(documentHistoryPojo);
|
|
||||||
log.info("save old meta info to history success");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void deleteDeprecatedDocument(Integer databaseDocumentId) {
|
|
||||||
// delete old meta info
|
|
||||||
tableDocumentDao.deleteByDatabaseDocumentId(databaseDocumentId);
|
|
||||||
tableColumnDocumentDao.deleteByDatabaseDocumentId(databaseDocumentId);
|
|
||||||
tableIndexDocumentDao.deleteByDatabaseMetaId(databaseDocumentId);
|
|
||||||
tableTriggerDocumentDao.deleteByDatabaseDocumentId(databaseDocumentId);
|
|
||||||
log.info("delete old meta info success");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveNewDocument(DatabaseMeta meta,
|
private void saveNewDocument(DatabaseMeta meta,
|
||||||
Long version,
|
Long version,
|
||||||
Integer projectId,
|
Integer projectId) {
|
||||||
Integer databaseDocumentId) {
|
|
||||||
|
|
||||||
Integer currentDatabaseDocumentId = databaseDocumentId;
|
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, version);
|
||||||
if (databaseDocumentId == null) {
|
final Integer docId = databaseDocumentDao.insertAndReturnId(pojo);
|
||||||
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, 1L);
|
|
||||||
currentDatabaseDocumentId = databaseDocumentDao.insertAndReturnId(pojo);
|
|
||||||
} else {
|
|
||||||
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, databaseDocumentId, version);
|
|
||||||
databaseDocumentDao.update(pojo);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Integer docId = currentDatabaseDocumentId;
|
|
||||||
meta.getTables().forEach(table -> {
|
meta.getTables().forEach(table -> {
|
||||||
TableDocumentPojo tableMeta =
|
TableDocumentPojo tableMeta =
|
||||||
documentPojoConverter.toTablePojo(docId, table);
|
documentPojoConverter.toTablePojo(docId, table);
|
||||||
|
@ -143,55 +112,100 @@ public class DocumentService {
|
||||||
documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
|
documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
|
||||||
tableTriggerDocumentDao.batchInsert(tableTriggerMetas);
|
tableTriggerDocumentDao.batchInsert(tableTriggerMetas);
|
||||||
});
|
});
|
||||||
log.info("save new meta info success");
|
log.info("save new version document success: projectId = {}, name = {}, version = {}",
|
||||||
|
projectId, meta.getDatabaseName(), version);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<DatabaseDocumentResponse> getOneByProjectId(Integer projectId, Long version) {
|
public Optional<DatabaseDocumentSimpleResponse> getSimpleOneByProjectId(Integer projectId, Long version) {
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
return databaseDocumentDao.selectOptionalByProjectId(projectId)
|
return databaseDocumentDao.selectNotArchivedByProjectId(projectId)
|
||||||
.map(document -> {
|
.map(document -> {
|
||||||
Integer id = document.getId();
|
Integer id = document.getId();
|
||||||
var tables = tableDocumentDao.selectByDatabaseDocumentId(id);
|
var tables = tableDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
var columns = tableColumnDocumentDao.selectByDatabaseDocumentId(id);
|
return documentSimpleResponseConverter.of(document, tables);
|
||||||
var indexes = tableIndexDocumentDao.selectByDatabaseMetaId(id);
|
|
||||||
var triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(id);
|
|
||||||
Map<Integer, List<TableColumnDocumentPojo>> columnsGroupByTableMetaId = columns.stream()
|
|
||||||
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
|
|
||||||
Map<Integer, List<TableIndexDocumentPojo>> indexesGroupByTableMetaId = indexes.stream()
|
|
||||||
.collect(Collectors.groupingBy(TableIndexDocumentPojo::getTableDocumentId));
|
|
||||||
Map<Integer, List<TableTriggerDocumentPojo>> triggersGroupByTableMetaId = triggers.stream()
|
|
||||||
.collect(Collectors.groupingBy(TableTriggerDocumentPojo::getTableDocumentId));
|
|
||||||
var tableDocumentResponseList = tables.stream()
|
|
||||||
.map(table -> {
|
|
||||||
Integer tableId = table.getId();
|
|
||||||
var subColumns =
|
|
||||||
columnsGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
|
||||||
var subIndexes =
|
|
||||||
indexesGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
|
||||||
var subTriggers =
|
|
||||||
triggersGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
|
||||||
return documentResponseConverter.of(table, subColumns, subIndexes, subTriggers);
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
return documentResponseConverter.of(document, tableDocumentResponseList);
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return databaseDocumentHistoryDao.selectOptionalByProjectIdAndVersion(projectId, version)
|
return databaseDocumentDao.selectOptionalByProjectIdAndVersion(projectId, version)
|
||||||
.map(obj -> jsonConverter.of(obj.getDatabaseDocumentObject()));
|
.map(document -> {
|
||||||
|
Integer id = document.getId();
|
||||||
|
var tables = tableDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
|
return documentSimpleResponseConverter.of(document, tables);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<DatabaseDocumentVersionResponse> getVersionsBySchemaSourceId(Integer projectId, Pageable page) {
|
public Optional<DatabaseDocumentResponse> getOneByProjectId(Integer projectId, Long version) {
|
||||||
return databaseDocumentDao.selectOptionalByProjectId(projectId)
|
|
||||||
.map(schemaMeta ->
|
Optional<DatabaseDocumentPojo> documentOption;
|
||||||
databaseDocumentHistoryDao.selectVersionPageByDatabaseDocumentId(page, schemaMeta.getId())
|
if (version == null) {
|
||||||
|
documentOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
||||||
|
} else {
|
||||||
|
documentOption = databaseDocumentDao.selectOptionalByProjectIdAndVersion(projectId, version);
|
||||||
|
}
|
||||||
|
return documentOption.map(document -> {
|
||||||
|
Integer id = document.getId();
|
||||||
|
var tables = tableDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
|
var columns = tableColumnDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
|
var indexes = tableIndexDocumentDao.selectByDatabaseMetaId(id);
|
||||||
|
var triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
|
Map<Integer, List<TableColumnDocumentPojo>> columnsGroupByTableMetaId = columns.stream()
|
||||||
|
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
|
||||||
|
Map<Integer, List<TableIndexDocumentPojo>> indexesGroupByTableMetaId = indexes.stream()
|
||||||
|
.collect(Collectors.groupingBy(TableIndexDocumentPojo::getTableDocumentId));
|
||||||
|
Map<Integer, List<TableTriggerDocumentPojo>> triggersGroupByTableMetaId = triggers.stream()
|
||||||
|
.collect(Collectors.groupingBy(TableTriggerDocumentPojo::getTableDocumentId));
|
||||||
|
var tableDocumentResponseList = tables.stream()
|
||||||
|
.map(table -> {
|
||||||
|
Integer tableId = table.getId();
|
||||||
|
var subColumns = columnsGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
|
var subIndexes = indexesGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
|
var subTriggers = triggersGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
|
return documentResponseConverter.of(table, subColumns, subIndexes, subTriggers);
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return documentResponseConverter.of(document, tableDocumentResponseList);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<DatabaseDocumentVersionResponse> getVersionsByProjectId(Integer projectId, Pageable page) {
|
||||||
|
return databaseDocumentDao.selectNotArchivedByProjectId(projectId)
|
||||||
|
.map(databaseDocument ->
|
||||||
|
databaseDocumentDao.selectVersionPageByProjectId(page, projectId)
|
||||||
.map(history -> DatabaseDocumentVersionResponse.builder()
|
.map(history -> DatabaseDocumentVersionResponse.builder()
|
||||||
|
.databaseDocumentId(history.getId())
|
||||||
.version(history.getVersion())
|
.version(history.getVersion())
|
||||||
.createAt(history.getCreateAt())
|
.createAt(history.getCreateAt())
|
||||||
.build()))
|
.build()))
|
||||||
.orElseGet(Page::empty);
|
.orElseGet(Page::empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<DatabaseDocumentResponse.TableDocumentResponse> getTableDetails(Integer projectId,
|
||||||
|
Integer tableId) {
|
||||||
|
// maybe deleted
|
||||||
|
if (!projectDao.existsById(projectId)) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tableDocumentDao.selectOptionalById(tableId)
|
||||||
|
.map(table -> {
|
||||||
|
Integer documentId = table.getDatabaseDocumentId();
|
||||||
|
var columns = tableColumnDocumentDao.selectByDatabaseDocumentId(documentId);
|
||||||
|
var indexes = tableIndexDocumentDao.selectByDatabaseMetaId(documentId);
|
||||||
|
var triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(documentId);
|
||||||
|
Map<Integer, List<TableColumnDocumentPojo>> columnsGroupByTableMetaId = columns.stream()
|
||||||
|
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
|
||||||
|
Map<Integer, List<TableIndexDocumentPojo>> indexesGroupByTableMetaId = indexes.stream()
|
||||||
|
.collect(Collectors.groupingBy(TableIndexDocumentPojo::getTableDocumentId));
|
||||||
|
Map<Integer, List<TableTriggerDocumentPojo>> triggersGroupByTableMetaId = triggers.stream()
|
||||||
|
.collect(Collectors.groupingBy(TableTriggerDocumentPojo::getTableDocumentId));
|
||||||
|
var subColumns = columnsGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
|
var subIndexes = indexesGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
|
var subTriggers = triggersGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
|
return documentResponseConverter.of(table, subColumns, subIndexes, subTriggers);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public Optional<String> toMarkdown(Integer projectId, Long version) {
|
public Optional<String> toMarkdown(Integer projectId, Long version) {
|
||||||
return getOneByProjectId(projectId, version)
|
return getOneByProjectId(projectId, version)
|
||||||
.map(doc -> {
|
.map(doc -> {
|
||||||
|
|
|
@ -4,11 +4,19 @@ import com.databasir.core.domain.group.data.GroupCreateRequest;
|
||||||
import com.databasir.core.domain.group.data.GroupUpdateRequest;
|
import com.databasir.core.domain.group.data.GroupUpdateRequest;
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
import com.databasir.dao.tables.pojos.GroupPojo;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface GroupPojoConverter {
|
public interface GroupPojoConverter {
|
||||||
|
|
||||||
|
@Mapping(target = "id", ignore = true)
|
||||||
|
@Mapping(target = "deleted", ignore = true)
|
||||||
|
@Mapping(target = "createAt", ignore = true)
|
||||||
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
GroupPojo of(GroupCreateRequest groupCreateRequest);
|
GroupPojo of(GroupCreateRequest groupCreateRequest);
|
||||||
|
|
||||||
|
@Mapping(target = "deleted", ignore = true)
|
||||||
|
@Mapping(target = "createAt", ignore = true)
|
||||||
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
GroupPojo of(GroupUpdateRequest groupUpdateRequest);
|
GroupPojo of(GroupUpdateRequest groupUpdateRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ package com.databasir.dao;
|
||||||
import com.databasir.dao.tables.DataSource;
|
import com.databasir.dao.tables.DataSource;
|
||||||
import com.databasir.dao.tables.DataSourceProperty;
|
import com.databasir.dao.tables.DataSourceProperty;
|
||||||
import com.databasir.dao.tables.DatabaseDocument;
|
import com.databasir.dao.tables.DatabaseDocument;
|
||||||
import com.databasir.dao.tables.DatabaseDocumentHistory;
|
|
||||||
import com.databasir.dao.tables.DocumentRemark;
|
import com.databasir.dao.tables.DocumentRemark;
|
||||||
import com.databasir.dao.tables.Group;
|
import com.databasir.dao.tables.Group;
|
||||||
import com.databasir.dao.tables.Login;
|
import com.databasir.dao.tables.Login;
|
||||||
|
@ -61,11 +60,6 @@ public class Databasir extends SchemaImpl {
|
||||||
*/
|
*/
|
||||||
public final DatabaseDocument DATABASE_DOCUMENT = DatabaseDocument.DATABASE_DOCUMENT;
|
public final DatabaseDocument DATABASE_DOCUMENT = DatabaseDocument.DATABASE_DOCUMENT;
|
||||||
|
|
||||||
/**
|
|
||||||
* The table <code>databasir.database_document_history</code>.
|
|
||||||
*/
|
|
||||||
public final DatabaseDocumentHistory DATABASE_DOCUMENT_HISTORY = DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.document_remark</code>.
|
* The table <code>databasir.document_remark</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -165,7 +159,6 @@ public class Databasir extends SchemaImpl {
|
||||||
DataSource.DATA_SOURCE,
|
DataSource.DATA_SOURCE,
|
||||||
DataSourceProperty.DATA_SOURCE_PROPERTY,
|
DataSourceProperty.DATA_SOURCE_PROPERTY,
|
||||||
DatabaseDocument.DATABASE_DOCUMENT,
|
DatabaseDocument.DATABASE_DOCUMENT,
|
||||||
DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY,
|
|
||||||
DocumentRemark.DOCUMENT_REMARK,
|
DocumentRemark.DOCUMENT_REMARK,
|
||||||
Group.GROUP,
|
Group.GROUP,
|
||||||
Login.LOGIN,
|
Login.LOGIN,
|
||||||
|
|
|
@ -5,7 +5,7 @@ package com.databasir.dao;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.dao.tables.DataSourceProperty;
|
import com.databasir.dao.tables.DataSourceProperty;
|
||||||
import com.databasir.dao.tables.DatabaseDocumentHistory;
|
import com.databasir.dao.tables.DatabaseDocument;
|
||||||
import com.databasir.dao.tables.DocumentRemark;
|
import com.databasir.dao.tables.DocumentRemark;
|
||||||
import com.databasir.dao.tables.TableColumnDocument;
|
import com.databasir.dao.tables.TableColumnDocument;
|
||||||
import com.databasir.dao.tables.TableDocument;
|
import com.databasir.dao.tables.TableDocument;
|
||||||
|
@ -33,7 +33,7 @@ public class Indexes {
|
||||||
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_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_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_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 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 DATABASE_DOCUMENT_HISTORY_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY, new OrderField[] { DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.PROJECT_ID }, false);
|
public static final Index DATABASE_DOCUMENT_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DatabaseDocument.DATABASE_DOCUMENT, new OrderField[] { DatabaseDocument.DATABASE_DOCUMENT.PROJECT_ID }, false);
|
||||||
public static final Index DOCUMENT_REMARK_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DocumentRemark.DOCUMENT_REMARK, new OrderField[] { DocumentRemark.DOCUMENT_REMARK.PROJECT_ID }, false);
|
public static final Index DOCUMENT_REMARK_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DocumentRemark.DOCUMENT_REMARK, new OrderField[] { DocumentRemark.DOCUMENT_REMARK.PROJECT_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_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_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);
|
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);
|
||||||
|
|
|
@ -7,7 +7,6 @@ package com.databasir.dao;
|
||||||
import com.databasir.dao.tables.DataSource;
|
import com.databasir.dao.tables.DataSource;
|
||||||
import com.databasir.dao.tables.DataSourceProperty;
|
import com.databasir.dao.tables.DataSourceProperty;
|
||||||
import com.databasir.dao.tables.DatabaseDocument;
|
import com.databasir.dao.tables.DatabaseDocument;
|
||||||
import com.databasir.dao.tables.DatabaseDocumentHistory;
|
|
||||||
import com.databasir.dao.tables.DocumentRemark;
|
import com.databasir.dao.tables.DocumentRemark;
|
||||||
import com.databasir.dao.tables.Group;
|
import com.databasir.dao.tables.Group;
|
||||||
import com.databasir.dao.tables.Login;
|
import com.databasir.dao.tables.Login;
|
||||||
|
@ -26,7 +25,6 @@ import com.databasir.dao.tables.UserFavoriteProject;
|
||||||
import com.databasir.dao.tables.UserRole;
|
import com.databasir.dao.tables.UserRole;
|
||||||
import com.databasir.dao.tables.records.DataSourcePropertyRecord;
|
import com.databasir.dao.tables.records.DataSourcePropertyRecord;
|
||||||
import com.databasir.dao.tables.records.DataSourceRecord;
|
import com.databasir.dao.tables.records.DataSourceRecord;
|
||||||
import com.databasir.dao.tables.records.DatabaseDocumentHistoryRecord;
|
|
||||||
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
||||||
import com.databasir.dao.tables.records.DocumentRemarkRecord;
|
import com.databasir.dao.tables.records.DocumentRemarkRecord;
|
||||||
import com.databasir.dao.tables.records.GroupRecord;
|
import com.databasir.dao.tables.records.GroupRecord;
|
||||||
|
@ -66,9 +64,6 @@ public class Keys {
|
||||||
public static final UniqueKey<DataSourceRecord> KEY_DATA_SOURCE_UK_PROJECT_ID = Internal.createUniqueKey(DataSource.DATA_SOURCE, DSL.name("KEY_data_source_uk_project_id"), new TableField[] { DataSource.DATA_SOURCE.PROJECT_ID }, true);
|
public static final UniqueKey<DataSourceRecord> KEY_DATA_SOURCE_UK_PROJECT_ID = Internal.createUniqueKey(DataSource.DATA_SOURCE, DSL.name("KEY_data_source_uk_project_id"), new TableField[] { DataSource.DATA_SOURCE.PROJECT_ID }, true);
|
||||||
public static final UniqueKey<DataSourcePropertyRecord> KEY_DATA_SOURCE_PROPERTY_PRIMARY = Internal.createUniqueKey(DataSourceProperty.DATA_SOURCE_PROPERTY, DSL.name("KEY_data_source_property_PRIMARY"), new TableField[] { DataSourceProperty.DATA_SOURCE_PROPERTY.ID }, true);
|
public static final UniqueKey<DataSourcePropertyRecord> KEY_DATA_SOURCE_PROPERTY_PRIMARY = Internal.createUniqueKey(DataSourceProperty.DATA_SOURCE_PROPERTY, DSL.name("KEY_data_source_property_PRIMARY"), new TableField[] { DataSourceProperty.DATA_SOURCE_PROPERTY.ID }, true);
|
||||||
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_PRIMARY = Internal.createUniqueKey(DatabaseDocument.DATABASE_DOCUMENT, DSL.name("KEY_database_document_PRIMARY"), new TableField[] { DatabaseDocument.DATABASE_DOCUMENT.ID }, true);
|
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_PRIMARY = Internal.createUniqueKey(DatabaseDocument.DATABASE_DOCUMENT, DSL.name("KEY_database_document_PRIMARY"), new TableField[] { DatabaseDocument.DATABASE_DOCUMENT.ID }, true);
|
||||||
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_UK_PROJECT_ID = Internal.createUniqueKey(DatabaseDocument.DATABASE_DOCUMENT, DSL.name("KEY_database_document_uk_project_id"), new TableField[] { DatabaseDocument.DATABASE_DOCUMENT.PROJECT_ID }, true);
|
|
||||||
public static final UniqueKey<DatabaseDocumentHistoryRecord> KEY_DATABASE_DOCUMENT_HISTORY_PRIMARY = Internal.createUniqueKey(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY, DSL.name("KEY_database_document_history_PRIMARY"), new TableField[] { DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.ID }, true);
|
|
||||||
public static final UniqueKey<DatabaseDocumentHistoryRecord> KEY_DATABASE_DOCUMENT_HISTORY_UK_CONNECTION_ID_VERSION = Internal.createUniqueKey(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY, DSL.name("KEY_database_document_history_uk_connection_id_version"), new TableField[] { DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID, DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.VERSION }, true);
|
|
||||||
public static final UniqueKey<DocumentRemarkRecord> KEY_DOCUMENT_REMARK_PRIMARY = Internal.createUniqueKey(DocumentRemark.DOCUMENT_REMARK, DSL.name("KEY_document_remark_PRIMARY"), new TableField[] { DocumentRemark.DOCUMENT_REMARK.ID }, true);
|
public static final UniqueKey<DocumentRemarkRecord> KEY_DOCUMENT_REMARK_PRIMARY = Internal.createUniqueKey(DocumentRemark.DOCUMENT_REMARK, DSL.name("KEY_document_remark_PRIMARY"), new TableField[] { DocumentRemark.DOCUMENT_REMARK.ID }, true);
|
||||||
public static final UniqueKey<GroupRecord> KEY_GROUP_PRIMARY = Internal.createUniqueKey(Group.GROUP, DSL.name("KEY_group_PRIMARY"), new TableField[] { Group.GROUP.ID }, true);
|
public static final UniqueKey<GroupRecord> KEY_GROUP_PRIMARY = Internal.createUniqueKey(Group.GROUP, DSL.name("KEY_group_PRIMARY"), new TableField[] { Group.GROUP.ID }, true);
|
||||||
public static final UniqueKey<LoginRecord> KEY_LOGIN_PRIMARY = Internal.createUniqueKey(Login.LOGIN, DSL.name("KEY_login_PRIMARY"), new TableField[] { Login.LOGIN.ID }, true);
|
public static final UniqueKey<LoginRecord> KEY_LOGIN_PRIMARY = Internal.createUniqueKey(Login.LOGIN, DSL.name("KEY_login_PRIMARY"), new TableField[] { Login.LOGIN.ID }, true);
|
||||||
|
|
|
@ -7,7 +7,6 @@ package com.databasir.dao;
|
||||||
import com.databasir.dao.tables.DataSource;
|
import com.databasir.dao.tables.DataSource;
|
||||||
import com.databasir.dao.tables.DataSourceProperty;
|
import com.databasir.dao.tables.DataSourceProperty;
|
||||||
import com.databasir.dao.tables.DatabaseDocument;
|
import com.databasir.dao.tables.DatabaseDocument;
|
||||||
import com.databasir.dao.tables.DatabaseDocumentHistory;
|
|
||||||
import com.databasir.dao.tables.DocumentRemark;
|
import com.databasir.dao.tables.DocumentRemark;
|
||||||
import com.databasir.dao.tables.Group;
|
import com.databasir.dao.tables.Group;
|
||||||
import com.databasir.dao.tables.Login;
|
import com.databasir.dao.tables.Login;
|
||||||
|
@ -47,11 +46,6 @@ public class Tables {
|
||||||
*/
|
*/
|
||||||
public static final DatabaseDocument DATABASE_DOCUMENT = DatabaseDocument.DATABASE_DOCUMENT;
|
public static final DatabaseDocument DATABASE_DOCUMENT = DatabaseDocument.DATABASE_DOCUMENT;
|
||||||
|
|
||||||
/**
|
|
||||||
* The table <code>databasir.database_document_history</code>.
|
|
||||||
*/
|
|
||||||
public static final DatabaseDocumentHistory DATABASE_DOCUMENT_HISTORY = DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.document_remark</code>.
|
* The table <code>databasir.document_remark</code>.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,6 +5,7 @@ package com.databasir.dao.tables;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.dao.Databasir;
|
import com.databasir.dao.Databasir;
|
||||||
|
import com.databasir.dao.Indexes;
|
||||||
import com.databasir.dao.Keys;
|
import com.databasir.dao.Keys;
|
||||||
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ import java.util.List;
|
||||||
import org.jooq.Field;
|
import org.jooq.Field;
|
||||||
import org.jooq.ForeignKey;
|
import org.jooq.ForeignKey;
|
||||||
import org.jooq.Identity;
|
import org.jooq.Identity;
|
||||||
|
import org.jooq.Index;
|
||||||
import org.jooq.Name;
|
import org.jooq.Name;
|
||||||
import org.jooq.Record;
|
import org.jooq.Record;
|
||||||
import org.jooq.Row9;
|
import org.jooq.Row9;
|
||||||
|
@ -79,6 +81,11 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<DatabaseDocumentRecord, Long> VERSION = createField(DSL.name("version"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.inline("1", SQLDataType.BIGINT)), this, "");
|
public final TableField<DatabaseDocumentRecord, Long> VERSION = createField(DSL.name("version"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.inline("1", SQLDataType.BIGINT)), this, "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The column <code>databasir.database_document.is_archive</code>.
|
||||||
|
*/
|
||||||
|
public final TableField<DatabaseDocumentRecord, Boolean> IS_ARCHIVE = createField(DSL.name("is_archive"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.inline("0", SQLDataType.BOOLEAN)), this, "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The column <code>databasir.database_document.update_at</code>.
|
* The column <code>databasir.database_document.update_at</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -89,11 +96,6 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<DatabaseDocumentRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<DatabaseDocumentRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
/**
|
|
||||||
* The column <code>databasir.database_document.is_archive</code>.
|
|
||||||
*/
|
|
||||||
public final TableField<DatabaseDocumentRecord, Boolean> IS_ARCHIVE = createField(DSL.name("is_archive"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.inline("0", SQLDataType.BOOLEAN)), this, "");
|
|
||||||
|
|
||||||
private DatabaseDocument(Name alias, Table<DatabaseDocumentRecord> aliased) {
|
private DatabaseDocument(Name alias, Table<DatabaseDocumentRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
@ -134,6 +136,11 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
return aliased() ? null : Databasir.DATABASIR;
|
return aliased() ? null : Databasir.DATABASIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Index> getIndexes() {
|
||||||
|
return Arrays.asList(Indexes.DATABASE_DOCUMENT_IDX_PROJECT_ID);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identity<DatabaseDocumentRecord, Integer> getIdentity() {
|
public Identity<DatabaseDocumentRecord, Integer> getIdentity() {
|
||||||
return (Identity<DatabaseDocumentRecord, Integer>) super.getIdentity();
|
return (Identity<DatabaseDocumentRecord, Integer>) super.getIdentity();
|
||||||
|
@ -144,11 +151,6 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
return Keys.KEY_DATABASE_DOCUMENT_PRIMARY;
|
return Keys.KEY_DATABASE_DOCUMENT_PRIMARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<UniqueKey<DatabaseDocumentRecord>> getUniqueKeys() {
|
|
||||||
return Arrays.asList(Keys.KEY_DATABASE_DOCUMENT_UK_PROJECT_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseDocument as(String alias) {
|
public DatabaseDocument as(String alias) {
|
||||||
return new DatabaseDocument(DSL.name(alias), this);
|
return new DatabaseDocument(DSL.name(alias), this);
|
||||||
|
@ -180,7 +182,7 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Row9<Integer, Integer, String, String, String, Long, LocalDateTime, LocalDateTime, Boolean> fieldsRow() {
|
public Row9<Integer, Integer, String, String, String, Long, Boolean, LocalDateTime, LocalDateTime> fieldsRow() {
|
||||||
return (Row9) super.fieldsRow();
|
return (Row9) super.fieldsRow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,182 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.DatabaseDocumentHistoryRecord;
|
|
||||||
|
|
||||||
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.JSON;
|
|
||||||
import org.jooq.Name;
|
|
||||||
import org.jooq.Record;
|
|
||||||
import org.jooq.Row6;
|
|
||||||
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 DatabaseDocumentHistory extends TableImpl<DatabaseDocumentHistoryRecord> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The reference instance of
|
|
||||||
* <code>databasir.database_document_history</code>
|
|
||||||
*/
|
|
||||||
public static final DatabaseDocumentHistory DATABASE_DOCUMENT_HISTORY = new DatabaseDocumentHistory();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The class holding records for this type
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Class<DatabaseDocumentHistoryRecord> getRecordType() {
|
|
||||||
return DatabaseDocumentHistoryRecord.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The column <code>databasir.database_document_history.id</code>.
|
|
||||||
*/
|
|
||||||
public final TableField<DatabaseDocumentHistoryRecord, Integer> ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The column <code>databasir.database_document_history.project_id</code>.
|
|
||||||
*/
|
|
||||||
public final TableField<DatabaseDocumentHistoryRecord, Integer> PROJECT_ID = createField(DSL.name("project_id"), SQLDataType.INTEGER.nullable(false), this, "");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The column
|
|
||||||
* <code>databasir.database_document_history.database_document_id</code>.
|
|
||||||
*/
|
|
||||||
public final TableField<DatabaseDocumentHistoryRecord, Integer> DATABASE_DOCUMENT_ID = createField(DSL.name("database_document_id"), SQLDataType.INTEGER.nullable(false), this, "");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The column
|
|
||||||
* <code>databasir.database_document_history.database_document_object</code>.
|
|
||||||
*/
|
|
||||||
public final TableField<DatabaseDocumentHistoryRecord, JSON> DATABASE_DOCUMENT_OBJECT = createField(DSL.name("database_document_object"), SQLDataType.JSON, this, "");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The column <code>databasir.database_document_history.version</code>.
|
|
||||||
*/
|
|
||||||
public final TableField<DatabaseDocumentHistoryRecord, Long> VERSION = createField(DSL.name("version"), SQLDataType.BIGINT.nullable(false), this, "");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The column <code>databasir.database_document_history.create_at</code>.
|
|
||||||
*/
|
|
||||||
public final TableField<DatabaseDocumentHistoryRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
|
||||||
|
|
||||||
private DatabaseDocumentHistory(Name alias, Table<DatabaseDocumentHistoryRecord> aliased) {
|
|
||||||
this(alias, aliased, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private DatabaseDocumentHistory(Name alias, Table<DatabaseDocumentHistoryRecord> aliased, Field<?>[] parameters) {
|
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an aliased <code>databasir.database_document_history</code> table
|
|
||||||
* reference
|
|
||||||
*/
|
|
||||||
public DatabaseDocumentHistory(String alias) {
|
|
||||||
this(DSL.name(alias), DATABASE_DOCUMENT_HISTORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an aliased <code>databasir.database_document_history</code> table
|
|
||||||
* reference
|
|
||||||
*/
|
|
||||||
public DatabaseDocumentHistory(Name alias) {
|
|
||||||
this(alias, DATABASE_DOCUMENT_HISTORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a <code>databasir.database_document_history</code> table reference
|
|
||||||
*/
|
|
||||||
public DatabaseDocumentHistory() {
|
|
||||||
this(DSL.name("database_document_history"), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <O extends Record> DatabaseDocumentHistory(Table<O> child, ForeignKey<O, DatabaseDocumentHistoryRecord> key) {
|
|
||||||
super(child, key, DATABASE_DOCUMENT_HISTORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Schema getSchema() {
|
|
||||||
return aliased() ? null : Databasir.DATABASIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Index> getIndexes() {
|
|
||||||
return Arrays.asList(Indexes.DATABASE_DOCUMENT_HISTORY_IDX_PROJECT_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Identity<DatabaseDocumentHistoryRecord, Integer> getIdentity() {
|
|
||||||
return (Identity<DatabaseDocumentHistoryRecord, Integer>) super.getIdentity();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UniqueKey<DatabaseDocumentHistoryRecord> getPrimaryKey() {
|
|
||||||
return Keys.KEY_DATABASE_DOCUMENT_HISTORY_PRIMARY;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<UniqueKey<DatabaseDocumentHistoryRecord>> getUniqueKeys() {
|
|
||||||
return Arrays.asList(Keys.KEY_DATABASE_DOCUMENT_HISTORY_UK_CONNECTION_ID_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistory as(String alias) {
|
|
||||||
return new DatabaseDocumentHistory(DSL.name(alias), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistory as(Name alias) {
|
|
||||||
return new DatabaseDocumentHistory(alias, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rename this table
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistory rename(String name) {
|
|
||||||
return new DatabaseDocumentHistory(DSL.name(name), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rename this table
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistory rename(Name name) {
|
|
||||||
return new DatabaseDocumentHistory(name, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Row6 type methods
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Row6<Integer, Integer, Integer, JSON, Long, LocalDateTime> fieldsRow() {
|
|
||||||
return (Row6) super.fieldsRow();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,157 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is generated by jOOQ.
|
|
||||||
*/
|
|
||||||
package com.databasir.dao.tables.pojos;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import org.jooq.JSON;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is generated by jOOQ.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
|
||||||
public class DatabaseDocumentHistoryPojo implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
private Integer projectId;
|
|
||||||
private Integer databaseDocumentId;
|
|
||||||
private JSON databaseDocumentObject;
|
|
||||||
private Long version;
|
|
||||||
private LocalDateTime createAt;
|
|
||||||
|
|
||||||
public DatabaseDocumentHistoryPojo() {}
|
|
||||||
|
|
||||||
public DatabaseDocumentHistoryPojo(DatabaseDocumentHistoryPojo value) {
|
|
||||||
this.id = value.id;
|
|
||||||
this.projectId = value.projectId;
|
|
||||||
this.databaseDocumentId = value.databaseDocumentId;
|
|
||||||
this.databaseDocumentObject = value.databaseDocumentObject;
|
|
||||||
this.version = value.version;
|
|
||||||
this.createAt = value.createAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatabaseDocumentHistoryPojo(
|
|
||||||
Integer id,
|
|
||||||
Integer projectId,
|
|
||||||
Integer databaseDocumentId,
|
|
||||||
JSON databaseDocumentObject,
|
|
||||||
Long version,
|
|
||||||
LocalDateTime createAt
|
|
||||||
) {
|
|
||||||
this.id = id;
|
|
||||||
this.projectId = projectId;
|
|
||||||
this.databaseDocumentId = databaseDocumentId;
|
|
||||||
this.databaseDocumentObject = databaseDocumentObject;
|
|
||||||
this.version = version;
|
|
||||||
this.createAt = createAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document_history.id</code>.
|
|
||||||
*/
|
|
||||||
public Integer getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document_history.id</code>.
|
|
||||||
*/
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document_history.project_id</code>.
|
|
||||||
*/
|
|
||||||
public Integer getProjectId() {
|
|
||||||
return this.projectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document_history.project_id</code>.
|
|
||||||
*/
|
|
||||||
public void setProjectId(Integer projectId) {
|
|
||||||
this.projectId = projectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for
|
|
||||||
* <code>databasir.database_document_history.database_document_id</code>.
|
|
||||||
*/
|
|
||||||
public Integer getDatabaseDocumentId() {
|
|
||||||
return this.databaseDocumentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for
|
|
||||||
* <code>databasir.database_document_history.database_document_id</code>.
|
|
||||||
*/
|
|
||||||
public void setDatabaseDocumentId(Integer databaseDocumentId) {
|
|
||||||
this.databaseDocumentId = databaseDocumentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for
|
|
||||||
* <code>databasir.database_document_history.database_document_object</code>.
|
|
||||||
*/
|
|
||||||
public JSON getDatabaseDocumentObject() {
|
|
||||||
return this.databaseDocumentObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for
|
|
||||||
* <code>databasir.database_document_history.database_document_object</code>.
|
|
||||||
*/
|
|
||||||
public void setDatabaseDocumentObject(JSON databaseDocumentObject) {
|
|
||||||
this.databaseDocumentObject = databaseDocumentObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document_history.version</code>.
|
|
||||||
*/
|
|
||||||
public Long getVersion() {
|
|
||||||
return this.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document_history.version</code>.
|
|
||||||
*/
|
|
||||||
public void setVersion(Long version) {
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document_history.create_at</code>.
|
|
||||||
*/
|
|
||||||
public LocalDateTime getCreateAt() {
|
|
||||||
return this.createAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document_history.create_at</code>.
|
|
||||||
*/
|
|
||||||
public void setCreateAt(LocalDateTime createAt) {
|
|
||||||
this.createAt = createAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("DatabaseDocumentHistoryPojo (");
|
|
||||||
|
|
||||||
sb.append(id);
|
|
||||||
sb.append(", ").append(projectId);
|
|
||||||
sb.append(", ").append(databaseDocumentId);
|
|
||||||
sb.append(", ").append(databaseDocumentObject);
|
|
||||||
sb.append(", ").append(version);
|
|
||||||
sb.append(", ").append(createAt);
|
|
||||||
|
|
||||||
sb.append(")");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,9 +22,9 @@ public class DatabaseDocumentPojo implements Serializable {
|
||||||
private String productName;
|
private String productName;
|
||||||
private String productVersion;
|
private String productVersion;
|
||||||
private Long version;
|
private Long version;
|
||||||
|
private Boolean isArchive;
|
||||||
private LocalDateTime updateAt;
|
private LocalDateTime updateAt;
|
||||||
private LocalDateTime createAt;
|
private LocalDateTime createAt;
|
||||||
private Boolean isArchive;
|
|
||||||
|
|
||||||
public DatabaseDocumentPojo() {}
|
public DatabaseDocumentPojo() {}
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ public class DatabaseDocumentPojo implements Serializable {
|
||||||
this.productName = value.productName;
|
this.productName = value.productName;
|
||||||
this.productVersion = value.productVersion;
|
this.productVersion = value.productVersion;
|
||||||
this.version = value.version;
|
this.version = value.version;
|
||||||
|
this.isArchive = value.isArchive;
|
||||||
this.updateAt = value.updateAt;
|
this.updateAt = value.updateAt;
|
||||||
this.createAt = value.createAt;
|
this.createAt = value.createAt;
|
||||||
this.isArchive = value.isArchive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatabaseDocumentPojo(
|
public DatabaseDocumentPojo(
|
||||||
|
@ -47,9 +47,9 @@ public class DatabaseDocumentPojo implements Serializable {
|
||||||
String productName,
|
String productName,
|
||||||
String productVersion,
|
String productVersion,
|
||||||
Long version,
|
Long version,
|
||||||
|
Boolean isArchive,
|
||||||
LocalDateTime updateAt,
|
LocalDateTime updateAt,
|
||||||
LocalDateTime createAt,
|
LocalDateTime createAt
|
||||||
Boolean isArchive
|
|
||||||
) {
|
) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
|
@ -57,9 +57,9 @@ public class DatabaseDocumentPojo implements Serializable {
|
||||||
this.productName = productName;
|
this.productName = productName;
|
||||||
this.productVersion = productVersion;
|
this.productVersion = productVersion;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
this.isArchive = isArchive;
|
||||||
this.updateAt = updateAt;
|
this.updateAt = updateAt;
|
||||||
this.createAt = createAt;
|
this.createAt = createAt;
|
||||||
this.isArchive = isArchive;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,6 +146,20 @@ public class DatabaseDocumentPojo implements Serializable {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for <code>databasir.database_document.is_archive</code>.
|
||||||
|
*/
|
||||||
|
public Boolean getIsArchive() {
|
||||||
|
return this.isArchive;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for <code>databasir.database_document.is_archive</code>.
|
||||||
|
*/
|
||||||
|
public void setIsArchive(Boolean isArchive) {
|
||||||
|
this.isArchive = isArchive;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>databasir.database_document.update_at</code>.
|
* Getter for <code>databasir.database_document.update_at</code>.
|
||||||
*/
|
*/
|
||||||
|
@ -174,20 +188,6 @@ public class DatabaseDocumentPojo implements Serializable {
|
||||||
this.createAt = createAt;
|
this.createAt = createAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document.is_archive</code>.
|
|
||||||
*/
|
|
||||||
public Boolean getIsArchive() {
|
|
||||||
return this.isArchive;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document.is_archive</code>.
|
|
||||||
*/
|
|
||||||
public void setIsArchive(Boolean isArchive) {
|
|
||||||
this.isArchive = isArchive;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder("DatabaseDocumentPojo (");
|
StringBuilder sb = new StringBuilder("DatabaseDocumentPojo (");
|
||||||
|
@ -198,9 +198,9 @@ public class DatabaseDocumentPojo implements Serializable {
|
||||||
sb.append(", ").append(productName);
|
sb.append(", ").append(productName);
|
||||||
sb.append(", ").append(productVersion);
|
sb.append(", ").append(productVersion);
|
||||||
sb.append(", ").append(version);
|
sb.append(", ").append(version);
|
||||||
|
sb.append(", ").append(isArchive);
|
||||||
sb.append(", ").append(updateAt);
|
sb.append(", ").append(updateAt);
|
||||||
sb.append(", ").append(createAt);
|
sb.append(", ").append(createAt);
|
||||||
sb.append(", ").append(isArchive);
|
|
||||||
|
|
||||||
sb.append(")");
|
sb.append(")");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
|
@ -1,316 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is generated by jOOQ.
|
|
||||||
*/
|
|
||||||
package com.databasir.dao.tables.records;
|
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.dao.tables.DatabaseDocumentHistory;
|
|
||||||
import com.databasir.dao.tables.pojos.DatabaseDocumentHistoryPojo;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import org.jooq.Field;
|
|
||||||
import org.jooq.JSON;
|
|
||||||
import org.jooq.Record1;
|
|
||||||
import org.jooq.Record6;
|
|
||||||
import org.jooq.Row6;
|
|
||||||
import org.jooq.impl.UpdatableRecordImpl;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class is generated by jOOQ.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
|
||||||
public class DatabaseDocumentHistoryRecord extends UpdatableRecordImpl<DatabaseDocumentHistoryRecord> implements Record6<Integer, Integer, Integer, JSON, Long, LocalDateTime> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document_history.id</code>.
|
|
||||||
*/
|
|
||||||
public void setId(Integer value) {
|
|
||||||
set(0, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document_history.id</code>.
|
|
||||||
*/
|
|
||||||
public Integer getId() {
|
|
||||||
return (Integer) get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document_history.project_id</code>.
|
|
||||||
*/
|
|
||||||
public void setProjectId(Integer value) {
|
|
||||||
set(1, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document_history.project_id</code>.
|
|
||||||
*/
|
|
||||||
public Integer getProjectId() {
|
|
||||||
return (Integer) get(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for
|
|
||||||
* <code>databasir.database_document_history.database_document_id</code>.
|
|
||||||
*/
|
|
||||||
public void setDatabaseDocumentId(Integer value) {
|
|
||||||
set(2, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for
|
|
||||||
* <code>databasir.database_document_history.database_document_id</code>.
|
|
||||||
*/
|
|
||||||
public Integer getDatabaseDocumentId() {
|
|
||||||
return (Integer) get(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for
|
|
||||||
* <code>databasir.database_document_history.database_document_object</code>.
|
|
||||||
*/
|
|
||||||
public void setDatabaseDocumentObject(JSON value) {
|
|
||||||
set(3, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for
|
|
||||||
* <code>databasir.database_document_history.database_document_object</code>.
|
|
||||||
*/
|
|
||||||
public JSON getDatabaseDocumentObject() {
|
|
||||||
return (JSON) get(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document_history.version</code>.
|
|
||||||
*/
|
|
||||||
public void setVersion(Long value) {
|
|
||||||
set(4, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document_history.version</code>.
|
|
||||||
*/
|
|
||||||
public Long getVersion() {
|
|
||||||
return (Long) get(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document_history.create_at</code>.
|
|
||||||
*/
|
|
||||||
public void setCreateAt(LocalDateTime value) {
|
|
||||||
set(5, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document_history.create_at</code>.
|
|
||||||
*/
|
|
||||||
public LocalDateTime getCreateAt() {
|
|
||||||
return (LocalDateTime) get(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Primary key information
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Record1<Integer> key() {
|
|
||||||
return (Record1) super.key();
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Record6 type implementation
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Row6<Integer, Integer, Integer, JSON, Long, LocalDateTime> fieldsRow() {
|
|
||||||
return (Row6) super.fieldsRow();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Row6<Integer, Integer, Integer, JSON, Long, LocalDateTime> valuesRow() {
|
|
||||||
return (Row6) super.valuesRow();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Field<Integer> field1() {
|
|
||||||
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Field<Integer> field2() {
|
|
||||||
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.PROJECT_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Field<Integer> field3() {
|
|
||||||
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Field<JSON> field4() {
|
|
||||||
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_OBJECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Field<Long> field5() {
|
|
||||||
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Field<LocalDateTime> field6() {
|
|
||||||
return DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY.CREATE_AT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer component1() {
|
|
||||||
return getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer component2() {
|
|
||||||
return getProjectId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer component3() {
|
|
||||||
return getDatabaseDocumentId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSON component4() {
|
|
||||||
return getDatabaseDocumentObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long component5() {
|
|
||||||
return getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalDateTime component6() {
|
|
||||||
return getCreateAt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer value1() {
|
|
||||||
return getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer value2() {
|
|
||||||
return getProjectId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer value3() {
|
|
||||||
return getDatabaseDocumentId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSON value4() {
|
|
||||||
return getDatabaseDocumentObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long value5() {
|
|
||||||
return getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalDateTime value6() {
|
|
||||||
return getCreateAt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistoryRecord value1(Integer value) {
|
|
||||||
setId(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistoryRecord value2(Integer value) {
|
|
||||||
setProjectId(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistoryRecord value3(Integer value) {
|
|
||||||
setDatabaseDocumentId(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistoryRecord value4(JSON value) {
|
|
||||||
setDatabaseDocumentObject(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistoryRecord value5(Long value) {
|
|
||||||
setVersion(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistoryRecord value6(LocalDateTime value) {
|
|
||||||
setCreateAt(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentHistoryRecord values(Integer value1, Integer value2, Integer value3, JSON value4, Long value5, LocalDateTime value6) {
|
|
||||||
value1(value1);
|
|
||||||
value2(value2);
|
|
||||||
value3(value3);
|
|
||||||
value4(value4);
|
|
||||||
value5(value5);
|
|
||||||
value6(value6);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
// Constructors
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a detached DatabaseDocumentHistoryRecord
|
|
||||||
*/
|
|
||||||
public DatabaseDocumentHistoryRecord() {
|
|
||||||
super(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a detached, initialised DatabaseDocumentHistoryRecord
|
|
||||||
*/
|
|
||||||
public DatabaseDocumentHistoryRecord(Integer id, Integer projectId, Integer databaseDocumentId, JSON databaseDocumentObject, Long version, LocalDateTime createAt) {
|
|
||||||
super(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY);
|
|
||||||
|
|
||||||
setId(id);
|
|
||||||
setProjectId(projectId);
|
|
||||||
setDatabaseDocumentId(databaseDocumentId);
|
|
||||||
setDatabaseDocumentObject(databaseDocumentObject);
|
|
||||||
setVersion(version);
|
|
||||||
setCreateAt(createAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a detached, initialised DatabaseDocumentHistoryRecord
|
|
||||||
*/
|
|
||||||
public DatabaseDocumentHistoryRecord(DatabaseDocumentHistoryPojo value) {
|
|
||||||
super(DatabaseDocumentHistory.DATABASE_DOCUMENT_HISTORY);
|
|
||||||
|
|
||||||
if (value != null) {
|
|
||||||
setId(value.getId());
|
|
||||||
setProjectId(value.getProjectId());
|
|
||||||
setDatabaseDocumentId(value.getDatabaseDocumentId());
|
|
||||||
setDatabaseDocumentObject(value.getDatabaseDocumentObject());
|
|
||||||
setVersion(value.getVersion());
|
|
||||||
setCreateAt(value.getCreateAt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -20,7 +20,7 @@ import org.jooq.impl.UpdatableRecordImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocumentRecord> implements Record9<Integer, Integer, String, String, String, Long, LocalDateTime, LocalDateTime, Boolean> {
|
public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocumentRecord> implements Record9<Integer, Integer, String, String, String, Long, Boolean, LocalDateTime, LocalDateTime> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -108,46 +108,46 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
return (Long) get(5);
|
return (Long) get(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document.update_at</code>.
|
|
||||||
*/
|
|
||||||
public void setUpdateAt(LocalDateTime value) {
|
|
||||||
set(6, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document.update_at</code>.
|
|
||||||
*/
|
|
||||||
public LocalDateTime getUpdateAt() {
|
|
||||||
return (LocalDateTime) get(6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setter for <code>databasir.database_document.create_at</code>.
|
|
||||||
*/
|
|
||||||
public void setCreateAt(LocalDateTime value) {
|
|
||||||
set(7, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Getter for <code>databasir.database_document.create_at</code>.
|
|
||||||
*/
|
|
||||||
public LocalDateTime getCreateAt() {
|
|
||||||
return (LocalDateTime) get(7);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for <code>databasir.database_document.is_archive</code>.
|
* Setter for <code>databasir.database_document.is_archive</code>.
|
||||||
*/
|
*/
|
||||||
public void setIsArchive(Boolean value) {
|
public void setIsArchive(Boolean value) {
|
||||||
set(8, value);
|
set(6, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for <code>databasir.database_document.is_archive</code>.
|
* Getter for <code>databasir.database_document.is_archive</code>.
|
||||||
*/
|
*/
|
||||||
public Boolean getIsArchive() {
|
public Boolean getIsArchive() {
|
||||||
return (Boolean) get(8);
|
return (Boolean) get(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for <code>databasir.database_document.update_at</code>.
|
||||||
|
*/
|
||||||
|
public void setUpdateAt(LocalDateTime value) {
|
||||||
|
set(7, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for <code>databasir.database_document.update_at</code>.
|
||||||
|
*/
|
||||||
|
public LocalDateTime getUpdateAt() {
|
||||||
|
return (LocalDateTime) get(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for <code>databasir.database_document.create_at</code>.
|
||||||
|
*/
|
||||||
|
public void setCreateAt(LocalDateTime value) {
|
||||||
|
set(8, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter for <code>databasir.database_document.create_at</code>.
|
||||||
|
*/
|
||||||
|
public LocalDateTime getCreateAt() {
|
||||||
|
return (LocalDateTime) get(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
@ -164,12 +164,12 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Row9<Integer, Integer, String, String, String, Long, LocalDateTime, LocalDateTime, Boolean> fieldsRow() {
|
public Row9<Integer, Integer, String, String, String, Long, Boolean, LocalDateTime, LocalDateTime> fieldsRow() {
|
||||||
return (Row9) super.fieldsRow();
|
return (Row9) super.fieldsRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Row9<Integer, Integer, String, String, String, Long, LocalDateTime, LocalDateTime, Boolean> valuesRow() {
|
public Row9<Integer, Integer, String, String, String, Long, Boolean, LocalDateTime, LocalDateTime> valuesRow() {
|
||||||
return (Row9) super.valuesRow();
|
return (Row9) super.valuesRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,18 +204,18 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Field<LocalDateTime> field7() {
|
public Field<Boolean> field7() {
|
||||||
return DatabaseDocument.DATABASE_DOCUMENT.UPDATE_AT;
|
return DatabaseDocument.DATABASE_DOCUMENT.IS_ARCHIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Field<LocalDateTime> field8() {
|
public Field<LocalDateTime> field8() {
|
||||||
return DatabaseDocument.DATABASE_DOCUMENT.CREATE_AT;
|
return DatabaseDocument.DATABASE_DOCUMENT.UPDATE_AT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Field<Boolean> field9() {
|
public Field<LocalDateTime> field9() {
|
||||||
return DatabaseDocument.DATABASE_DOCUMENT.IS_ARCHIVE;
|
return DatabaseDocument.DATABASE_DOCUMENT.CREATE_AT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -249,18 +249,18 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDateTime component7() {
|
public Boolean component7() {
|
||||||
return getUpdateAt();
|
return getIsArchive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDateTime component8() {
|
public LocalDateTime component8() {
|
||||||
return getCreateAt();
|
return getUpdateAt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean component9() {
|
public LocalDateTime component9() {
|
||||||
return getIsArchive();
|
return getCreateAt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -294,18 +294,18 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDateTime value7() {
|
public Boolean value7() {
|
||||||
return getUpdateAt();
|
return getIsArchive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LocalDateTime value8() {
|
public LocalDateTime value8() {
|
||||||
return getCreateAt();
|
return getUpdateAt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean value9() {
|
public LocalDateTime value9() {
|
||||||
return getIsArchive();
|
return getCreateAt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -345,25 +345,25 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseDocumentRecord value7(LocalDateTime value) {
|
public DatabaseDocumentRecord value7(Boolean value) {
|
||||||
setUpdateAt(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentRecord value8(LocalDateTime value) {
|
|
||||||
setCreateAt(value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DatabaseDocumentRecord value9(Boolean value) {
|
|
||||||
setIsArchive(value);
|
setIsArchive(value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseDocumentRecord values(Integer value1, Integer value2, String value3, String value4, String value5, Long value6, LocalDateTime value7, LocalDateTime value8, Boolean value9) {
|
public DatabaseDocumentRecord value8(LocalDateTime value) {
|
||||||
|
setUpdateAt(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatabaseDocumentRecord value9(LocalDateTime value) {
|
||||||
|
setCreateAt(value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatabaseDocumentRecord values(Integer value1, Integer value2, String value3, String value4, String value5, Long value6, Boolean value7, LocalDateTime value8, LocalDateTime value9) {
|
||||||
value1(value1);
|
value1(value1);
|
||||||
value2(value2);
|
value2(value2);
|
||||||
value3(value3);
|
value3(value3);
|
||||||
|
@ -390,7 +390,7 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
/**
|
/**
|
||||||
* Create a detached, initialised DatabaseDocumentRecord
|
* Create a detached, initialised DatabaseDocumentRecord
|
||||||
*/
|
*/
|
||||||
public DatabaseDocumentRecord(Integer id, Integer projectId, String databaseName, String productName, String productVersion, Long version, LocalDateTime updateAt, LocalDateTime createAt, Boolean isArchive) {
|
public DatabaseDocumentRecord(Integer id, Integer projectId, String databaseName, String productName, String productVersion, Long version, Boolean isArchive, LocalDateTime updateAt, LocalDateTime createAt) {
|
||||||
super(DatabaseDocument.DATABASE_DOCUMENT);
|
super(DatabaseDocument.DATABASE_DOCUMENT);
|
||||||
|
|
||||||
setId(id);
|
setId(id);
|
||||||
|
@ -399,9 +399,9 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
setProductName(productName);
|
setProductName(productName);
|
||||||
setProductVersion(productVersion);
|
setProductVersion(productVersion);
|
||||||
setVersion(version);
|
setVersion(version);
|
||||||
|
setIsArchive(isArchive);
|
||||||
setUpdateAt(updateAt);
|
setUpdateAt(updateAt);
|
||||||
setCreateAt(createAt);
|
setCreateAt(createAt);
|
||||||
setIsArchive(isArchive);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -417,9 +417,9 @@ public class DatabaseDocumentRecord extends UpdatableRecordImpl<DatabaseDocument
|
||||||
setProductName(value.getProductName());
|
setProductName(value.getProductName());
|
||||||
setProductVersion(value.getProductVersion());
|
setProductVersion(value.getProductVersion());
|
||||||
setVersion(value.getVersion());
|
setVersion(value.getVersion());
|
||||||
|
setIsArchive(value.getIsArchive());
|
||||||
setUpdateAt(value.getUpdateAt());
|
setUpdateAt(value.getUpdateAt());
|
||||||
setCreateAt(value.getCreateAt());
|
setCreateAt(value.getCreateAt());
|
||||||
setIsArchive(value.getIsArchive());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,17 @@ package com.databasir.dao.impl;
|
||||||
|
|
||||||
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
|
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
|
||||||
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
||||||
|
import com.databasir.dao.value.DatabaseDocumentVersionPojo;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.jooq.Condition;
|
||||||
import org.jooq.DSLContext;
|
import org.jooq.DSLContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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 org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.DATABASE_DOCUMENT;
|
import static com.databasir.dao.Tables.DATABASE_DOCUMENT;
|
||||||
|
@ -29,10 +35,54 @@ public class DatabaseDocumentDao extends BaseDao<DatabaseDocumentPojo> {
|
||||||
.fetchOptionalInto(DatabaseDocumentPojo.class);
|
.fetchOptionalInto(DatabaseDocumentPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<DatabaseDocumentPojo> selectOptionalByProjectIdAndVersion(Integer projectId,
|
||||||
|
Long version) {
|
||||||
|
return getDslContext()
|
||||||
|
.select(DATABASE_DOCUMENT.fields()).from(DATABASE_DOCUMENT)
|
||||||
|
.where(DATABASE_DOCUMENT.PROJECT_ID.eq(projectId).and(DATABASE_DOCUMENT.VERSION.eq(version)))
|
||||||
|
.fetchOptionalInto(DatabaseDocumentPojo.class);
|
||||||
|
}
|
||||||
|
|
||||||
public void update(DatabaseDocumentPojo toPojo) {
|
public void update(DatabaseDocumentPojo toPojo) {
|
||||||
DatabaseDocumentRecord record = getDslContext().newRecord(DATABASE_DOCUMENT, toPojo);
|
DatabaseDocumentRecord record = getDslContext().newRecord(DATABASE_DOCUMENT, toPojo);
|
||||||
record.changed(DATABASE_DOCUMENT.ID, false);
|
record.changed(DATABASE_DOCUMENT.ID, false);
|
||||||
record.changed(DATABASE_DOCUMENT.CREATE_AT, false);
|
record.changed(DATABASE_DOCUMENT.CREATE_AT, false);
|
||||||
record.update();
|
record.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Optional<DatabaseDocumentPojo> selectNotArchivedByProjectId(Integer projectId) {
|
||||||
|
return getDslContext()
|
||||||
|
.select(DATABASE_DOCUMENT.fields()).from(DATABASE_DOCUMENT)
|
||||||
|
.where(DATABASE_DOCUMENT.PROJECT_ID.eq(projectId).and(DATABASE_DOCUMENT.IS_ARCHIVE.eq(false)))
|
||||||
|
.fetchOptionalInto(DatabaseDocumentPojo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateIsArchiveById(Integer id, Boolean isArchive) {
|
||||||
|
this.getDslContext()
|
||||||
|
.update(DATABASE_DOCUMENT).set(DATABASE_DOCUMENT.IS_ARCHIVE, isArchive)
|
||||||
|
.where(DATABASE_DOCUMENT.ID.eq(id).and(DATABASE_DOCUMENT.IS_ARCHIVE.eq(!isArchive)))
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<DatabaseDocumentVersionPojo> selectVersionPageByProjectId(Pageable request,
|
||||||
|
Integer projectId) {
|
||||||
|
Condition condition = DATABASE_DOCUMENT.PROJECT_ID.eq(projectId);
|
||||||
|
Integer count = getDslContext()
|
||||||
|
.selectCount().from(DATABASE_DOCUMENT).where(condition)
|
||||||
|
.fetchOne(0, int.class);
|
||||||
|
int total = count == null ? 0 : count;
|
||||||
|
List<DatabaseDocumentVersionPojo> data = getDslContext()
|
||||||
|
.select(
|
||||||
|
DATABASE_DOCUMENT.VERSION,
|
||||||
|
DATABASE_DOCUMENT.ID,
|
||||||
|
DATABASE_DOCUMENT.CREATE_AT
|
||||||
|
)
|
||||||
|
.from(DATABASE_DOCUMENT)
|
||||||
|
.where(condition)
|
||||||
|
.orderBy(getSortFields(request.getSort()))
|
||||||
|
.offset(request.getOffset())
|
||||||
|
.limit(request.getPageSize())
|
||||||
|
.fetchInto(DatabaseDocumentVersionPojo.class);
|
||||||
|
return new PageImpl<>(data, request, total);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
package com.databasir.dao.impl;
|
|
||||||
|
|
||||||
import com.databasir.dao.tables.pojos.DatabaseDocumentHistoryPojo;
|
|
||||||
import com.databasir.dao.value.DatabaseDocumentVersionPojo;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.jooq.Condition;
|
|
||||||
import org.jooq.DSLContext;
|
|
||||||
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.Optional;
|
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.DATABASE_DOCUMENT_HISTORY;
|
|
||||||
|
|
||||||
@Repository
|
|
||||||
public class DatabaseDocumentHistoryDao extends BaseDao<DatabaseDocumentHistoryPojo> {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
@Getter
|
|
||||||
private DSLContext dslContext;
|
|
||||||
|
|
||||||
public DatabaseDocumentHistoryDao() {
|
|
||||||
super(DATABASE_DOCUMENT_HISTORY, DatabaseDocumentHistoryPojo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Optional<DatabaseDocumentHistoryPojo> selectOptionalByProjectIdAndVersion(Integer projectId, Long version) {
|
|
||||||
return dslContext
|
|
||||||
.selectFrom(DATABASE_DOCUMENT_HISTORY)
|
|
||||||
.where(DATABASE_DOCUMENT_HISTORY.PROJECT_ID.eq(projectId)
|
|
||||||
.and(DATABASE_DOCUMENT_HISTORY.VERSION.eq(version)))
|
|
||||||
.fetchOptionalInto(DatabaseDocumentHistoryPojo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Page<DatabaseDocumentVersionPojo> selectVersionPageByDatabaseDocumentId(Pageable request,
|
|
||||||
Integer schemaDocumentId) {
|
|
||||||
Condition condition = DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID.eq(schemaDocumentId);
|
|
||||||
Integer count = getDslContext()
|
|
||||||
.selectCount().from(DATABASE_DOCUMENT_HISTORY).where(condition)
|
|
||||||
.fetchOne(0, int.class);
|
|
||||||
int total = count == null ? 0 : count;
|
|
||||||
List<DatabaseDocumentVersionPojo> data = getDslContext()
|
|
||||||
.select(
|
|
||||||
DATABASE_DOCUMENT_HISTORY.VERSION,
|
|
||||||
DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID,
|
|
||||||
DATABASE_DOCUMENT_HISTORY.CREATE_AT
|
|
||||||
)
|
|
||||||
.from(DATABASE_DOCUMENT_HISTORY)
|
|
||||||
.where(condition)
|
|
||||||
.orderBy(getSortFields(request.getSort()))
|
|
||||||
.offset(request.getOffset())
|
|
||||||
.limit(request.getPageSize())
|
|
||||||
.fetchInto(DatabaseDocumentVersionPojo.class);
|
|
||||||
return new PageImpl<>(data, request, total);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,7 @@ import java.time.LocalDateTime;
|
||||||
@Data
|
@Data
|
||||||
public class DatabaseDocumentVersionPojo {
|
public class DatabaseDocumentVersionPojo {
|
||||||
|
|
||||||
private Integer databaseDocumentId;
|
private Integer id;
|
||||||
|
|
||||||
private Long version;
|
private Long version;
|
||||||
|
|
||||||
|
|
|
@ -123,21 +123,9 @@ CREATE TABLE IF NOT EXISTS database_document
|
||||||
product_name TEXT NOT NULL,
|
product_name TEXT NOT NULL,
|
||||||
product_version TEXT NOT NULL,
|
product_version TEXT NOT NULL,
|
||||||
version BIGINT NOT NULL DEFAULT 1,
|
version BIGINT NOT NULL DEFAULT 1,
|
||||||
|
is_archive BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
CONSTRAINT uk_project_id UNIQUE (project_id)
|
|
||||||
) CHARSET utf8mb4
|
|
||||||
COLLATE utf8mb4_unicode_ci;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS database_document_history
|
|
||||||
(
|
|
||||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
|
||||||
project_id INT NOT NULL,
|
|
||||||
database_document_id INT NOT NULL,
|
|
||||||
database_document_object JSON DEFAULT NULL,
|
|
||||||
version BIGINT NOT NULL,
|
|
||||||
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
CONSTRAINT uk_connection_id_version UNIQUE (database_document_id, version),
|
|
||||||
INDEX idx_project_id (project_id)
|
INDEX idx_project_id (project_id)
|
||||||
) CHARSET utf8mb4
|
) CHARSET utf8mb4
|
||||||
COLLATE utf8mb4_unicode_ci;
|
COLLATE utf8mb4_unicode_ci;
|
||||||
|
|
Loading…
Reference in New Issue