feat: change remark to discussion

This commit is contained in:
vran
2022-03-12 23:34:42 +08:00
parent f026d406a2
commit 84db78fdcd
16 changed files with 214 additions and 113 deletions

View File

@@ -0,0 +1,52 @@
package com.databasir.dao.impl;
import com.databasir.dao.tables.pojos.DocumentRemarkPojo;
import com.databasir.dao.value.DocumentDiscussionCountPojo;
import lombok.Getter;
import org.jooq.Condition;
import org.jooq.DSLContext;
import org.jooq.impl.DSL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import static com.databasir.dao.Tables.DOCUMENT_REMARK;
@Repository
public class DocumentDiscussionDao extends BaseDao<DocumentRemarkPojo> {
@Autowired
@Getter
private DSLContext dslContext;
public DocumentDiscussionDao() {
super(DOCUMENT_REMARK, DocumentRemarkPojo.class);
}
public Optional<DocumentRemarkPojo> selectByProjectIdAndId(Integer projectId, Integer id) {
return this.getDslContext()
.selectFrom(DOCUMENT_REMARK).where(DOCUMENT_REMARK.PROJECT_ID.eq(projectId)
.and(DOCUMENT_REMARK.ID.eq(id)))
.fetchOptionalInto(DocumentRemarkPojo.class);
}
public List<DocumentDiscussionCountPojo> selectTableDiscussionCount(Integer projectId) {
return this.selectDiscussionCount(DOCUMENT_REMARK.PROJECT_ID.eq(projectId)
.and(DOCUMENT_REMARK.COLUMN_NAME.isNull()));
}
public List<DocumentDiscussionCountPojo> selectAllDiscussionCount(Integer projectId) {
return this.selectDiscussionCount(DOCUMENT_REMARK.PROJECT_ID.eq(projectId));
}
public List<DocumentDiscussionCountPojo> selectDiscussionCount(Condition condition) {
return this.getDslContext()
.select(DSL.count(), DOCUMENT_REMARK.TABLE_NAME, DOCUMENT_REMARK.COLUMN_NAME)
.from(DOCUMENT_REMARK)
.where(condition)
.groupBy(DOCUMENT_REMARK.TABLE_NAME, DOCUMENT_REMARK.COLUMN_NAME)
.fetchInto(DocumentDiscussionCountPojo.class);
}
}

View File

@@ -1,30 +0,0 @@
package com.databasir.dao.impl;
import com.databasir.dao.tables.pojos.DocumentRemarkPojo;
import lombok.Getter;
import org.jooq.DSLContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Optional;
import static com.databasir.dao.Tables.DOCUMENT_REMARK;
@Repository
public class DocumentRemarkDao extends BaseDao<DocumentRemarkPojo> {
@Autowired
@Getter
private DSLContext dslContext;
public DocumentRemarkDao() {
super(DOCUMENT_REMARK, DocumentRemarkPojo.class);
}
public Optional<DocumentRemarkPojo> selectByProjectIdAndId(Integer projectId, Integer id) {
return this.getDslContext()
.selectFrom(DOCUMENT_REMARK).where(DOCUMENT_REMARK.PROJECT_ID.eq(projectId)
.and(DOCUMENT_REMARK.ID.eq(id)))
.fetchOptionalInto(DocumentRemarkPojo.class);
}
}

View File

@@ -0,0 +1,15 @@
package com.databasir.dao.value;
import lombok.Data;
@Data
public class DocumentDiscussionCountPojo {
private Integer projectId;
private String tableName;
private String columnName;
private Integer count;
}