mirror of
https://github.com/vran-dev/databasir.git
synced 2025-09-21 11:19:21 +08:00
feat: support add / delete / query remark
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.databasir.dao.impl;
|
||||
|
||||
import com.databasir.dao.tables.pojos.DocumentRemarkPojo;
|
||||
import com.databasir.dao.tables.records.DocumentRemarkRecord;
|
||||
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<DocumentRemarkRecord, 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);
|
||||
}
|
||||
}
|
@@ -45,7 +45,7 @@ public class UserDao extends BaseDao<UserRecord, UserPojo> {
|
||||
.execute();
|
||||
}
|
||||
|
||||
public List<UserPojo> selectUserIdIn(List<Integer> userIds) {
|
||||
public List<UserPojo> selectUserIdIn(Collection<Integer> userIds) {
|
||||
if (userIds == null || userIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@@ -218,5 +218,18 @@ CREATE TABLE login
|
||||
update_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT UNIQUE uk_user_id (user_id)
|
||||
) CHARSET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS document_remark
|
||||
(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
remark TEXT NOT NULL,
|
||||
user_id INT NOT NULL COMMENT 'user.id',
|
||||
project_id INT NOT NULL,
|
||||
table_name VARCHAR(255) NOT NULL,
|
||||
column_name VARCHAR(255) DEFAULT NULL,
|
||||
create_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX idx_project_id (project_id)
|
||||
) CHARSET utf8mb4
|
||||
COLLATE utf8mb4_unicode_ci;
|
Reference in New Issue
Block a user