Browse Source
* feat: generate document description model * feat: add description field to document * fix: checkstyle * feat:update frontend resourcesmaster
vran
3 years ago
committed by
GitHub
38 changed files with 1051 additions and 40 deletions
@ -0,0 +1,41 @@ |
|||||
|
package com.databasir.api; |
||||
|
|
||||
|
import com.databasir.api.config.security.DatabasirUserDetails; |
||||
|
import com.databasir.common.JsonData; |
||||
|
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest; |
||||
|
import com.databasir.core.domain.description.service.DocumentDescriptionService; |
||||
|
import com.databasir.core.domain.log.annotation.Operation; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.security.core.context.SecurityContextHolder; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
|
||||
|
@RestController |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
public class DocumentDescriptionController { |
||||
|
|
||||
|
private final DocumentDescriptionService documentDescriptionService; |
||||
|
|
||||
|
@PostMapping(Routes.DocumentDescription.SAVE) |
||||
|
@PreAuthorize("hasAnyAuthority('SYS_OWNER', 'GROUP_OWNER?groupId='+#groupId, 'GROUP_MEMBER?groupId='+#groupId)") |
||||
|
@Operation(module = Operation.Modules.PROJECT, |
||||
|
name = "更新描述", |
||||
|
involvedProjectId = "#projectId") |
||||
|
public JsonData<Void> save(@PathVariable Integer groupId, |
||||
|
@PathVariable Integer projectId, |
||||
|
@RequestBody @Valid DocumentDescriptionSaveRequest request) { |
||||
|
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext() |
||||
|
.getAuthentication() |
||||
|
.getPrincipal(); |
||||
|
Integer userId = principal.getUserPojo().getId(); |
||||
|
documentDescriptionService.save(groupId, projectId, userId, request); |
||||
|
return JsonData.ok(); |
||||
|
} |
||||
|
} |
@ -1 +1 @@ |
|||||
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir-frontend</title><script defer="defer" type="module" src="/js/chunk-vendors.45746587.js"></script><script defer="defer" type="module" src="/js/app.6aec33ce.js"></script><link href="/css/chunk-vendors.8e1003a6.css" rel="stylesheet"><link href="/css/app.757c1ef3.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.54c3660b.js" nomodule></script><script defer="defer" src="/js/app-legacy.b19c33c1.js" nomodule></script></head><body><noscript><strong>We're sorry but databasir-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> |
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>databasir-frontend</title><script defer="defer" type="module" src="/js/chunk-vendors.45746587.js"></script><script defer="defer" type="module" src="/js/app.92d4b356.js"></script><link href="/css/chunk-vendors.8e1003a6.css" rel="stylesheet"><link href="/css/app.757c1ef3.css" rel="stylesheet"><script defer="defer" src="/js/chunk-vendors-legacy.54c3660b.js" nomodule></script><script defer="defer" src="/js/app-legacy.8031b9be.js" nomodule></script></head><body><noscript><strong>We're sorry but databasir-frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,17 @@ |
|||||
|
package com.databasir.core.domain.description.converter; |
||||
|
|
||||
|
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest; |
||||
|
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo; |
||||
|
import org.mapstruct.Mapper; |
||||
|
import org.mapstruct.Mapping; |
||||
|
|
||||
|
@Mapper(componentModel = "spring") |
||||
|
public interface DocumentDescriptionPojoConverter { |
||||
|
|
||||
|
@Mapping(target = "id", ignore = true) |
||||
|
@Mapping(target = "createAt", ignore = true) |
||||
|
@Mapping(target = "updateAt", ignore = true) |
||||
|
DocumentDescriptionPojo of(Integer projectId, |
||||
|
Integer updateBy, |
||||
|
DocumentDescriptionSaveRequest request); |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.databasir.core.domain.description.data; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class DocumentDescriptionSaveRequest { |
||||
|
|
||||
|
private String tableName; |
||||
|
|
||||
|
private String columnName; |
||||
|
|
||||
|
private String content; |
||||
|
|
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
package com.databasir.core.domain.description.service; |
||||
|
|
||||
|
import com.databasir.core.domain.description.converter.DocumentDescriptionPojoConverter; |
||||
|
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest; |
||||
|
import com.databasir.dao.impl.DocumentDescriptionDao; |
||||
|
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class DocumentDescriptionService { |
||||
|
|
||||
|
private final DocumentDescriptionDao documentDescriptionDao; |
||||
|
|
||||
|
private final DocumentDescriptionPojoConverter documentDescriptionPojoConverter; |
||||
|
|
||||
|
@Transactional |
||||
|
public void save(Integer groupId, |
||||
|
Integer projectId, |
||||
|
Integer userId, |
||||
|
DocumentDescriptionSaveRequest request) { |
||||
|
|
||||
|
DocumentDescriptionPojo pojo = documentDescriptionPojoConverter.of(projectId, userId, request); |
||||
|
if (!documentDescriptionDao.exists(projectId, request.getTableName(), request.getColumnName())) { |
||||
|
documentDescriptionDao.insertAndReturnId(pojo); |
||||
|
} else { |
||||
|
documentDescriptionDao.update(pojo); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,181 @@ |
|||||
|
/* |
||||
|
* This file is generated by jOOQ. |
||||
|
*/ |
||||
|
package com.databasir.dao.tables; |
||||
|
|
||||
|
|
||||
|
import com.databasir.dao.Databasir; |
||||
|
import com.databasir.dao.Keys; |
||||
|
import com.databasir.dao.tables.records.DocumentDescriptionRecord; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import org.jooq.Field; |
||||
|
import org.jooq.ForeignKey; |
||||
|
import org.jooq.Identity; |
||||
|
import org.jooq.Name; |
||||
|
import org.jooq.Record; |
||||
|
import org.jooq.Row8; |
||||
|
import org.jooq.Schema; |
||||
|
import org.jooq.Table; |
||||
|
import org.jooq.TableField; |
||||
|
import org.jooq.TableOptions; |
||||
|
import org.jooq.UniqueKey; |
||||
|
import org.jooq.impl.DSL; |
||||
|
import org.jooq.impl.SQLDataType; |
||||
|
import org.jooq.impl.TableImpl; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* custom document description |
||||
|
*/ |
||||
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) |
||||
|
public class DocumentDescription extends TableImpl<DocumentDescriptionRecord> { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* The reference instance of <code>databasir.document_description</code> |
||||
|
*/ |
||||
|
public static final DocumentDescription DOCUMENT_DESCRIPTION = new DocumentDescription(); |
||||
|
|
||||
|
/** |
||||
|
* The class holding records for this type |
||||
|
*/ |
||||
|
@Override |
||||
|
public Class<DocumentDescriptionRecord> getRecordType() { |
||||
|
return DocumentDescriptionRecord.class; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* The column <code>databasir.document_description.id</code>. |
||||
|
*/ |
||||
|
public final TableField<DocumentDescriptionRecord, Integer> ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, ""); |
||||
|
|
||||
|
/** |
||||
|
* The column <code>databasir.document_description.content</code>. |
||||
|
*/ |
||||
|
public final TableField<DocumentDescriptionRecord, String> CONTENT = createField(DSL.name("content"), SQLDataType.CLOB.nullable(false), this, ""); |
||||
|
|
||||
|
/** |
||||
|
* The column <code>databasir.document_description.project_id</code>. |
||||
|
*/ |
||||
|
public final TableField<DocumentDescriptionRecord, Integer> PROJECT_ID = createField(DSL.name("project_id"), SQLDataType.INTEGER.nullable(false), this, ""); |
||||
|
|
||||
|
/** |
||||
|
* The column <code>databasir.document_description.table_name</code>. |
||||
|
*/ |
||||
|
public final TableField<DocumentDescriptionRecord, String> TABLE_NAME = createField(DSL.name("table_name"), SQLDataType.VARCHAR(255).nullable(false), this, ""); |
||||
|
|
||||
|
/** |
||||
|
* The column <code>databasir.document_description.column_name</code>. |
||||
|
*/ |
||||
|
public final TableField<DocumentDescriptionRecord, String> COLUMN_NAME = createField(DSL.name("column_name"), SQLDataType.VARCHAR(255), this, ""); |
||||
|
|
||||
|
/** |
||||
|
* The column <code>databasir.document_description.update_by</code>. |
||||
|
*/ |
||||
|
public final TableField<DocumentDescriptionRecord, Integer> UPDATE_BY = createField(DSL.name("update_by"), SQLDataType.INTEGER.nullable(false), this, ""); |
||||
|
|
||||
|
/** |
||||
|
* The column <code>databasir.document_description.update_at</code>. |
||||
|
*/ |
||||
|
public final TableField<DocumentDescriptionRecord, LocalDateTime> UPDATE_AT = createField(DSL.name("update_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, ""); |
||||
|
|
||||
|
/** |
||||
|
* The column <code>databasir.document_description.create_at</code>. |
||||
|
*/ |
||||
|
public final TableField<DocumentDescriptionRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, ""); |
||||
|
|
||||
|
private DocumentDescription(Name alias, Table<DocumentDescriptionRecord> aliased) { |
||||
|
this(alias, aliased, null); |
||||
|
} |
||||
|
|
||||
|
private DocumentDescription(Name alias, Table<DocumentDescriptionRecord> aliased, Field<?>[] parameters) { |
||||
|
super(alias, null, aliased, parameters, DSL.comment("custom document description"), TableOptions.table()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Create an aliased <code>databasir.document_description</code> table |
||||
|
* reference |
||||
|
*/ |
||||
|
public DocumentDescription(String alias) { |
||||
|
this(DSL.name(alias), DOCUMENT_DESCRIPTION); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Create an aliased <code>databasir.document_description</code> table |
||||
|
* reference |
||||
|
*/ |
||||
|
public DocumentDescription(Name alias) { |
||||
|
this(alias, DOCUMENT_DESCRIPTION); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Create a <code>databasir.document_description</code> table reference |
||||
|
*/ |
||||
|
public DocumentDescription() { |
||||
|
this(DSL.name("document_description"), null); |
||||
|
} |
||||
|
|
||||
|
public <O extends Record> DocumentDescription(Table<O> child, ForeignKey<O, DocumentDescriptionRecord> key) { |
||||
|
super(child, key, DOCUMENT_DESCRIPTION); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Schema getSchema() { |
||||
|
return aliased() ? null : Databasir.DATABASIR; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Identity<DocumentDescriptionRecord, Integer> getIdentity() { |
||||
|
return (Identity<DocumentDescriptionRecord, Integer>) super.getIdentity(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public UniqueKey<DocumentDescriptionRecord> getPrimaryKey() { |
||||
|
return Keys.KEY_DOCUMENT_DESCRIPTION_PRIMARY; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<UniqueKey<DocumentDescriptionRecord>> getUniqueKeys() { |
||||
|
return Arrays.asList(Keys.KEY_DOCUMENT_DESCRIPTION_UK_PROJECT_ID_TABLE_NAME_COLUMN_NAME); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescription as(String alias) { |
||||
|
return new DocumentDescription(DSL.name(alias), this); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescription as(Name alias) { |
||||
|
return new DocumentDescription(alias, this); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Rename this table |
||||
|
*/ |
||||
|
@Override |
||||
|
public DocumentDescription rename(String name) { |
||||
|
return new DocumentDescription(DSL.name(name), null); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Rename this table |
||||
|
*/ |
||||
|
@Override |
||||
|
public DocumentDescription rename(Name name) { |
||||
|
return new DocumentDescription(name, null); |
||||
|
} |
||||
|
|
||||
|
// -------------------------------------------------------------------------
|
||||
|
// Row8 type methods
|
||||
|
// -------------------------------------------------------------------------
|
||||
|
|
||||
|
@Override |
||||
|
public Row8<Integer, String, Integer, String, String, Integer, LocalDateTime, LocalDateTime> fieldsRow() { |
||||
|
return (Row8) super.fieldsRow(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,189 @@ |
|||||
|
/* |
||||
|
* This file is generated by jOOQ. |
||||
|
*/ |
||||
|
package com.databasir.dao.tables.pojos; |
||||
|
|
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* custom document description |
||||
|
*/ |
||||
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) |
||||
|
public class DocumentDescriptionPojo implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
private Integer id; |
||||
|
private String content; |
||||
|
private Integer projectId; |
||||
|
private String tableName; |
||||
|
private String columnName; |
||||
|
private Integer updateBy; |
||||
|
private LocalDateTime updateAt; |
||||
|
private LocalDateTime createAt; |
||||
|
|
||||
|
public DocumentDescriptionPojo() {} |
||||
|
|
||||
|
public DocumentDescriptionPojo(DocumentDescriptionPojo value) { |
||||
|
this.id = value.id; |
||||
|
this.content = value.content; |
||||
|
this.projectId = value.projectId; |
||||
|
this.tableName = value.tableName; |
||||
|
this.columnName = value.columnName; |
||||
|
this.updateBy = value.updateBy; |
||||
|
this.updateAt = value.updateAt; |
||||
|
this.createAt = value.createAt; |
||||
|
} |
||||
|
|
||||
|
public DocumentDescriptionPojo( |
||||
|
Integer id, |
||||
|
String content, |
||||
|
Integer projectId, |
||||
|
String tableName, |
||||
|
String columnName, |
||||
|
Integer updateBy, |
||||
|
LocalDateTime updateAt, |
||||
|
LocalDateTime createAt |
||||
|
) { |
||||
|
this.id = id; |
||||
|
this.content = content; |
||||
|
this.projectId = projectId; |
||||
|
this.tableName = tableName; |
||||
|
this.columnName = columnName; |
||||
|
this.updateBy = updateBy; |
||||
|
this.updateAt = updateAt; |
||||
|
this.createAt = createAt; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.id</code>. |
||||
|
*/ |
||||
|
public Integer getId() { |
||||
|
return this.id; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.id</code>. |
||||
|
*/ |
||||
|
public void setId(Integer id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.content</code>. |
||||
|
*/ |
||||
|
public String getContent() { |
||||
|
return this.content; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.content</code>. |
||||
|
*/ |
||||
|
public void setContent(String content) { |
||||
|
this.content = content; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.project_id</code>. |
||||
|
*/ |
||||
|
public Integer getProjectId() { |
||||
|
return this.projectId; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.project_id</code>. |
||||
|
*/ |
||||
|
public void setProjectId(Integer projectId) { |
||||
|
this.projectId = projectId; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.table_name</code>. |
||||
|
*/ |
||||
|
public String getTableName() { |
||||
|
return this.tableName; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.table_name</code>. |
||||
|
*/ |
||||
|
public void setTableName(String tableName) { |
||||
|
this.tableName = tableName; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.column_name</code>. |
||||
|
*/ |
||||
|
public String getColumnName() { |
||||
|
return this.columnName; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.column_name</code>. |
||||
|
*/ |
||||
|
public void setColumnName(String columnName) { |
||||
|
this.columnName = columnName; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.update_by</code>. |
||||
|
*/ |
||||
|
public Integer getUpdateBy() { |
||||
|
return this.updateBy; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.update_by</code>. |
||||
|
*/ |
||||
|
public void setUpdateBy(Integer updateBy) { |
||||
|
this.updateBy = updateBy; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.update_at</code>. |
||||
|
*/ |
||||
|
public LocalDateTime getUpdateAt() { |
||||
|
return this.updateAt; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.update_at</code>. |
||||
|
*/ |
||||
|
public void setUpdateAt(LocalDateTime updateAt) { |
||||
|
this.updateAt = updateAt; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.create_at</code>. |
||||
|
*/ |
||||
|
public LocalDateTime getCreateAt() { |
||||
|
return this.createAt; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.create_at</code>. |
||||
|
*/ |
||||
|
public void setCreateAt(LocalDateTime createAt) { |
||||
|
this.createAt = createAt; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
StringBuilder sb = new StringBuilder("DocumentDescriptionPojo ("); |
||||
|
|
||||
|
sb.append(id); |
||||
|
sb.append(", ").append(content); |
||||
|
sb.append(", ").append(projectId); |
||||
|
sb.append(", ").append(tableName); |
||||
|
sb.append(", ").append(columnName); |
||||
|
sb.append(", ").append(updateBy); |
||||
|
sb.append(", ").append(updateAt); |
||||
|
sb.append(", ").append(createAt); |
||||
|
|
||||
|
sb.append(")"); |
||||
|
return sb.toString(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,387 @@ |
|||||
|
/* |
||||
|
* This file is generated by jOOQ. |
||||
|
*/ |
||||
|
package com.databasir.dao.tables.records; |
||||
|
|
||||
|
|
||||
|
import com.databasir.dao.tables.DocumentDescription; |
||||
|
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import org.jooq.Field; |
||||
|
import org.jooq.Record1; |
||||
|
import org.jooq.Record8; |
||||
|
import org.jooq.Row8; |
||||
|
import org.jooq.impl.UpdatableRecordImpl; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* custom document description |
||||
|
*/ |
||||
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" }) |
||||
|
public class DocumentDescriptionRecord extends UpdatableRecordImpl<DocumentDescriptionRecord> implements Record8<Integer, String, Integer, String, String, Integer, LocalDateTime, LocalDateTime> { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.id</code>. |
||||
|
*/ |
||||
|
public void setId(Integer value) { |
||||
|
set(0, value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.id</code>. |
||||
|
*/ |
||||
|
public Integer getId() { |
||||
|
return (Integer) get(0); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.content</code>. |
||||
|
*/ |
||||
|
public void setContent(String value) { |
||||
|
set(1, value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.content</code>. |
||||
|
*/ |
||||
|
public String getContent() { |
||||
|
return (String) get(1); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.project_id</code>. |
||||
|
*/ |
||||
|
public void setProjectId(Integer value) { |
||||
|
set(2, value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.project_id</code>. |
||||
|
*/ |
||||
|
public Integer getProjectId() { |
||||
|
return (Integer) get(2); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.table_name</code>. |
||||
|
*/ |
||||
|
public void setTableName(String value) { |
||||
|
set(3, value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.table_name</code>. |
||||
|
*/ |
||||
|
public String getTableName() { |
||||
|
return (String) get(3); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.column_name</code>. |
||||
|
*/ |
||||
|
public void setColumnName(String value) { |
||||
|
set(4, value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.column_name</code>. |
||||
|
*/ |
||||
|
public String getColumnName() { |
||||
|
return (String) get(4); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.update_by</code>. |
||||
|
*/ |
||||
|
public void setUpdateBy(Integer value) { |
||||
|
set(5, value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.update_by</code>. |
||||
|
*/ |
||||
|
public Integer getUpdateBy() { |
||||
|
return (Integer) get(5); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.update_at</code>. |
||||
|
*/ |
||||
|
public void setUpdateAt(LocalDateTime value) { |
||||
|
set(6, value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.update_at</code>. |
||||
|
*/ |
||||
|
public LocalDateTime getUpdateAt() { |
||||
|
return (LocalDateTime) get(6); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Setter for <code>databasir.document_description.create_at</code>. |
||||
|
*/ |
||||
|
public void setCreateAt(LocalDateTime value) { |
||||
|
set(7, value); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Getter for <code>databasir.document_description.create_at</code>. |
||||
|
*/ |
||||
|
public LocalDateTime getCreateAt() { |
||||
|
return (LocalDateTime) get(7); |
||||
|
} |
||||
|
|
||||
|
// -------------------------------------------------------------------------
|
||||
|
// Primary key information
|
||||
|
// -------------------------------------------------------------------------
|
||||
|
|
||||
|
@Override |
||||
|
public Record1<Integer> key() { |
||||
|
return (Record1) super.key(); |
||||
|
} |
||||
|
|
||||
|
// -------------------------------------------------------------------------
|
||||
|
// Record8 type implementation
|
||||
|
// -------------------------------------------------------------------------
|
||||
|
|
||||
|
@Override |
||||
|
public Row8<Integer, String, Integer, String, String, Integer, LocalDateTime, LocalDateTime> fieldsRow() { |
||||
|
return (Row8) super.fieldsRow(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Row8<Integer, String, Integer, String, String, Integer, LocalDateTime, LocalDateTime> valuesRow() { |
||||
|
return (Row8) super.valuesRow(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Field<Integer> field1() { |
||||
|
return DocumentDescription.DOCUMENT_DESCRIPTION.ID; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Field<String> field2() { |
||||
|
return DocumentDescription.DOCUMENT_DESCRIPTION.CONTENT; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Field<Integer> field3() { |
||||
|
return DocumentDescription.DOCUMENT_DESCRIPTION.PROJECT_ID; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Field<String> field4() { |
||||
|
return DocumentDescription.DOCUMENT_DESCRIPTION.TABLE_NAME; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Field<String> field5() { |
||||
|
return DocumentDescription.DOCUMENT_DESCRIPTION.COLUMN_NAME; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Field<Integer> field6() { |
||||
|
return DocumentDescription.DOCUMENT_DESCRIPTION.UPDATE_BY; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Field<LocalDateTime> field7() { |
||||
|
return DocumentDescription.DOCUMENT_DESCRIPTION.UPDATE_AT; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Field<LocalDateTime> field8() { |
||||
|
return DocumentDescription.DOCUMENT_DESCRIPTION.CREATE_AT; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer component1() { |
||||
|
return getId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String component2() { |
||||
|
return getContent(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer component3() { |
||||
|
return getProjectId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String component4() { |
||||
|
return getTableName(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String component5() { |
||||
|
return getColumnName(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer component6() { |
||||
|
return getUpdateBy(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public LocalDateTime component7() { |
||||
|
return getUpdateAt(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public LocalDateTime component8() { |
||||
|
return getCreateAt(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer value1() { |
||||
|
return getId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String value2() { |
||||
|
return getContent(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer value3() { |
||||
|
return getProjectId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String value4() { |
||||
|
return getTableName(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String value5() { |
||||
|
return getColumnName(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer value6() { |
||||
|
return getUpdateBy(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public LocalDateTime value7() { |
||||
|
return getUpdateAt(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public LocalDateTime value8() { |
||||
|
return getCreateAt(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord value1(Integer value) { |
||||
|
setId(value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord value2(String value) { |
||||
|
setContent(value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord value3(Integer value) { |
||||
|
setProjectId(value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord value4(String value) { |
||||
|
setTableName(value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord value5(String value) { |
||||
|
setColumnName(value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord value6(Integer value) { |
||||
|
setUpdateBy(value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord value7(LocalDateTime value) { |
||||
|
setUpdateAt(value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord value8(LocalDateTime value) { |
||||
|
setCreateAt(value); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public DocumentDescriptionRecord values(Integer value1, String value2, Integer value3, String value4, String value5, Integer value6, LocalDateTime value7, LocalDateTime value8) { |
||||
|
value1(value1); |
||||
|
value2(value2); |
||||
|
value3(value3); |
||||
|
value4(value4); |
||||
|
value5(value5); |
||||
|
value6(value6); |
||||
|
value7(value7); |
||||
|
value8(value8); |
||||
|
return this; |
||||
|
} |
||||
|
|
||||
|
// -------------------------------------------------------------------------
|
||||
|
// Constructors
|
||||
|
// -------------------------------------------------------------------------
|
||||
|
|
||||
|
/** |
||||
|
* Create a detached DocumentDescriptionRecord |
||||
|
*/ |
||||
|
public DocumentDescriptionRecord() { |
||||
|
super(DocumentDescription.DOCUMENT_DESCRIPTION); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Create a detached, initialised DocumentDescriptionRecord |
||||
|
*/ |
||||
|
public DocumentDescriptionRecord(Integer id, String content, Integer projectId, String tableName, String columnName, Integer updateBy, LocalDateTime updateAt, LocalDateTime createAt) { |
||||
|
super(DocumentDescription.DOCUMENT_DESCRIPTION); |
||||
|
|
||||
|
setId(id); |
||||
|
setContent(content); |
||||
|
setProjectId(projectId); |
||||
|
setTableName(tableName); |
||||
|
setColumnName(columnName); |
||||
|
setUpdateBy(updateBy); |
||||
|
setUpdateAt(updateAt); |
||||
|
setCreateAt(createAt); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Create a detached, initialised DocumentDescriptionRecord |
||||
|
*/ |
||||
|
public DocumentDescriptionRecord(DocumentDescriptionPojo value) { |
||||
|
super(DocumentDescription.DOCUMENT_DESCRIPTION); |
||||
|
|
||||
|
if (value != null) { |
||||
|
setId(value.getId()); |
||||
|
setContent(value.getContent()); |
||||
|
setProjectId(value.getProjectId()); |
||||
|
setTableName(value.getTableName()); |
||||
|
setColumnName(value.getColumnName()); |
||||
|
setUpdateBy(value.getUpdateBy()); |
||||
|
setUpdateAt(value.getUpdateAt()); |
||||
|
setCreateAt(value.getCreateAt()); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
package com.databasir.dao.impl; |
||||
|
|
||||
|
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo; |
||||
|
import com.databasir.dao.tables.records.DocumentDescriptionRecord; |
||||
|
import lombok.Getter; |
||||
|
import org.jooq.Condition; |
||||
|
import org.jooq.DSLContext; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import static com.databasir.dao.Tables.DOCUMENT_DESCRIPTION; |
||||
|
|
||||
|
@Repository |
||||
|
public class DocumentDescriptionDao extends BaseDao<DocumentDescriptionPojo> { |
||||
|
|
||||
|
@Autowired |
||||
|
@Getter |
||||
|
private DSLContext dslContext; |
||||
|
|
||||
|
public DocumentDescriptionDao() { |
||||
|
super(DOCUMENT_DESCRIPTION, DocumentDescriptionPojo.class); |
||||
|
} |
||||
|
|
||||
|
public boolean exists(Integer projectId, String tableName, String columnName) { |
||||
|
Condition condition = DOCUMENT_DESCRIPTION.PROJECT_ID.eq(projectId) |
||||
|
.and(DOCUMENT_DESCRIPTION.TABLE_NAME.eq(tableName)); |
||||
|
if (columnName == null) { |
||||
|
condition = condition.and(DOCUMENT_DESCRIPTION.COLUMN_NAME.isNull()); |
||||
|
} else { |
||||
|
condition = condition.and(DOCUMENT_DESCRIPTION.COLUMN_NAME.eq(columnName)); |
||||
|
} |
||||
|
return this.exists(condition); |
||||
|
} |
||||
|
|
||||
|
public void update(DocumentDescriptionPojo pojo) { |
||||
|
Condition condition = DOCUMENT_DESCRIPTION.TABLE_NAME.eq(pojo.getTableName()); |
||||
|
if (pojo.getColumnName() == null) { |
||||
|
condition = condition.and(DOCUMENT_DESCRIPTION.COLUMN_NAME.isNull()); |
||||
|
} else { |
||||
|
condition = condition.and(DOCUMENT_DESCRIPTION.COLUMN_NAME.eq(pojo.getColumnName())); |
||||
|
} |
||||
|
DocumentDescriptionRecord record = getDslContext().newRecord(DOCUMENT_DESCRIPTION, pojo); |
||||
|
getDslContext().executeUpdate(record, condition); |
||||
|
} |
||||
|
|
||||
|
public List<DocumentDescriptionPojo> selectByProjectId(Integer projectId) { |
||||
|
return selectByCondition(DOCUMENT_DESCRIPTION.PROJECT_ID.eq(projectId)); |
||||
|
} |
||||
|
|
||||
|
public List<DocumentDescriptionPojo> selectTableDescriptionByProjectId(Integer projectId) { |
||||
|
return selectByCondition(DOCUMENT_DESCRIPTION.PROJECT_ID.eq(projectId) |
||||
|
.and(DOCUMENT_DESCRIPTION.COLUMN_NAME.isNull())); |
||||
|
} |
||||
|
|
||||
|
public List<DocumentDescriptionPojo> selectByCondition(Condition condition) { |
||||
|
return this.getDslContext() |
||||
|
.selectFrom(DOCUMENT_DESCRIPTION).where(condition) |
||||
|
.fetchInto(DocumentDescriptionPojo.class); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue