change remark to discussion model & bug fix (#45)

* feat: change remark to discussion

* feat: change remark model to discussion model

* fix: sync duplicate column

* feat:update frontend resources

* fix: checkstyle
This commit is contained in:
vran
2022-03-13 09:46:44 +08:00
committed by GitHub
parent f026d406a2
commit e85e0e6e70
52 changed files with 604 additions and 481 deletions

View File

@@ -0,0 +1,52 @@
package com.databasir.dao.impl;
import com.databasir.dao.tables.pojos.DocumentDiscussionPojo;
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_DISCUSSION;
@Repository
public class DocumentDiscussionDao extends BaseDao<DocumentDiscussionPojo> {
@Autowired
@Getter
private DSLContext dslContext;
public DocumentDiscussionDao() {
super(DOCUMENT_DISCUSSION, DocumentDiscussionPojo.class);
}
public Optional<DocumentDiscussionPojo> 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);
}
public List<DocumentDiscussionCountPojo> selectTableDiscussionCount(Integer projectId) {
return this.selectDiscussionCount(DOCUMENT_DISCUSSION.PROJECT_ID.eq(projectId)
.and(DOCUMENT_DISCUSSION.COLUMN_NAME.isNull()));
}
public List<DocumentDiscussionCountPojo> selectAllDiscussionCount(Integer projectId) {
return this.selectDiscussionCount(DOCUMENT_DISCUSSION.PROJECT_ID.eq(projectId));
}
public List<DocumentDiscussionCountPojo> selectDiscussionCount(Condition condition) {
return this.getDslContext()
.select(DSL.count(), DOCUMENT_DISCUSSION.TABLE_NAME, DOCUMENT_DISCUSSION.COLUMN_NAME)
.from(DOCUMENT_DISCUSSION)
.where(condition)
.groupBy(DOCUMENT_DISCUSSION.TABLE_NAME, DOCUMENT_DISCUSSION.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;
}

View File

@@ -211,10 +211,10 @@ CREATE TABLE IF NOT EXISTS login
) CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS document_remark
CREATE TABLE IF NOT EXISTS document_discussion
(
id INT PRIMARY KEY AUTO_INCREMENT,
remark TEXT NOT NULL,
content TEXT NOT NULL,
user_id INT NOT NULL COMMENT 'user.id',
project_id INT NOT NULL,
table_name VARCHAR(255) NOT NULL,