mirror of
https://github.com/vran-dev/databasir.git
synced 2025-10-29 11:29:19 +08:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user