mirror of
https://github.com/vran-dev/databasir.git
synced 2025-09-11 13:17:20 +08:00
refactor: rename pojo class name (#225)
* refactor: rename pojo class name * fix: compile error
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.exception.DataNotExistsException;
|
||||
import com.databasir.dao.tables.pojos.DataSourcePojo;
|
||||
import com.databasir.dao.tables.pojos.DataSource;
|
||||
import com.databasir.dao.tables.records.DataSourceRecord;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -15,33 +15,33 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.DATA_SOURCE;
|
||||
|
||||
@Repository
|
||||
public class DataSourceDao extends BaseDao<DataSourcePojo> {
|
||||
public class DataSourceDao extends BaseDao<DataSource> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DataSourceDao() {
|
||||
super(DATA_SOURCE, DataSourcePojo.class);
|
||||
super(DATA_SOURCE, DataSource.class);
|
||||
}
|
||||
|
||||
public Optional<DataSourcePojo> selectOptionalByProjectId(Integer projectId) {
|
||||
public Optional<DataSource> selectOptionalByProjectId(Integer projectId) {
|
||||
return getDslContext()
|
||||
.select(DATA_SOURCE.fields()).from(DATA_SOURCE).where(DATA_SOURCE.PROJECT_ID.eq(projectId))
|
||||
.fetchOptionalInto(DataSourcePojo.class);
|
||||
.fetchOptionalInto(DataSource.class);
|
||||
}
|
||||
|
||||
public DataSourcePojo selectByProjectId(Integer projectId) {
|
||||
public DataSource selectByProjectId(Integer projectId) {
|
||||
return getDslContext()
|
||||
.select(DATA_SOURCE.fields()).from(DATA_SOURCE).where(DATA_SOURCE.PROJECT_ID.eq(projectId))
|
||||
.fetchOptionalInto(DataSourcePojo.class)
|
||||
.fetchOptionalInto(DataSource.class)
|
||||
.orElseThrow(() -> new DataNotExistsException("data not exists in "
|
||||
+ table().getName()
|
||||
+ " with schemaSourceId = "
|
||||
+ projectId));
|
||||
}
|
||||
|
||||
public int updateByProjectId(DataSourcePojo dataSource) {
|
||||
public int updateByProjectId(DataSource dataSource) {
|
||||
DataSourceRecord record = getDslContext().newRecord(DATA_SOURCE, dataSource);
|
||||
record.changed(DATA_SOURCE.ID, false);
|
||||
record.changed(DATA_SOURCE.PROJECT_ID, false);
|
||||
@@ -53,12 +53,12 @@ public class DataSourceDao extends BaseDao<DataSourcePojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public List<DataSourcePojo> selectInProjectIds(List<Integer> projectIds) {
|
||||
public List<DataSource> selectInProjectIds(List<Integer> projectIds) {
|
||||
if (projectIds == null || projectIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getDslContext()
|
||||
.select(DATA_SOURCE.fields()).from(DATA_SOURCE).where(DATA_SOURCE.PROJECT_ID.in(projectIds))
|
||||
.fetchInto(DataSourcePojo.class);
|
||||
.fetchInto(DataSource.class);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.DataSourcePropertyPojo;
|
||||
import com.databasir.dao.tables.pojos.DataSourceProperty;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -11,14 +11,14 @@ import java.util.List;
|
||||
import static com.databasir.dao.Tables.DATA_SOURCE_PROPERTY;
|
||||
|
||||
@Repository
|
||||
public class DataSourcePropertyDao extends BaseDao<DataSourcePropertyPojo> {
|
||||
public class DataSourcePropertyDao extends BaseDao<DataSourceProperty> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DataSourcePropertyDao() {
|
||||
super(DATA_SOURCE_PROPERTY, DataSourcePropertyPojo.class);
|
||||
super(DATA_SOURCE_PROPERTY, DataSourceProperty.class);
|
||||
}
|
||||
|
||||
public int deleteByDataSourceId(Integer dataSourceId) {
|
||||
@@ -27,10 +27,10 @@ public class DataSourcePropertyDao extends BaseDao<DataSourcePropertyPojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public List<DataSourcePropertyPojo> selectByDataSourceId(Integer id) {
|
||||
public List<DataSourceProperty> selectByDataSourceId(Integer id) {
|
||||
return dslContext
|
||||
.select(DATA_SOURCE_PROPERTY.fields()).from(DATA_SOURCE_PROPERTY)
|
||||
.where(DATA_SOURCE_PROPERTY.DATA_SOURCE_ID.eq(id))
|
||||
.fetchInto(DataSourcePropertyPojo.class);
|
||||
.fetchInto(DataSourceProperty.class);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
|
||||
import com.databasir.dao.tables.pojos.DatabaseDocument;
|
||||
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
||||
import com.databasir.dao.value.DatabaseDocumentVersionPojo;
|
||||
import lombok.Getter;
|
||||
@@ -18,29 +18,29 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.DATABASE_DOCUMENT;
|
||||
|
||||
@Repository
|
||||
public class DatabaseDocumentDao extends BaseDao<DatabaseDocumentPojo> {
|
||||
public class DatabaseDocumentDao extends BaseDao<DatabaseDocument> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DatabaseDocumentDao() {
|
||||
super(DATABASE_DOCUMENT, DatabaseDocumentPojo.class);
|
||||
super(DATABASE_DOCUMENT, DatabaseDocument.class);
|
||||
}
|
||||
|
||||
public Optional<DatabaseDocumentPojo> selectOptionalByProjectId(Integer projectId) {
|
||||
public Optional<DatabaseDocument> selectOptionalByProjectId(Integer projectId) {
|
||||
return getDslContext()
|
||||
.select(DATABASE_DOCUMENT.fields()).from(DATABASE_DOCUMENT)
|
||||
.where(DATABASE_DOCUMENT.PROJECT_ID.eq(projectId))
|
||||
.fetchOptionalInto(DatabaseDocumentPojo.class);
|
||||
.fetchOptionalInto(DatabaseDocument.class);
|
||||
}
|
||||
|
||||
public Optional<DatabaseDocumentPojo> selectOptionalByProjectIdAndVersion(Integer projectId,
|
||||
public Optional<DatabaseDocument> 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);
|
||||
.fetchOptionalInto(DatabaseDocument.class);
|
||||
}
|
||||
|
||||
public Optional<Integer> selectIdByProjectIdAndVersion(Integer projectId,
|
||||
@@ -51,18 +51,18 @@ public class DatabaseDocumentDao extends BaseDao<DatabaseDocumentPojo> {
|
||||
.fetchOptionalInto(Integer.class);
|
||||
}
|
||||
|
||||
public void update(DatabaseDocumentPojo toPojo) {
|
||||
public void update(DatabaseDocument toPojo) {
|
||||
DatabaseDocumentRecord record = getDslContext().newRecord(DATABASE_DOCUMENT, toPojo);
|
||||
record.changed(DATABASE_DOCUMENT.ID, false);
|
||||
record.changed(DATABASE_DOCUMENT.CREATE_AT, false);
|
||||
record.update();
|
||||
}
|
||||
|
||||
public Optional<DatabaseDocumentPojo> selectNotArchivedByProjectId(Integer projectId) {
|
||||
public Optional<DatabaseDocument> 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);
|
||||
.fetchOptionalInto(DatabaseDocument.class);
|
||||
}
|
||||
|
||||
public void updateIsArchiveById(Integer id, Boolean isArchive) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
|
||||
import com.databasir.dao.tables.pojos.DatabaseType;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -12,14 +12,14 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.DATABASE_TYPE;
|
||||
|
||||
@Repository
|
||||
public class DatabaseTypeDao extends BaseDao<DatabaseTypePojo> {
|
||||
public class DatabaseTypeDao extends BaseDao<DatabaseType> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DatabaseTypeDao() {
|
||||
super(DATABASE_TYPE, DatabaseTypePojo.class);
|
||||
super(DATABASE_TYPE, DatabaseType.class);
|
||||
}
|
||||
|
||||
public boolean existsByDatabaseType(String databaseType) {
|
||||
@@ -32,17 +32,17 @@ public class DatabaseTypeDao extends BaseDao<DatabaseTypePojo> {
|
||||
.and(DATABASE_TYPE.DELETED.eq(false)));
|
||||
}
|
||||
|
||||
public DatabaseTypePojo selectByDatabaseType(String databaseType) {
|
||||
public DatabaseType selectByDatabaseType(String databaseType) {
|
||||
return this.selectOne(DATABASE_TYPE.DATABASE_TYPE_.eq(databaseType)
|
||||
.and(DATABASE_TYPE.DELETED.eq(false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DatabaseTypePojo> selectAll() {
|
||||
public List<DatabaseType> selectAll() {
|
||||
return this.getDslContext().selectFrom(DATABASE_TYPE)
|
||||
.where(DATABASE_TYPE.DELETED.eq(false))
|
||||
.orderBy(DATABASE_TYPE.ID.desc())
|
||||
.fetchInto(DatabaseTypePojo.class);
|
||||
.fetchInto(DatabaseType.class);
|
||||
}
|
||||
|
||||
public int deleteById(Integer id) {
|
||||
@@ -55,7 +55,7 @@ public class DatabaseTypeDao extends BaseDao<DatabaseTypePojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public Optional<DatabaseTypePojo> selectOptionalById(Integer id) {
|
||||
public Optional<DatabaseType> selectOptionalById(Integer id) {
|
||||
return super.selectOptionalOne(DATABASE_TYPE.DELETED.eq(false).and(DATABASE_TYPE.ID.eq(id)));
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo;
|
||||
import com.databasir.dao.tables.pojos.DocumentDescription;
|
||||
import com.databasir.dao.tables.records.DocumentDescriptionRecord;
|
||||
import lombok.Getter;
|
||||
import org.jooq.Condition;
|
||||
@@ -13,14 +13,14 @@ import java.util.List;
|
||||
import static com.databasir.dao.Tables.DOCUMENT_DESCRIPTION;
|
||||
|
||||
@Repository
|
||||
public class DocumentDescriptionDao extends BaseDao<DocumentDescriptionPojo> {
|
||||
public class DocumentDescriptionDao extends BaseDao<DocumentDescription> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DocumentDescriptionDao() {
|
||||
super(DOCUMENT_DESCRIPTION, DocumentDescriptionPojo.class);
|
||||
super(DOCUMENT_DESCRIPTION, DocumentDescription.class);
|
||||
}
|
||||
|
||||
public boolean exists(Integer projectId, String tableName, String columnName) {
|
||||
@@ -34,7 +34,7 @@ public class DocumentDescriptionDao extends BaseDao<DocumentDescriptionPojo> {
|
||||
return this.exists(condition);
|
||||
}
|
||||
|
||||
public void update(DocumentDescriptionPojo pojo) {
|
||||
public void update(DocumentDescription pojo) {
|
||||
Condition condition = DOCUMENT_DESCRIPTION.TABLE_NAME.eq(pojo.getTableName());
|
||||
if (pojo.getColumnName() == null) {
|
||||
condition = condition.and(DOCUMENT_DESCRIPTION.COLUMN_NAME.isNull());
|
||||
@@ -45,18 +45,18 @@ public class DocumentDescriptionDao extends BaseDao<DocumentDescriptionPojo> {
|
||||
getDslContext().executeUpdate(record, condition);
|
||||
}
|
||||
|
||||
public List<DocumentDescriptionPojo> selectByProjectId(Integer projectId) {
|
||||
public List<DocumentDescription> selectByProjectId(Integer projectId) {
|
||||
return selectByCondition(DOCUMENT_DESCRIPTION.PROJECT_ID.eq(projectId));
|
||||
}
|
||||
|
||||
public List<DocumentDescriptionPojo> selectTableDescriptionByProjectId(Integer projectId) {
|
||||
public List<DocumentDescription> selectTableDescriptionByProjectId(Integer projectId) {
|
||||
return selectByCondition(DOCUMENT_DESCRIPTION.PROJECT_ID.eq(projectId)
|
||||
.and(DOCUMENT_DESCRIPTION.COLUMN_NAME.isNull()));
|
||||
}
|
||||
|
||||
public List<DocumentDescriptionPojo> selectByCondition(Condition condition) {
|
||||
public List<DocumentDescription> selectByCondition(Condition condition) {
|
||||
return this.getDslContext()
|
||||
.selectFrom(DOCUMENT_DESCRIPTION).where(condition)
|
||||
.fetchInto(DocumentDescriptionPojo.class);
|
||||
.fetchInto(DocumentDescription.class);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.DocumentDiscussionPojo;
|
||||
import com.databasir.dao.tables.pojos.DocumentDiscussion;
|
||||
import com.databasir.dao.value.DocumentDiscussionCountPojo;
|
||||
import lombok.Getter;
|
||||
import org.jooq.Condition;
|
||||
@@ -15,21 +15,21 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.DOCUMENT_DISCUSSION;
|
||||
|
||||
@Repository
|
||||
public class DocumentDiscussionDao extends BaseDao<DocumentDiscussionPojo> {
|
||||
public class DocumentDiscussionDao extends BaseDao<DocumentDiscussion> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DocumentDiscussionDao() {
|
||||
super(DOCUMENT_DISCUSSION, DocumentDiscussionPojo.class);
|
||||
super(DOCUMENT_DISCUSSION, DocumentDiscussion.class);
|
||||
}
|
||||
|
||||
public Optional<DocumentDiscussionPojo> selectByProjectIdAndId(Integer projectId, Integer id) {
|
||||
public Optional<DocumentDiscussion> selectByProjectIdAndId(Integer projectId, Integer id) {
|
||||
return this.getDslContext()
|
||||
.selectFrom(DOCUMENT_DISCUSSION).where(DOCUMENT_DISCUSSION.PROJECT_ID.eq(projectId)
|
||||
.and(DOCUMENT_DISCUSSION.ID.eq(id)))
|
||||
.fetchOptionalInto(DocumentDiscussionPojo.class);
|
||||
.fetchOptionalInto(DocumentDiscussion.class);
|
||||
}
|
||||
|
||||
public List<DocumentDiscussionCountPojo> selectTableDiscussionCount(Integer projectId) {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.Indexes;
|
||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
||||
import com.databasir.dao.tables.pojos.DocumentFullText;
|
||||
import com.databasir.dao.value.FullTextProjectInfoUpdatePojo;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -19,7 +19,7 @@ import java.util.Objects;
|
||||
import static com.databasir.dao.Tables.DOCUMENT_FULL_TEXT;
|
||||
|
||||
@Repository
|
||||
public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
|
||||
public class DocumentFullTextDao extends BaseDao<DocumentFullText> {
|
||||
|
||||
public static final String[] EMPTY = new String[0];
|
||||
|
||||
@@ -28,10 +28,10 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DocumentFullTextDao() {
|
||||
super(DOCUMENT_FULL_TEXT, DocumentFullTextPojo.class);
|
||||
super(DOCUMENT_FULL_TEXT, DocumentFullText.class);
|
||||
}
|
||||
|
||||
public Page<DocumentFullTextPojo> selectColumnPage(Pageable pageable, String keyword) {
|
||||
public Page<DocumentFullText> selectColumnPage(Pageable pageable, String keyword) {
|
||||
String[] matchCols = Indexes.DOCUMENT_FULL_TEXT_FIDX_COLUMN.getFields()
|
||||
.stream()
|
||||
.map(f -> f.getName())
|
||||
@@ -48,15 +48,15 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
|
||||
.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())
|
||||
List<DocumentFullText> 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);
|
||||
.fetchInto(DocumentFullText.class);
|
||||
return new PageImpl<>(content, pageable, total.longValue());
|
||||
}
|
||||
|
||||
public Page<DocumentFullTextPojo> selectTablePage(Pageable pageable, String keyword) {
|
||||
public Page<DocumentFullText> selectTablePage(Pageable pageable, String keyword) {
|
||||
String[] matchCols = Indexes.DOCUMENT_FULL_TEXT_FIDX_TABLE.getFields()
|
||||
.stream()
|
||||
.map(f -> f.getName())
|
||||
@@ -91,18 +91,18 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.fetchOne(0, int.class);
|
||||
// content
|
||||
List<DocumentFullTextPojo> content = dslContext.select(groupColumns)
|
||||
List<DocumentFullText> 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);
|
||||
.fetchInto(DocumentFullText.class);
|
||||
return new PageImpl<>(content, pageable, total.longValue());
|
||||
}
|
||||
|
||||
public Page<DocumentFullTextPojo> selectProjectPage(Pageable pageable, String keyword) {
|
||||
public Page<DocumentFullText> selectProjectPage(Pageable pageable, String keyword) {
|
||||
String[] matchCols = Indexes.DOCUMENT_FULL_TEXT_FIDX_PROJECT.getFields()
|
||||
.stream()
|
||||
.map(f -> f.getName())
|
||||
@@ -121,17 +121,17 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.fetchOne(0, int.class);
|
||||
// content
|
||||
List<DocumentFullTextPojo> content = dslContext.select(DOCUMENT_FULL_TEXT.fields())
|
||||
List<DocumentFullText> 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);
|
||||
.fetchInto(DocumentFullText.class);
|
||||
return new PageImpl<>(content, pageable, total.longValue());
|
||||
}
|
||||
|
||||
public Page<DocumentFullTextPojo> selectGroupPage(Pageable pageable, String keyword) {
|
||||
public Page<DocumentFullText> selectGroupPage(Pageable pageable, String keyword) {
|
||||
String[] matchCols = Indexes.DOCUMENT_FULL_TEXT_FIDX_GROUP.getFields()
|
||||
.stream()
|
||||
.map(f -> f.getName())
|
||||
@@ -150,13 +150,13 @@ public class DocumentFullTextDao extends BaseDao<DocumentFullTextPojo> {
|
||||
.and(fullTextMatchSqlSegment))
|
||||
.fetchOne(0, int.class);
|
||||
// content
|
||||
List<DocumentFullTextPojo> content = dslContext.select(DOCUMENT_FULL_TEXT.fields())
|
||||
List<DocumentFullText> 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);
|
||||
.fetchInto(DocumentFullText.class);
|
||||
return new PageImpl<>(content, pageable, total.longValue());
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.DocumentTemplatePropertyPojo;
|
||||
import com.databasir.dao.tables.pojos.DocumentTemplateProperty;
|
||||
import com.databasir.dao.tables.records.DocumentTemplatePropertyRecord;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -15,17 +15,17 @@ import java.util.stream.Collectors;
|
||||
import static com.databasir.dao.Tables.DOCUMENT_TEMPLATE_PROPERTY;
|
||||
|
||||
@Repository
|
||||
public class DocumentTemplatePropertyDao extends BaseDao<DocumentTemplatePropertyPojo> {
|
||||
public class DocumentTemplatePropertyDao extends BaseDao<DocumentTemplateProperty> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public DocumentTemplatePropertyDao() {
|
||||
super(DOCUMENT_TEMPLATE_PROPERTY, DocumentTemplatePropertyPojo.class);
|
||||
super(DOCUMENT_TEMPLATE_PROPERTY, DocumentTemplateProperty.class);
|
||||
}
|
||||
|
||||
public void batchInsertOnDuplicateUpdateDefaultValue(Collection<DocumentTemplatePropertyPojo> data) {
|
||||
public void batchInsertOnDuplicateUpdateDefaultValue(Collection<DocumentTemplateProperty> data) {
|
||||
if (data == null || data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class DocumentTemplatePropertyDao extends BaseDao<DocumentTemplatePropert
|
||||
getDslContext().batch(query).execute();
|
||||
}
|
||||
|
||||
public void batchInsertOnDuplicateKeyUpdateValue(Collection<DocumentTemplatePropertyPojo> data) {
|
||||
public void batchInsertOnDuplicateKeyUpdateValue(Collection<DocumentTemplateProperty> data) {
|
||||
if (data == null || data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
||||
import com.databasir.dao.tables.pojos.Group;
|
||||
import lombok.Getter;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -18,14 +18,14 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.GROUP;
|
||||
|
||||
@Repository
|
||||
public class GroupDao extends BaseDao<GroupPojo> {
|
||||
public class GroupDao extends BaseDao<Group> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public GroupDao() {
|
||||
super(GROUP, GroupPojo.class);
|
||||
super(GROUP, Group.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -36,46 +36,46 @@ public class GroupDao extends BaseDao<GroupPojo> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<GroupPojo> selectByPage(Pageable request, Condition condition) {
|
||||
public Page<Group> selectByPage(Pageable request, Condition condition) {
|
||||
return super.selectByPage(request, condition.and(GROUP.DELETED.eq(false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Serializable> Optional<GroupPojo> selectOptionalById(T id) {
|
||||
public <T extends Serializable> Optional<Group> selectOptionalById(T id) {
|
||||
return getDslContext()
|
||||
.select(GROUP.fields()).from(GROUP).where(GROUP.ID.eq((Integer) id).and(GROUP.DELETED.eq(false)))
|
||||
.fetchOptionalInto(GroupPojo.class);
|
||||
.fetchOptionalInto(Group.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupPojo> selectInIds(Collection<? extends Serializable> ids) {
|
||||
public List<Group> selectInIds(Collection<? extends Serializable> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getDslContext()
|
||||
.select(GROUP.fields()).from(GROUP)
|
||||
.where(GROUP.ID.in(ids)).and(GROUP.DELETED.eq(false))
|
||||
.fetchInto(GroupPojo.class);
|
||||
.fetchInto(Group.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* with deleted
|
||||
*/
|
||||
public List<GroupPojo> selectAllInIds(List<? extends Serializable> ids) {
|
||||
public List<Group> selectAllInIds(List<? extends Serializable> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getDslContext()
|
||||
.select(GROUP.fields()).from(GROUP)
|
||||
.where(GROUP.ID.in(ids))
|
||||
.fetchInto(GroupPojo.class);
|
||||
.fetchInto(Group.class);
|
||||
}
|
||||
|
||||
public List<GroupPojo> selectByName(String nameContains) {
|
||||
public List<Group> selectByName(String nameContains) {
|
||||
return getDslContext()
|
||||
.select(GROUP.fields()).from(GROUP)
|
||||
.where(GROUP.NAME.contains(nameContains))
|
||||
.and(GROUP.DELETED.eq(false))
|
||||
.fetchInto(GroupPojo.class);
|
||||
.fetchInto(Group.class);
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.LoginPojo;
|
||||
import com.databasir.dao.tables.pojos.Login;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -12,14 +12,14 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.LOGIN;
|
||||
|
||||
@Repository
|
||||
public class LoginDao extends BaseDao<LoginPojo> {
|
||||
public class LoginDao extends BaseDao<Login> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public LoginDao() {
|
||||
super(LOGIN, LoginPojo.class);
|
||||
super(LOGIN, Login.class);
|
||||
}
|
||||
|
||||
public void deleteByUserId(Integer userId) {
|
||||
@@ -28,23 +28,23 @@ public class LoginDao extends BaseDao<LoginPojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public Optional<LoginPojo> selectByUserId(Integer userId) {
|
||||
public Optional<Login> selectByUserId(Integer userId) {
|
||||
return getDslContext()
|
||||
.select(LOGIN.fields()).from(LOGIN).where(LOGIN.USER_ID.eq(userId))
|
||||
.fetchOptionalInto(LoginPojo.class);
|
||||
.fetchOptionalInto(Login.class);
|
||||
}
|
||||
|
||||
public Optional<LoginPojo> selectByRefreshToken(String refreshToken) {
|
||||
public Optional<Login> selectByRefreshToken(String refreshToken) {
|
||||
return getDslContext()
|
||||
.select(LOGIN.fields()).from(LOGIN).where(LOGIN.REFRESH_TOKEN.eq(refreshToken))
|
||||
.fetchOptionalInto(LoginPojo.class);
|
||||
.fetchOptionalInto(Login.class);
|
||||
}
|
||||
|
||||
public Optional<LoginPojo> selectByAccessToken(String accessToken) {
|
||||
public Optional<Login> selectByAccessToken(String accessToken) {
|
||||
return getDslContext()
|
||||
.selectFrom(LOGIN).where(LOGIN.ACCESS_TOKEN.eq(accessToken)
|
||||
.and(LOGIN.ACCESS_TOKEN_EXPIRE_AT.ge(LocalDateTime.now())))
|
||||
.fetchOptionalInto(LoginPojo.class);
|
||||
.fetchOptionalInto(Login.class);
|
||||
}
|
||||
|
||||
public void updateAccessToken(String accessToken, LocalDateTime accessTokenExpireAt, Integer userId) {
|
||||
@@ -56,19 +56,19 @@ public class LoginDao extends BaseDao<LoginPojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public void insertOnDuplicateKeyUpdate(LoginPojo loginPojo) {
|
||||
public void insertOnDuplicateKeyUpdate(Login login) {
|
||||
getDslContext()
|
||||
.insertInto(LOGIN)
|
||||
.set(LOGIN.USER_ID, loginPojo.getUserId())
|
||||
.set(LOGIN.ACCESS_TOKEN, loginPojo.getAccessToken())
|
||||
.set(LOGIN.ACCESS_TOKEN_EXPIRE_AT, loginPojo.getAccessTokenExpireAt())
|
||||
.set(LOGIN.REFRESH_TOKEN, loginPojo.getRefreshToken())
|
||||
.set(LOGIN.REFRESH_TOKEN_EXPIRE_AT, loginPojo.getRefreshTokenExpireAt())
|
||||
.set(LOGIN.USER_ID, login.getUserId())
|
||||
.set(LOGIN.ACCESS_TOKEN, login.getAccessToken())
|
||||
.set(LOGIN.ACCESS_TOKEN_EXPIRE_AT, login.getAccessTokenExpireAt())
|
||||
.set(LOGIN.REFRESH_TOKEN, login.getRefreshToken())
|
||||
.set(LOGIN.REFRESH_TOKEN_EXPIRE_AT, login.getRefreshTokenExpireAt())
|
||||
.onDuplicateKeyUpdate()
|
||||
.set(LOGIN.ACCESS_TOKEN, loginPojo.getAccessToken())
|
||||
.set(LOGIN.ACCESS_TOKEN_EXPIRE_AT, loginPojo.getAccessTokenExpireAt())
|
||||
.set(LOGIN.REFRESH_TOKEN, loginPojo.getRefreshToken())
|
||||
.set(LOGIN.REFRESH_TOKEN_EXPIRE_AT, loginPojo.getRefreshTokenExpireAt())
|
||||
.set(LOGIN.ACCESS_TOKEN, login.getAccessToken())
|
||||
.set(LOGIN.ACCESS_TOKEN_EXPIRE_AT, login.getAccessTokenExpireAt())
|
||||
.set(LOGIN.REFRESH_TOKEN, login.getRefreshToken())
|
||||
.set(LOGIN.REFRESH_TOKEN_EXPIRE_AT, login.getRefreshTokenExpireAt())
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.MockDataRulePojo;
|
||||
import com.databasir.dao.tables.pojos.MockDataRule;
|
||||
import com.databasir.dao.tables.records.MockDataRuleRecord;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -15,32 +15,32 @@ import java.util.stream.Collectors;
|
||||
import static com.databasir.dao.Tables.MOCK_DATA_RULE;
|
||||
|
||||
@Repository
|
||||
public class MockDataRuleDao extends BaseDao<MockDataRulePojo> {
|
||||
public class MockDataRuleDao extends BaseDao<MockDataRule> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public MockDataRuleDao() {
|
||||
super(MOCK_DATA_RULE, MockDataRulePojo.class);
|
||||
super(MOCK_DATA_RULE, MockDataRule.class);
|
||||
}
|
||||
|
||||
public List<MockDataRulePojo> selectByProjectId(Integer projectId) {
|
||||
public List<MockDataRule> selectByProjectId(Integer projectId) {
|
||||
return this.getDslContext()
|
||||
.selectFrom(MOCK_DATA_RULE)
|
||||
.where(MOCK_DATA_RULE.PROJECT_ID.eq(projectId))
|
||||
.fetchInto(MockDataRulePojo.class);
|
||||
.fetchInto(MockDataRule.class);
|
||||
}
|
||||
|
||||
public List<MockDataRulePojo> selectByProjectIdAndTableName(Integer projectId, String tableName) {
|
||||
public List<MockDataRule> selectByProjectIdAndTableName(Integer projectId, String tableName) {
|
||||
return this.getDslContext()
|
||||
.selectFrom(MOCK_DATA_RULE)
|
||||
.where(MOCK_DATA_RULE.PROJECT_ID.eq(projectId)
|
||||
.and(MOCK_DATA_RULE.TABLE_NAME.eq(tableName)))
|
||||
.fetchInto(MockDataRulePojo.class);
|
||||
.fetchInto(MockDataRule.class);
|
||||
}
|
||||
|
||||
public void batchSave(Collection<MockDataRulePojo> data) {
|
||||
public void batchSave(Collection<MockDataRule> data) {
|
||||
if (data == null || data.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.exception.DataNotExistsException;
|
||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
||||
import com.databasir.dao.tables.pojos.OauthApp;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -12,23 +12,23 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.OAUTH_APP;
|
||||
|
||||
@Repository
|
||||
public class OauthAppDao extends BaseDao<OauthAppPojo> {
|
||||
public class OauthAppDao extends BaseDao<OauthApp> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public OauthAppDao() {
|
||||
super(OAUTH_APP, OauthAppPojo.class);
|
||||
super(OAUTH_APP, OauthApp.class);
|
||||
}
|
||||
|
||||
public Optional<OauthAppPojo> selectOptionByRegistrationId(String registrationId) {
|
||||
public Optional<OauthApp> selectOptionByRegistrationId(String registrationId) {
|
||||
return this.getDslContext()
|
||||
.select(OAUTH_APP.fields()).from(OAUTH_APP).where(OAUTH_APP.REGISTRATION_ID.eq(registrationId))
|
||||
.fetchOptionalInto(OauthAppPojo.class);
|
||||
.fetchOptionalInto(OauthApp.class);
|
||||
}
|
||||
|
||||
public OauthAppPojo selectByRegistrationId(String registrationId) {
|
||||
public OauthApp selectByRegistrationId(String registrationId) {
|
||||
return this.selectOptionByRegistrationId(registrationId)
|
||||
.orElseThrow(() -> new DataNotExistsException("can not found oauth app by " + registrationId));
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.OperationLogPojo;
|
||||
import com.databasir.dao.tables.pojos.OperationLog;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -11,14 +11,14 @@ import java.io.Serializable;
|
||||
import static com.databasir.dao.Tables.OPERATION_LOG;
|
||||
|
||||
@Repository
|
||||
public class OperationLogDao extends BaseDao<OperationLogPojo> {
|
||||
public class OperationLogDao extends BaseDao<OperationLog> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public OperationLogDao() {
|
||||
super(OPERATION_LOG, OperationLogPojo.class);
|
||||
super(OPERATION_LOG, OperationLog.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
||||
import com.databasir.dao.tables.pojos.Project;
|
||||
import com.databasir.dao.value.GroupProjectCountPojo;
|
||||
import lombok.Getter;
|
||||
import org.jooq.Condition;
|
||||
@@ -23,14 +23,14 @@ import static com.databasir.dao.Tables.DATA_SOURCE;
|
||||
import static com.databasir.dao.Tables.PROJECT;
|
||||
|
||||
@Repository
|
||||
public class ProjectDao extends BaseDao<ProjectPojo> {
|
||||
public class ProjectDao extends BaseDao<Project> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public ProjectDao() {
|
||||
super(PROJECT, ProjectPojo.class);
|
||||
super(PROJECT, Project.class);
|
||||
}
|
||||
|
||||
public int updateDeletedById(boolean b, Integer projectId) {
|
||||
@@ -41,11 +41,11 @@ public class ProjectDao extends BaseDao<ProjectPojo> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Serializable> Optional<ProjectPojo> selectOptionalById(T id) {
|
||||
public <T extends Serializable> Optional<Project> selectOptionalById(T id) {
|
||||
return getDslContext()
|
||||
.select(PROJECT.fields()).from(PROJECT)
|
||||
.where(identity().eq(id).and(PROJECT.DELETED.eq(false)))
|
||||
.fetchOptionalInto(ProjectPojo.class);
|
||||
.fetchOptionalInto(Project.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,19 +60,19 @@ public class ProjectDao extends BaseDao<ProjectPojo> {
|
||||
.and(PROJECT.DELETED.eq(false)));
|
||||
}
|
||||
|
||||
public Page<ProjectPojo> selectByCondition(Pageable request, Condition condition) {
|
||||
public Page<Project> selectByCondition(Pageable request, Condition condition) {
|
||||
int total = getDslContext()
|
||||
.selectCount().from(PROJECT)
|
||||
.innerJoin(DATA_SOURCE).on(DATA_SOURCE.PROJECT_ID.eq(PROJECT.ID))
|
||||
.where(condition)
|
||||
.fetchOne(0, int.class);
|
||||
List<ProjectPojo> data = getDslContext()
|
||||
List<Project> data = getDslContext()
|
||||
.select(PROJECT.fields()).from(PROJECT)
|
||||
.innerJoin(DATA_SOURCE).on(DATA_SOURCE.PROJECT_ID.eq(PROJECT.ID))
|
||||
.where(condition)
|
||||
.orderBy(getSortFields(request.getSort()))
|
||||
.offset(request.getOffset()).limit(request.getPageSize())
|
||||
.fetchInto(ProjectPojo.class);
|
||||
.fetchInto(Project.class);
|
||||
return new PageImpl<>(data, request, total);
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.exception.DataNotExistsException;
|
||||
import com.databasir.dao.tables.ProjectSyncRule;
|
||||
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo;
|
||||
import com.databasir.dao.tables.ProjectSyncRuleTable;
|
||||
import com.databasir.dao.tables.pojos.ProjectSyncRule;
|
||||
import com.databasir.dao.tables.records.ProjectSyncRuleRecord;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -16,35 +16,35 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.PROJECT_SYNC_RULE;
|
||||
|
||||
@Repository
|
||||
public class ProjectSyncRuleDao extends BaseDao<ProjectSyncRulePojo> {
|
||||
public class ProjectSyncRuleDao extends BaseDao<ProjectSyncRule> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public ProjectSyncRuleDao() {
|
||||
super(PROJECT_SYNC_RULE, ProjectSyncRulePojo.class);
|
||||
super(PROJECT_SYNC_RULE, ProjectSyncRule.class);
|
||||
}
|
||||
|
||||
public Optional<ProjectSyncRulePojo> selectOptionalByProjectId(Integer projectId) {
|
||||
public Optional<ProjectSyncRule> selectOptionalByProjectId(Integer projectId) {
|
||||
return getDslContext()
|
||||
.select(PROJECT_SYNC_RULE.fields()).from(PROJECT_SYNC_RULE)
|
||||
.where(PROJECT_SYNC_RULE.PROJECT_ID.eq(projectId))
|
||||
.fetchOptionalInto(ProjectSyncRulePojo.class);
|
||||
.fetchOptionalInto(ProjectSyncRule.class);
|
||||
}
|
||||
|
||||
public ProjectSyncRulePojo selectByProjectId(Integer projectId) {
|
||||
public ProjectSyncRule selectByProjectId(Integer projectId) {
|
||||
return getDslContext()
|
||||
.select(PROJECT_SYNC_RULE.fields()).from(PROJECT_SYNC_RULE)
|
||||
.where(PROJECT_SYNC_RULE.PROJECT_ID.eq(projectId))
|
||||
.fetchOptionalInto(ProjectSyncRulePojo.class)
|
||||
.fetchOptionalInto(ProjectSyncRule.class)
|
||||
.orElseThrow(() -> new DataNotExistsException("data not exists in "
|
||||
+ table().getName()
|
||||
+ " with projectId = " + projectId));
|
||||
}
|
||||
|
||||
public int updateByProjectId(ProjectSyncRulePojo rule) {
|
||||
ProjectSyncRule table = PROJECT_SYNC_RULE;
|
||||
public int updateByProjectId(ProjectSyncRule rule) {
|
||||
ProjectSyncRuleTable table = PROJECT_SYNC_RULE;
|
||||
ProjectSyncRuleRecord record = getDslContext().newRecord(table, rule);
|
||||
record.changed(table.ID, false);
|
||||
record.changed(table.PROJECT_ID, false);
|
||||
@@ -59,16 +59,16 @@ public class ProjectSyncRuleDao extends BaseDao<ProjectSyncRulePojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public List<ProjectSyncRulePojo> selectInProjectIds(List<Integer> projectIds) {
|
||||
public List<ProjectSyncRule> selectInProjectIds(List<Integer> projectIds) {
|
||||
if (projectIds == null || projectIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getDslContext()
|
||||
.selectFrom(PROJECT_SYNC_RULE).where(PROJECT_SYNC_RULE.PROJECT_ID.in(projectIds))
|
||||
.fetchInto(ProjectSyncRulePojo.class);
|
||||
.fetchInto(ProjectSyncRule.class);
|
||||
}
|
||||
|
||||
public List<ProjectSyncRulePojo> selectByIsAutoSyncAndProjectIds(boolean isAutoSync, List<Integer> projectIds) {
|
||||
public List<ProjectSyncRule> selectByIsAutoSyncAndProjectIds(boolean isAutoSync, List<Integer> projectIds) {
|
||||
if (projectIds == null || projectIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -77,21 +77,21 @@ public class ProjectSyncRuleDao extends BaseDao<ProjectSyncRulePojo> {
|
||||
PROJECT_SYNC_RULE.IS_AUTO_SYNC.eq(isAutoSync)
|
||||
.and(PROJECT_SYNC_RULE.PROJECT_ID.in(projectIds))
|
||||
)
|
||||
.fetchInto(ProjectSyncRulePojo.class);
|
||||
.fetchInto(ProjectSyncRule.class);
|
||||
}
|
||||
|
||||
public List<ProjectSyncRulePojo> selectByIsAutoSyncAndNotInProjectIds(boolean isAutoSync,
|
||||
public List<ProjectSyncRule> selectByIsAutoSyncAndNotInProjectIds(boolean isAutoSync,
|
||||
List<Integer> projectIds) {
|
||||
if (projectIds == null || projectIds.isEmpty()) {
|
||||
return getDslContext()
|
||||
.selectFrom(PROJECT_SYNC_RULE)
|
||||
.where(PROJECT_SYNC_RULE.IS_AUTO_SYNC.eq(isAutoSync)
|
||||
.and(PROJECT_SYNC_RULE.PROJECT_ID.notIn(projectIds)))
|
||||
.fetchInto(ProjectSyncRulePojo.class);
|
||||
.fetchInto(ProjectSyncRule.class);
|
||||
} else {
|
||||
return getDslContext()
|
||||
.selectFrom(PROJECT_SYNC_RULE).where(PROJECT_SYNC_RULE.IS_AUTO_SYNC.eq(isAutoSync))
|
||||
.fetchInto(ProjectSyncRulePojo.class);
|
||||
.fetchInto(ProjectSyncRule.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.enums.ProjectSyncTaskStatus;
|
||||
import com.databasir.dao.tables.pojos.ProjectSyncTaskPojo;
|
||||
import com.databasir.dao.tables.pojos.ProjectSyncTask;
|
||||
import com.databasir.dao.tables.records.ProjectSyncTaskRecord;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -16,14 +16,14 @@ import java.util.List;
|
||||
import static com.databasir.dao.Tables.PROJECT_SYNC_TASK;
|
||||
|
||||
@Repository
|
||||
public class ProjectSyncTaskDao extends BaseDao<ProjectSyncTaskPojo> {
|
||||
public class ProjectSyncTaskDao extends BaseDao<ProjectSyncTask> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public ProjectSyncTaskDao() {
|
||||
super(PROJECT_SYNC_TASK, ProjectSyncTaskPojo.class);
|
||||
super(PROJECT_SYNC_TASK, ProjectSyncTask.class);
|
||||
}
|
||||
|
||||
public boolean existsByProjectId(Integer projectId, Collection<ProjectSyncTaskStatus> statusIn) {
|
||||
@@ -34,13 +34,13 @@ public class ProjectSyncTaskDao extends BaseDao<ProjectSyncTaskPojo> {
|
||||
PROJECT_SYNC_TASK.PROJECT_ID.eq(projectId).and(PROJECT_SYNC_TASK.STATUS.in(statusIn)));
|
||||
}
|
||||
|
||||
public List<ProjectSyncTaskPojo> listNewTasks(Integer size) {
|
||||
public List<ProjectSyncTask> listNewTasks(Integer size) {
|
||||
return dslContext
|
||||
.selectFrom(PROJECT_SYNC_TASK)
|
||||
.where(PROJECT_SYNC_TASK.STATUS.eq(ProjectSyncTaskStatus.NEW))
|
||||
.orderBy(PROJECT_SYNC_TASK.ID.asc())
|
||||
.limit(size)
|
||||
.fetchInto(ProjectSyncTaskPojo.class);
|
||||
.fetchInto(ProjectSyncTask.class);
|
||||
}
|
||||
|
||||
public int updateStatusAndResultById(Integer taskId, ProjectSyncTaskStatus status, String result) {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.exception.DataNotExistsException;
|
||||
import com.databasir.dao.tables.pojos.SysKeyPojo;
|
||||
import com.databasir.dao.tables.pojos.SysKey;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -12,23 +12,23 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.SYS_KEY;
|
||||
|
||||
@Repository
|
||||
public class SysKeyDao extends BaseDao<SysKeyPojo> {
|
||||
public class SysKeyDao extends BaseDao<SysKey> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public SysKeyDao() {
|
||||
super(SYS_KEY, SysKeyPojo.class);
|
||||
super(SYS_KEY, SysKey.class);
|
||||
}
|
||||
|
||||
public Optional<SysKeyPojo> selectOptionTopOne() {
|
||||
public Optional<SysKey> selectOptionTopOne() {
|
||||
return dslContext.select(SYS_KEY.fields()).from(SYS_KEY)
|
||||
.limit(1)
|
||||
.fetchOptionalInto(SysKeyPojo.class);
|
||||
.fetchOptionalInto(SysKey.class);
|
||||
}
|
||||
|
||||
public SysKeyPojo selectTopOne() {
|
||||
public SysKey selectTopOne() {
|
||||
return selectOptionTopOne()
|
||||
.orElseThrow(() -> new DataNotExistsException("no syskey data find"));
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.exception.DataNotExistsException;
|
||||
import com.databasir.dao.tables.pojos.SysMailPojo;
|
||||
import com.databasir.dao.tables.pojos.SysMail;
|
||||
import com.databasir.dao.tables.records.SysMailRecord;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -13,29 +13,29 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.SYS_MAIL;
|
||||
|
||||
@Repository
|
||||
public class SysMailDao extends BaseDao<SysMailPojo> {
|
||||
public class SysMailDao extends BaseDao<SysMail> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public SysMailDao() {
|
||||
super(SYS_MAIL, SysMailPojo.class);
|
||||
super(SYS_MAIL, SysMail.class);
|
||||
}
|
||||
|
||||
public Optional<SysMailPojo> selectOptionTopOne() {
|
||||
public Optional<SysMail> selectOptionTopOne() {
|
||||
return dslContext.select(SYS_MAIL.fields()).from(SYS_MAIL)
|
||||
.limit(1)
|
||||
.fetchOptionalInto(SysMailPojo.class);
|
||||
.fetchOptionalInto(SysMail.class);
|
||||
}
|
||||
|
||||
public SysMailPojo selectTopOne() {
|
||||
public SysMail selectTopOne() {
|
||||
return selectOptionTopOne()
|
||||
.orElseThrow(() -> new DataNotExistsException("no sysmail data find"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateById(SysMailPojo pojo) {
|
||||
public int updateById(SysMail pojo) {
|
||||
SysMailRecord record = getDslContext().newRecord(SYS_MAIL, pojo);
|
||||
record.changed(SYS_MAIL.ID, false);
|
||||
if (pojo.getPassword() == null) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.TableColumnDocumentPojo;
|
||||
import com.databasir.dao.tables.pojos.TableColumnDocument;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,24 +13,24 @@ import java.util.List;
|
||||
import static com.databasir.dao.Tables.TABLE_COLUMN_DOCUMENT;
|
||||
|
||||
@Repository
|
||||
public class TableColumnDocumentDao extends BaseDao<TableColumnDocumentPojo> {
|
||||
public class TableColumnDocumentDao extends BaseDao<TableColumnDocument> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public TableColumnDocumentDao() {
|
||||
super(TABLE_COLUMN_DOCUMENT, TableColumnDocumentPojo.class);
|
||||
super(TABLE_COLUMN_DOCUMENT, TableColumnDocument.class);
|
||||
}
|
||||
|
||||
public List<TableColumnDocumentPojo> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||
public List<TableColumnDocument> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||
return getDslContext()
|
||||
.select(TABLE_COLUMN_DOCUMENT.fields()).from(TABLE_COLUMN_DOCUMENT)
|
||||
.where(TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
||||
.fetchInto(TableColumnDocumentPojo.class);
|
||||
.fetchInto(TableColumnDocument.class);
|
||||
}
|
||||
|
||||
public List<TableColumnDocumentPojo> selectByDatabaseDocumentIdAndTableIdIn(Integer schemaDocumentId,
|
||||
public List<TableColumnDocument> selectByDatabaseDocumentIdAndTableIdIn(Integer schemaDocumentId,
|
||||
Collection<Integer> tableIdIn) {
|
||||
if (tableIdIn == null || tableIdIn.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
@@ -39,14 +39,14 @@ public class TableColumnDocumentDao extends BaseDao<TableColumnDocumentPojo> {
|
||||
.select(TABLE_COLUMN_DOCUMENT.fields()).from(TABLE_COLUMN_DOCUMENT)
|
||||
.where(TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId)
|
||||
.and(TABLE_COLUMN_DOCUMENT.TABLE_DOCUMENT_ID.in(tableIdIn)))
|
||||
.fetchInto(TableColumnDocumentPojo.class);
|
||||
.fetchInto(TableColumnDocument.class);
|
||||
}
|
||||
|
||||
public List<TableColumnDocumentPojo> selectByTableDocumentId(Integer tableDocumentId) {
|
||||
public List<TableColumnDocument> selectByTableDocumentId(Integer tableDocumentId) {
|
||||
return getDslContext()
|
||||
.selectFrom(TABLE_COLUMN_DOCUMENT)
|
||||
.where(TABLE_COLUMN_DOCUMENT.TABLE_DOCUMENT_ID.eq(tableDocumentId))
|
||||
.fetchInto(TableColumnDocumentPojo.class);
|
||||
.fetchInto(TableColumnDocument.class);
|
||||
}
|
||||
|
||||
public boolean exists(Integer tableDocumentId, String columnName) {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.TableColumnDocumentPojo;
|
||||
import com.databasir.dao.tables.pojos.TableDocumentPojo;
|
||||
import com.databasir.dao.tables.pojos.TableColumnDocument;
|
||||
import com.databasir.dao.tables.pojos.TableDocument;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -15,24 +15,24 @@ import java.util.Optional;
|
||||
import static com.databasir.dao.Tables.TABLE_DOCUMENT;
|
||||
|
||||
@Repository
|
||||
public class TableDocumentDao extends BaseDao<TableDocumentPojo> {
|
||||
public class TableDocumentDao extends BaseDao<TableDocument> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public TableDocumentDao() {
|
||||
super(TABLE_DOCUMENT, TableDocumentPojo.class);
|
||||
super(TABLE_DOCUMENT, TableDocument.class);
|
||||
}
|
||||
|
||||
public List<TableDocumentPojo> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||
public List<TableDocument> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||
return getDslContext()
|
||||
.select(TABLE_DOCUMENT.fields()).from(TABLE_DOCUMENT)
|
||||
.where(TABLE_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
||||
.fetchInto(TableDocumentPojo.class);
|
||||
.fetchInto(TableDocument.class);
|
||||
}
|
||||
|
||||
public List<TableDocumentPojo> selectByDatabaseDocumentIdAndIdIn(Integer databaseDocumentId,
|
||||
public List<TableDocument> selectByDatabaseDocumentIdAndIdIn(Integer databaseDocumentId,
|
||||
Collection<Integer> idList) {
|
||||
if (idList == null || idList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
@@ -41,25 +41,25 @@ public class TableDocumentDao extends BaseDao<TableDocumentPojo> {
|
||||
.selectFrom(TABLE_DOCUMENT)
|
||||
.where(TABLE_DOCUMENT.DATABASE_DOCUMENT_ID.eq(databaseDocumentId)
|
||||
.and(TABLE_DOCUMENT.ID.in(idList)))
|
||||
.fetchInto(TableDocumentPojo.class);
|
||||
.fetchInto(TableDocument.class);
|
||||
}
|
||||
|
||||
public Optional<TableColumnDocumentPojo> selectByDatabaseDocumentIdAndTableName(Integer databaseDocumentId,
|
||||
public Optional<TableColumnDocument> selectByDatabaseDocumentIdAndTableName(Integer databaseDocumentId,
|
||||
String tableName) {
|
||||
return getDslContext()
|
||||
.select(TABLE_DOCUMENT.fields()).from(TABLE_DOCUMENT)
|
||||
.where(TABLE_DOCUMENT.DATABASE_DOCUMENT_ID.eq(databaseDocumentId)
|
||||
.and(TABLE_DOCUMENT.NAME.eq(tableName)))
|
||||
.fetchOptionalInto(TableColumnDocumentPojo.class);
|
||||
.fetchOptionalInto(TableColumnDocument.class);
|
||||
}
|
||||
|
||||
public Optional<TableDocumentPojo> selectByDatabaseDocumentIdAndId(Integer databaseDocumentId,
|
||||
public Optional<TableDocument> selectByDatabaseDocumentIdAndId(Integer databaseDocumentId,
|
||||
Integer id) {
|
||||
return getDslContext()
|
||||
.selectFrom(TABLE_DOCUMENT)
|
||||
.where(TABLE_DOCUMENT.DATABASE_DOCUMENT_ID.eq(databaseDocumentId)
|
||||
.and(TABLE_DOCUMENT.ID.eq(id)))
|
||||
.fetchOptionalInto(TableDocumentPojo.class);
|
||||
.fetchOptionalInto(TableDocument.class);
|
||||
}
|
||||
|
||||
public List<Integer> selectTableIdsByDatabaseDocumentIdAndTableNameIn(Integer databaseDocumentId,
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.TableForeignKeyDocumentPojo;
|
||||
import com.databasir.dao.tables.pojos.TableForeignKeyDocument;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,24 +13,24 @@ import java.util.List;
|
||||
import static com.databasir.dao.Tables.TABLE_FOREIGN_KEY_DOCUMENT;
|
||||
|
||||
@Repository
|
||||
public class TableForeignKeyDocumentDao extends BaseDao<TableForeignKeyDocumentPojo> {
|
||||
public class TableForeignKeyDocumentDao extends BaseDao<TableForeignKeyDocument> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public TableForeignKeyDocumentDao() {
|
||||
super(TABLE_FOREIGN_KEY_DOCUMENT, TableForeignKeyDocumentPojo.class);
|
||||
super(TABLE_FOREIGN_KEY_DOCUMENT, TableForeignKeyDocument.class);
|
||||
}
|
||||
|
||||
public List<TableForeignKeyDocumentPojo> selectByDatabaseDocumentId(Integer databaseDocumentId) {
|
||||
public List<TableForeignKeyDocument> selectByDatabaseDocumentId(Integer databaseDocumentId) {
|
||||
return getDslContext()
|
||||
.selectFrom(TABLE_FOREIGN_KEY_DOCUMENT)
|
||||
.where(TABLE_FOREIGN_KEY_DOCUMENT.DATABASE_DOCUMENT_ID.eq(databaseDocumentId))
|
||||
.fetchInto(TableForeignKeyDocumentPojo.class);
|
||||
.fetchInto(TableForeignKeyDocument.class);
|
||||
}
|
||||
|
||||
public List<TableForeignKeyDocumentPojo> selectByDatabaseDocumentIdAndTableIdIn(Integer databaseDocumentId,
|
||||
public List<TableForeignKeyDocument> selectByDatabaseDocumentIdAndTableIdIn(Integer databaseDocumentId,
|
||||
Collection<Integer> tableIdIn) {
|
||||
if (tableIdIn == null || tableIdIn.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
@@ -39,6 +39,6 @@ public class TableForeignKeyDocumentDao extends BaseDao<TableForeignKeyDocumentP
|
||||
.selectFrom(TABLE_FOREIGN_KEY_DOCUMENT)
|
||||
.where(TABLE_FOREIGN_KEY_DOCUMENT.DATABASE_DOCUMENT_ID.eq(databaseDocumentId)
|
||||
.and(TABLE_FOREIGN_KEY_DOCUMENT.TABLE_DOCUMENT_ID.in(tableIdIn)))
|
||||
.fetchInto(TableForeignKeyDocumentPojo.class);
|
||||
.fetchInto(TableForeignKeyDocument.class);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.TableIndexDocumentPojo;
|
||||
import com.databasir.dao.tables.pojos.TableIndexDocument;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,24 +13,24 @@ import java.util.List;
|
||||
import static com.databasir.dao.Tables.TABLE_INDEX_DOCUMENT;
|
||||
|
||||
@Repository
|
||||
public class TableIndexDocumentDao extends BaseDao<TableIndexDocumentPojo> {
|
||||
public class TableIndexDocumentDao extends BaseDao<TableIndexDocument> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public TableIndexDocumentDao() {
|
||||
super(TABLE_INDEX_DOCUMENT, TableIndexDocumentPojo.class);
|
||||
super(TABLE_INDEX_DOCUMENT, TableIndexDocument.class);
|
||||
}
|
||||
|
||||
public List<TableIndexDocumentPojo> selectByDatabaseMetaId(Integer documentId) {
|
||||
public List<TableIndexDocument> selectByDatabaseMetaId(Integer documentId) {
|
||||
return getDslContext()
|
||||
.select(TABLE_INDEX_DOCUMENT.fields()).from(TABLE_INDEX_DOCUMENT)
|
||||
.where(TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID.eq(documentId))
|
||||
.fetchInto(TableIndexDocumentPojo.class);
|
||||
.fetchInto(TableIndexDocument.class);
|
||||
}
|
||||
|
||||
public List<TableIndexDocumentPojo> selectByDatabaseDocumentIdAndIdIn(Integer documentId,
|
||||
public List<TableIndexDocument> selectByDatabaseDocumentIdAndIdIn(Integer documentId,
|
||||
Collection<Integer> tableIdIn) {
|
||||
if (tableIdIn == null || tableIdIn.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
@@ -39,6 +39,6 @@ public class TableIndexDocumentDao extends BaseDao<TableIndexDocumentPojo> {
|
||||
.select(TABLE_INDEX_DOCUMENT.fields()).from(TABLE_INDEX_DOCUMENT)
|
||||
.where(TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID.eq(documentId)
|
||||
.and(TABLE_INDEX_DOCUMENT.TABLE_DOCUMENT_ID.in(tableIdIn)))
|
||||
.fetchInto(TableIndexDocumentPojo.class);
|
||||
.fetchInto(TableIndexDocument.class);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.TableTriggerDocumentPojo;
|
||||
import com.databasir.dao.tables.pojos.TableTriggerDocument;
|
||||
import lombok.Getter;
|
||||
import org.jooq.DSLContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -13,24 +13,24 @@ import java.util.List;
|
||||
import static com.databasir.dao.Tables.TABLE_TRIGGER_DOCUMENT;
|
||||
|
||||
@Repository
|
||||
public class TableTriggerDocumentDao extends BaseDao<TableTriggerDocumentPojo> {
|
||||
public class TableTriggerDocumentDao extends BaseDao<TableTriggerDocument> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public TableTriggerDocumentDao() {
|
||||
super(TABLE_TRIGGER_DOCUMENT, TableTriggerDocumentPojo.class);
|
||||
super(TABLE_TRIGGER_DOCUMENT, TableTriggerDocument.class);
|
||||
}
|
||||
|
||||
public List<TableTriggerDocumentPojo> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||
public List<TableTriggerDocument> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||
return getDslContext()
|
||||
.select(TABLE_TRIGGER_DOCUMENT.fields()).from(TABLE_TRIGGER_DOCUMENT)
|
||||
.where(TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
||||
.fetchInto(TableTriggerDocumentPojo.class);
|
||||
.fetchInto(TableTriggerDocument.class);
|
||||
}
|
||||
|
||||
public List<TableTriggerDocumentPojo> selectByDatabaseDocumentIdAndIdIn(Integer documentId,
|
||||
public List<TableTriggerDocument> selectByDatabaseDocumentIdAndIdIn(Integer documentId,
|
||||
Collection<Integer> tableIdIn) {
|
||||
if (tableIdIn == null || tableIdIn.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
@@ -39,6 +39,6 @@ public class TableTriggerDocumentDao extends BaseDao<TableTriggerDocumentPojo> {
|
||||
.select(TABLE_TRIGGER_DOCUMENT.fields()).from(TABLE_TRIGGER_DOCUMENT)
|
||||
.where(TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID.eq(documentId)
|
||||
.and(TABLE_TRIGGER_DOCUMENT.TABLE_DOCUMENT_ID.in(tableIdIn)))
|
||||
.fetchInto(TableTriggerDocumentPojo.class);
|
||||
.fetchInto(TableTriggerDocument.class);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.Databasir;
|
||||
import com.databasir.dao.tables.pojos.UserPojo;
|
||||
import com.databasir.dao.tables.pojos.User;
|
||||
import com.databasir.dao.value.GroupMemberDetailPojo;
|
||||
import lombok.Getter;
|
||||
import org.jooq.Condition;
|
||||
@@ -22,14 +22,14 @@ import static com.databasir.dao.Tables.USER;
|
||||
import static com.databasir.dao.Tables.USER_ROLE;
|
||||
|
||||
@Repository
|
||||
public class UserDao extends BaseDao<UserPojo> {
|
||||
public class UserDao extends BaseDao<User> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public UserDao() {
|
||||
super(USER, UserPojo.class);
|
||||
super(USER, User.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,17 +73,17 @@ public class UserDao extends BaseDao<UserPojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public List<UserPojo> selectUserIdIn(Collection<Integer> userIds) {
|
||||
public List<User> selectUserIdIn(Collection<Integer> userIds) {
|
||||
if (userIds == null || userIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return dslContext
|
||||
.select(USER.fields()).from(USER)
|
||||
.where(USER.ID.in(userIds).and(USER.DELETED.eq(false)))
|
||||
.fetchInto(UserPojo.class);
|
||||
.fetchInto(User.class);
|
||||
}
|
||||
|
||||
public List<UserPojo> selectLimitUsersByRoleAndGroup(Integer groupId,
|
||||
public List<User> selectLimitUsersByRoleAndGroup(Integer groupId,
|
||||
String role,
|
||||
Integer size) {
|
||||
return dslContext
|
||||
@@ -93,30 +93,30 @@ public class UserDao extends BaseDao<UserPojo> {
|
||||
.and(USER_ROLE.GROUP_ID.eq(groupId).and(USER_ROLE.ROLE.eq(role))))
|
||||
.orderBy(USER_ROLE.ID.desc())
|
||||
.limit(size)
|
||||
.fetchInto(UserPojo.class);
|
||||
.fetchInto(User.class);
|
||||
}
|
||||
|
||||
public Optional<UserPojo> selectByEmail(String email) {
|
||||
public Optional<User> selectByEmail(String email) {
|
||||
return dslContext
|
||||
.select(USER.fields()).from(USER)
|
||||
.where(USER.EMAIL.eq(email).and(USER.DELETED.eq(false)))
|
||||
.fetchOptionalInto(UserPojo.class);
|
||||
.fetchOptionalInto(User.class);
|
||||
}
|
||||
|
||||
public Optional<UserPojo> selectByEmailOrUsername(String emailOrUsername) {
|
||||
public Optional<User> selectByEmailOrUsername(String emailOrUsername) {
|
||||
return dslContext
|
||||
.select(USER.fields()).from(USER)
|
||||
.where(USER.DELETED.eq(false)
|
||||
.and(USER.EMAIL.eq(emailOrUsername).or(USER.USERNAME.eq(emailOrUsername))))
|
||||
.fetchOptionalInto(UserPojo.class);
|
||||
.fetchOptionalInto(User.class);
|
||||
}
|
||||
|
||||
public List<UserPojo> selectEnabledGroupMembers(Integer groupId) {
|
||||
public List<User> selectEnabledGroupMembers(Integer groupId) {
|
||||
return dslContext.select(USER.fields()).from(USER)
|
||||
.innerJoin(USER_ROLE).on(USER.ID.eq(USER_ROLE.USER_ID))
|
||||
.where(USER.DELETED.eq(false)
|
||||
.and(USER_ROLE.GROUP_ID.eq(groupId).and(USER.ENABLED.eq(true))))
|
||||
.fetchInto(UserPojo.class);
|
||||
.fetchInto(User.class);
|
||||
}
|
||||
|
||||
public Page<GroupMemberDetailPojo> selectGroupMembers(Integer groupId, Pageable request, Condition condition) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.UserFavoriteProjectPojo;
|
||||
import com.databasir.dao.tables.pojos.UserFavoriteProject;
|
||||
import lombok.Getter;
|
||||
import org.jooq.Condition;
|
||||
import org.jooq.DSLContext;
|
||||
@@ -16,14 +16,14 @@ import java.util.List;
|
||||
import static com.databasir.dao.Tables.*;
|
||||
|
||||
@Repository
|
||||
public class UserFavoriteProjectDao extends BaseDao<UserFavoriteProjectPojo> {
|
||||
public class UserFavoriteProjectDao extends BaseDao<UserFavoriteProject> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public UserFavoriteProjectDao() {
|
||||
super(USER_FAVORITE_PROJECT, UserFavoriteProjectPojo.class);
|
||||
super(USER_FAVORITE_PROJECT, UserFavoriteProject.class);
|
||||
}
|
||||
|
||||
public boolean exists(Integer userId, Integer projectId) {
|
||||
@@ -32,7 +32,7 @@ public class UserFavoriteProjectDao extends BaseDao<UserFavoriteProjectPojo> {
|
||||
}
|
||||
|
||||
public void insert(Integer userId, Integer projectId) {
|
||||
UserFavoriteProjectPojo pojo = new UserFavoriteProjectPojo();
|
||||
UserFavoriteProject pojo = new UserFavoriteProject();
|
||||
pojo.setUserId(userId);
|
||||
pojo.setProjectId(projectId);
|
||||
this.insertAndReturnId(pojo);
|
||||
@@ -43,31 +43,31 @@ public class UserFavoriteProjectDao extends BaseDao<UserFavoriteProjectPojo> {
|
||||
.and(USER_FAVORITE_PROJECT.PROJECT_ID.eq(projectId)));
|
||||
}
|
||||
|
||||
public Page<UserFavoriteProjectPojo> selectByCondition(Pageable request, Condition condition) {
|
||||
public Page<UserFavoriteProject> selectByCondition(Pageable request, Condition condition) {
|
||||
int total = getDslContext()
|
||||
.selectCount().from(USER_FAVORITE_PROJECT)
|
||||
.innerJoin(USER).on(USER.ID.eq(USER_FAVORITE_PROJECT.USER_ID))
|
||||
.innerJoin(PROJECT).on(PROJECT.ID.eq(USER_FAVORITE_PROJECT.PROJECT_ID))
|
||||
.where(PROJECT.DELETED.eq(false).and(condition))
|
||||
.fetchOne(0, int.class);
|
||||
List<UserFavoriteProjectPojo> data = getDslContext()
|
||||
List<UserFavoriteProject> data = getDslContext()
|
||||
.select(USER_FAVORITE_PROJECT.fields()).from(USER_FAVORITE_PROJECT)
|
||||
.innerJoin(USER).on(USER.ID.eq(USER_FAVORITE_PROJECT.USER_ID))
|
||||
.innerJoin(PROJECT).on(PROJECT.ID.eq(USER_FAVORITE_PROJECT.PROJECT_ID))
|
||||
.where(PROJECT.DELETED.eq(false).and(condition))
|
||||
.orderBy(getSortFields(request.getSort()))
|
||||
.offset(request.getOffset()).limit(request.getPageSize())
|
||||
.fetchInto(UserFavoriteProjectPojo.class);
|
||||
.fetchInto(UserFavoriteProject.class);
|
||||
return new PageImpl<>(data, request, total);
|
||||
}
|
||||
|
||||
public List<UserFavoriteProjectPojo> selectByUserIdAndProjectIds(Integer userId, List<Integer> projectIds) {
|
||||
public List<UserFavoriteProject> selectByUserIdAndProjectIds(Integer userId, List<Integer> projectIds) {
|
||||
if (projectIds == null || projectIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return this.getDslContext()
|
||||
.select(USER_FAVORITE_PROJECT.fields()).from(USER_FAVORITE_PROJECT)
|
||||
.where(USER_FAVORITE_PROJECT.USER_ID.eq(userId).and(USER_FAVORITE_PROJECT.PROJECT_ID.in(projectIds)))
|
||||
.fetchInto(UserFavoriteProjectPojo.class);
|
||||
.fetchInto(UserFavoriteProject.class);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
||||
import com.databasir.dao.tables.pojos.UserRole;
|
||||
import com.databasir.dao.value.GroupMemberSimplePojo;
|
||||
import lombok.Getter;
|
||||
import org.jooq.Condition;
|
||||
@@ -17,14 +17,14 @@ import static com.databasir.dao.Tables.USER;
|
||||
import static com.databasir.dao.Tables.USER_ROLE;
|
||||
|
||||
@Repository
|
||||
public class UserRoleDao extends BaseDao<UserRolePojo> {
|
||||
public class UserRoleDao extends BaseDao<UserRole> {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
private DSLContext dslContext;
|
||||
|
||||
public UserRoleDao() {
|
||||
super(USER_ROLE, UserRolePojo.class);
|
||||
super(USER_ROLE, UserRole.class);
|
||||
}
|
||||
|
||||
public List<GroupMemberSimplePojo> selectOwnerNamesByGroupIdIn(List<Integer> groupIdList) {
|
||||
@@ -43,7 +43,7 @@ public class UserRoleDao extends BaseDao<UserRolePojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public Page<UserRolePojo> selectPageByGroupId(Pageable pageable, Integer groupId) {
|
||||
public Page<UserRole> selectPageByGroupId(Pageable pageable, Integer groupId) {
|
||||
return super.selectByPage(pageable, USER_ROLE.GROUP_ID.eq(groupId));
|
||||
}
|
||||
|
||||
@@ -84,12 +84,12 @@ public class UserRoleDao extends BaseDao<UserRolePojo> {
|
||||
return dslContext.fetchExists(USER_ROLE, condition);
|
||||
}
|
||||
|
||||
public List<UserRolePojo> selectByUserIds(List<Integer> userIds) {
|
||||
public List<UserRole> selectByUserIds(List<Integer> userIds) {
|
||||
if (userIds == null || userIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return dslContext
|
||||
.select(USER_ROLE.fields()).from(USER_ROLE).where(USER_ROLE.USER_ID.in(userIds))
|
||||
.fetchInto(UserRolePojo.class);
|
||||
.fetchInto(UserRole.class);
|
||||
}
|
||||
}
|
||||
|
@@ -2,20 +2,21 @@ package com.databasir.dao.strategy;
|
||||
|
||||
import org.jooq.codegen.DefaultGeneratorStrategy;
|
||||
import org.jooq.meta.Definition;
|
||||
import org.jooq.meta.TableDefinition;
|
||||
|
||||
public class DatabasirPojoNamingStrategy extends DefaultGeneratorStrategy {
|
||||
|
||||
@Override
|
||||
public String getJavaClassName(Definition definition, Mode mode) {
|
||||
if (mode == Mode.POJO) {
|
||||
if (mode == Mode.DEFAULT && definition instanceof TableDefinition) {
|
||||
String javaClassName = super.getJavaClassName(definition, mode);
|
||||
if (javaClassName.endsWith("Pojo")) {
|
||||
if (javaClassName.endsWith("Table")) {
|
||||
return javaClassName;
|
||||
} else {
|
||||
return javaClassName + "Pojo";
|
||||
return javaClassName + "Table";
|
||||
}
|
||||
} else {
|
||||
return super.getJavaClassName(definition, mode);
|
||||
}
|
||||
|
||||
return super.getJavaClassName(definition, mode);
|
||||
}
|
||||
}
|
||||
|
@@ -413,3 +413,24 @@ CREATE TABLE document_full_text
|
||||
FULLTEXT fidx_group (group_name, group_description) WITH PARSER ngram
|
||||
) CHARSET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE aggregate
|
||||
(
|
||||
id INT PRIMARY KEY NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
project_id INT NOT NULL COMMENT 'ref to project.id',
|
||||
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX idx_project_id (project_id)
|
||||
) CHARSET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci COMMENT 'aggregate means a group of table_documents';
|
||||
|
||||
CREATE TABLE table_document_aggregate
|
||||
(
|
||||
id INT PRIMARY KEY NOT NULL,
|
||||
aggregate_id INT NOT NULL COMMENT 'ref to aggregate.id',
|
||||
table_name TEXT NOT NULL COMMENT 'ref to table_document.name',
|
||||
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX idx_aggregate_id (aggregate_id)
|
||||
) CHARSET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci COMMENT '`table document` and `aggregate` relation';
|
||||
|
Reference in New Issue
Block a user