feat: add checkstyle
This commit is contained in:
parent
dde3c09e3e
commit
11d6f6bbd3
|
@ -9,7 +9,6 @@ import com.databasir.core.domain.log.annotation.Operation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.web.PageableDefault;
|
import org.springframework.data.web.PageableDefault;
|
||||||
import org.springframework.http.ContentDisposition;
|
import org.springframework.http.ContentDisposition;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
@ -26,6 +25,8 @@ import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import static org.springframework.data.domain.Sort.Direction.DESC;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Validated
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -50,7 +51,8 @@ public class DocumentController {
|
||||||
|
|
||||||
@GetMapping(Routes.Document.LIST_VERSIONS)
|
@GetMapping(Routes.Document.LIST_VERSIONS)
|
||||||
public JsonData<Page<DatabaseDocumentVersionResponse>> getVersionsByProjectId(@PathVariable Integer projectId,
|
public JsonData<Page<DatabaseDocumentVersionResponse>> getVersionsByProjectId(@PathVariable Integer projectId,
|
||||||
@PageableDefault(sort = "id", direction = Sort.Direction.DESC)
|
@PageableDefault(sort = "id",
|
||||||
|
direction = DESC)
|
||||||
Pageable page) {
|
Pageable page) {
|
||||||
return JsonData.ok(documentService.getVersionsBySchemaSourceId(projectId, page));
|
return JsonData.ok(documentService.getVersionsBySchemaSourceId(projectId, page));
|
||||||
}
|
}
|
||||||
|
@ -60,7 +62,8 @@ public class DocumentController {
|
||||||
@RequestParam(required = false) Long version) {
|
@RequestParam(required = false) Long version) {
|
||||||
String data = documentService.toMarkdown(projectId, version).get();
|
String data = documentService.toMarkdown(projectId, version).get();
|
||||||
try {
|
try {
|
||||||
Path path = Files.writeString(Paths.get(UUID.randomUUID().toString() + ".md"), data, StandardCharsets.UTF_8);
|
Path path = Files.writeString(Paths.get(UUID.randomUUID().toString() + ".md"), data,
|
||||||
|
StandardCharsets.UTF_8);
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentDisposition(ContentDisposition.attachment()
|
headers.setContentDisposition(ContentDisposition.attachment()
|
||||||
.filename("demo.md", StandardCharsets.UTF_8)
|
.filename("demo.md", StandardCharsets.UTF_8)
|
||||||
|
|
|
@ -8,7 +8,6 @@ import com.databasir.core.domain.log.annotation.Operation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.web.PageableDefault;
|
import org.springframework.data.web.PageableDefault;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -18,6 +17,8 @@ import javax.validation.Valid;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.springframework.data.domain.Sort.Direction.DESC;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Validated
|
@Validated
|
||||||
|
@ -46,7 +47,7 @@ public class GroupController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(Routes.Group.LIST)
|
@GetMapping(Routes.Group.LIST)
|
||||||
public JsonData<Page<GroupPageResponse>> list(@PageableDefault(sort = "id", direction = Sort.Direction.DESC)
|
public JsonData<Page<GroupPageResponse>> list(@PageableDefault(sort = "id", direction = DESC)
|
||||||
Pageable page,
|
Pageable page,
|
||||||
GroupPageCondition condition) {
|
GroupPageCondition condition) {
|
||||||
return JsonData.ok(groupService.list(page, condition));
|
return JsonData.ok(groupService.list(page, condition));
|
||||||
|
@ -69,7 +70,8 @@ public class GroupController {
|
||||||
|
|
||||||
@GetMapping(Routes.Group.MEMBERS)
|
@GetMapping(Routes.Group.MEMBERS)
|
||||||
public JsonData<Page<GroupMemberPageResponse>> listGroupMembers(@PathVariable Integer groupId,
|
public JsonData<Page<GroupMemberPageResponse>> listGroupMembers(@PathVariable Integer groupId,
|
||||||
@PageableDefault(sort = "user_role.create_at", direction = Sort.Direction.DESC)
|
@PageableDefault(sort = "user_role.create_at",
|
||||||
|
direction = DESC)
|
||||||
Pageable pageable,
|
Pageable pageable,
|
||||||
GroupMemberPageCondition condition) {
|
GroupMemberPageCondition condition) {
|
||||||
return JsonData.ok(groupService.listGroupMembers(groupId, pageable, condition));
|
return JsonData.ok(groupService.listGroupMembers(groupId, pageable, condition));
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@ -40,8 +39,8 @@ public class LoginController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(Routes.Login.REFRESH_ACCESS_TOKEN)
|
@PostMapping(Routes.Login.REFRESH_ACCESS_TOKEN)
|
||||||
public JsonData<AccessTokenRefreshResponse> refreshAccessTokens(@RequestBody @Valid AccessTokenRefreshRequest request,
|
public JsonData<AccessTokenRefreshResponse> refreshAccessTokens(@RequestBody @Valid
|
||||||
HttpServletResponse response) {
|
AccessTokenRefreshRequest request) {
|
||||||
try {
|
try {
|
||||||
return JsonData.ok(loginService.refreshAccessTokens(request));
|
return JsonData.ok(loginService.refreshAccessTokens(request));
|
||||||
} catch (DatabasirException e) {
|
} catch (DatabasirException e) {
|
||||||
|
|
|
@ -26,7 +26,8 @@ public class ProjectController {
|
||||||
private final CronExpressionValidator cronExpressionValidator;
|
private final CronExpressionValidator cronExpressionValidator;
|
||||||
|
|
||||||
@PostMapping(Routes.GroupProject.CREATE)
|
@PostMapping(Routes.GroupProject.CREATE)
|
||||||
@PreAuthorize("hasAnyAuthority('SYS_OWNER', 'GROUP_OWNER?groupId='+#request.groupId, 'GROUP_MEMBER?groupId='+#request.groupId)")
|
@PreAuthorize("hasAnyAuthority('SYS_OWNER', 'GROUP_OWNER?groupId='+#request.groupId, "
|
||||||
|
+ "'GROUP_MEMBER?groupId='+#request.groupId)")
|
||||||
@Operation(module = Operation.Modules.PROJECT,
|
@Operation(module = Operation.Modules.PROJECT,
|
||||||
name = "创建项目",
|
name = "创建项目",
|
||||||
involvedGroupId = "#request.groupId")
|
involvedGroupId = "#request.groupId")
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.databasir.api;
|
package com.databasir.api;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.common.JsonData;
|
import com.databasir.common.JsonData;
|
||||||
import com.databasir.core.domain.log.annotation.Operation;
|
import com.databasir.core.domain.log.annotation.Operation;
|
||||||
import com.databasir.core.domain.system.data.SystemEmailResponse;
|
import com.databasir.core.domain.system.data.SystemEmailResponse;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.databasir.api.advice;
|
package com.databasir.api.advice;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.common.DatabasirException;
|
import com.databasir.common.DatabasirException;
|
||||||
import com.databasir.common.JsonData;
|
import com.databasir.common.JsonData;
|
||||||
import com.databasir.common.SystemException;
|
import com.databasir.common.SystemException;
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@SuppressWarnings("checkstyle:all")
|
||||||
public PasswordEncoder bCryptPasswordEncoder() {
|
public PasswordEncoder bCryptPasswordEncoder() {
|
||||||
return new BCryptPasswordEncoder();
|
return new BCryptPasswordEncoder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,15 +33,6 @@ public class DatabasirAuthenticationSuccessHandler implements AuthenticationSucc
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
Authentication authentication) throws IOException, ServletException {
|
Authentication authentication) throws IOException, ServletException {
|
||||||
DatabasirUserDetails user = (DatabasirUserDetails) authentication.getPrincipal();
|
DatabasirUserDetails user = (DatabasirUserDetails) authentication.getPrincipal();
|
||||||
List<UserLoginResponse.RoleResponse> roles = user.getRoles()
|
|
||||||
.stream()
|
|
||||||
.map(ur -> {
|
|
||||||
UserLoginResponse.RoleResponse data = new UserLoginResponse.RoleResponse();
|
|
||||||
data.setRole(ur.getRole());
|
|
||||||
data.setGroupId(ur.getGroupId());
|
|
||||||
return data;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||||
UserLoginResponse data = new UserLoginResponse();
|
UserLoginResponse data = new UserLoginResponse();
|
||||||
|
@ -55,6 +46,16 @@ public class DatabasirAuthenticationSuccessHandler implements AuthenticationSucc
|
||||||
long expireAt = loginKey.getAccessTokenExpireAt().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
long expireAt = loginKey.getAccessTokenExpireAt().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
data.setAccessTokenExpireAt(expireAt);
|
data.setAccessTokenExpireAt(expireAt);
|
||||||
data.setRefreshToken(loginKey.getRefreshToken());
|
data.setRefreshToken(loginKey.getRefreshToken());
|
||||||
|
|
||||||
|
List<UserLoginResponse.RoleResponse> roles = user.getRoles()
|
||||||
|
.stream()
|
||||||
|
.map(ur -> {
|
||||||
|
UserLoginResponse.RoleResponse roleResponse = new UserLoginResponse.RoleResponse();
|
||||||
|
roleResponse.setRole(ur.getRole());
|
||||||
|
roleResponse.setGroupId(ur.getGroupId());
|
||||||
|
return roleResponse;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
data.setRoles(roles);
|
data.setRoles(roles);
|
||||||
objectMapper.writeValue(response.getWriter(), JsonData.ok(data));
|
objectMapper.writeValue(response.getWriter(), JsonData.ok(data));
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DatabasirUserDetails implements UserDetails {
|
public class DatabasirUserDetails implements UserDetails {
|
||||||
|
|
||||||
|
|
11
build.gradle
11
build.gradle
|
@ -19,6 +19,7 @@ subprojects {
|
||||||
apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
apply plugin: 'org.springframework.boot'
|
apply plugin: 'org.springframework.boot'
|
||||||
apply plugin: 'nu.studer.jooq'
|
apply plugin: 'nu.studer.jooq'
|
||||||
|
apply plugin: 'checkstyle'
|
||||||
|
|
||||||
group 'com.databasir'
|
group 'com.databasir'
|
||||||
version '1.0.0'
|
version '1.0.0'
|
||||||
|
@ -51,6 +52,16 @@ subprojects {
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
|
|
||||||
|
checkstyle {
|
||||||
|
toolVersion = '8.42'
|
||||||
|
ignoreFailures = false
|
||||||
|
maxWarnings = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.databasir.common;
|
package com.databasir.common;
|
||||||
|
|
||||||
public class SystemException extends RuntimeException{
|
public class SystemException extends RuntimeException {
|
||||||
|
|
||||||
private static final String MSG_INTERNAL_SERVER_ERROR = "服务器开小差了,请稍后再试";
|
private static final String MSG_INTERNAL_SERVER_ERROR = "服务器开小差了,请稍后再试";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,345 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE module PUBLIC
|
||||||
|
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||||
|
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Checkstyle configuration that checks the Google coding conventions from Google Java Style
|
||||||
|
that can be found at https://google.github.io/styleguide/javaguide.html
|
||||||
|
Checkstyle is very configurable. Be sure to read the documentation at
|
||||||
|
http://checkstyle.org (or in your downloaded distribution).
|
||||||
|
To completely disable a check, just comment it out or delete it from the file.
|
||||||
|
To suppress certain violations please review suppression filters.
|
||||||
|
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<module name="Checker">
|
||||||
|
<property name="charset" value="UTF-8"/>
|
||||||
|
|
||||||
|
<property name="severity" value="warning"/>
|
||||||
|
|
||||||
|
<property name="fileExtensions" value="java, properties, xml"/>
|
||||||
|
<!-- Excludes all 'module-info.java' files -->
|
||||||
|
<!-- See https://checkstyle.org/config_filefilters.html -->
|
||||||
|
<module name="BeforeExecutionExclusionFileFilter">
|
||||||
|
<property name="fileNamePattern" value="module\-info\.java$"/>
|
||||||
|
</module>
|
||||||
|
<!-- https://checkstyle.org/config_filters.html#SuppressionFilter -->
|
||||||
|
<module name="SuppressionFilter">
|
||||||
|
<property name="file" value="${org.checkstyle.google.suppressionfilter.config}"
|
||||||
|
default="checkstyle-suppressions.xml"/>
|
||||||
|
<property name="optional" value="true"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Checks for whitespace -->
|
||||||
|
<!-- See http://checkstyle.org/config_whitespace.html -->
|
||||||
|
<module name="FileTabCharacter">
|
||||||
|
<property name="eachLine" value="true"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="LineLength">
|
||||||
|
<property name="fileExtensions" value="java"/>
|
||||||
|
<property name="max" value="120"/>
|
||||||
|
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="SuppressWarningsFilter" />
|
||||||
|
|
||||||
|
<module name="TreeWalker">
|
||||||
|
<module name="SuppressWarningsHolder"/>
|
||||||
|
<module name="OuterTypeFilename"/>
|
||||||
|
<module name="IllegalTokenText">
|
||||||
|
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
|
||||||
|
<property name="format"
|
||||||
|
value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
||||||
|
<property name="message"
|
||||||
|
value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
|
||||||
|
</module>
|
||||||
|
<module name="AvoidEscapedUnicodeCharacters">
|
||||||
|
<property name="allowEscapesForControlCharacters" value="true"/>
|
||||||
|
<property name="allowByTailComment" value="true"/>
|
||||||
|
<property name="allowNonPrintableEscapes" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="OneTopLevelClass"/>
|
||||||
|
<module name="NoLineWrap">
|
||||||
|
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/>
|
||||||
|
</module>
|
||||||
|
<module name="EmptyBlock">
|
||||||
|
<property name="option" value="TEXT"/>
|
||||||
|
<property name="tokens"
|
||||||
|
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
||||||
|
</module>
|
||||||
|
<module name="NeedBraces">
|
||||||
|
<property name="tokens"
|
||||||
|
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/>
|
||||||
|
</module>
|
||||||
|
<module name="LeftCurly">
|
||||||
|
<property name="tokens"
|
||||||
|
value="ANNOTATION_DEF, CLASS_DEF, CTOR_DEF, ENUM_CONSTANT_DEF, ENUM_DEF,
|
||||||
|
INTERFACE_DEF, LAMBDA, LITERAL_CASE, LITERAL_CATCH, LITERAL_DEFAULT,
|
||||||
|
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF,
|
||||||
|
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF,
|
||||||
|
OBJBLOCK, STATIC_INIT, RECORD_DEF, COMPACT_CTOR_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="RightCurly">
|
||||||
|
<property name="id" value="RightCurlySame"/>
|
||||||
|
<property name="tokens"
|
||||||
|
value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE,
|
||||||
|
LITERAL_DO"/>
|
||||||
|
</module>
|
||||||
|
<module name="RightCurly">
|
||||||
|
<property name="id" value="RightCurlyAlone"/>
|
||||||
|
<property name="option" value="alone"/>
|
||||||
|
<property name="tokens"
|
||||||
|
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
|
||||||
|
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, INTERFACE_DEF, RECORD_DEF,
|
||||||
|
COMPACT_CTOR_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="SuppressionXpathSingleFilter">
|
||||||
|
<!-- suppresion is required till https://github.com/checkstyle/checkstyle/issues/7541 -->
|
||||||
|
<property name="id" value="RightCurlyAlone"/>
|
||||||
|
<property name="query" value="//RCURLY[parent::SLIST[count(./*)=1]
|
||||||
|
or preceding-sibling::*[last()][self::LCURLY]]"/>
|
||||||
|
</module>
|
||||||
|
<module name="WhitespaceAfter">
|
||||||
|
<property name="tokens"
|
||||||
|
value="COMMA, SEMI, TYPECAST, LITERAL_IF, LITERAL_ELSE,
|
||||||
|
LITERAL_WHILE, LITERAL_DO, LITERAL_FOR, DO_WHILE"/>
|
||||||
|
</module>
|
||||||
|
<module name="WhitespaceAround">
|
||||||
|
<property name="allowEmptyConstructors" value="true"/>
|
||||||
|
<property name="allowEmptyLambdas" value="true"/>
|
||||||
|
<property name="allowEmptyMethods" value="true"/>
|
||||||
|
<property name="allowEmptyTypes" value="true"/>
|
||||||
|
<property name="allowEmptyLoops" value="true"/>
|
||||||
|
<property name="ignoreEnhancedForColon" value="false"/>
|
||||||
|
<property name="tokens"
|
||||||
|
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
|
||||||
|
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
|
||||||
|
LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
|
||||||
|
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
|
||||||
|
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
|
||||||
|
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
|
||||||
|
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
|
||||||
|
<message key="ws.notFollowed"
|
||||||
|
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
|
||||||
|
<message key="ws.notPreceded"
|
||||||
|
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
|
||||||
|
</module>
|
||||||
|
<module name="OneStatementPerLine"/>
|
||||||
|
<module name="MultipleVariableDeclarations"/>
|
||||||
|
<module name="ArrayTypeStyle"/>
|
||||||
|
<module name="MissingSwitchDefault"/>
|
||||||
|
<module name="FallThrough"/>
|
||||||
|
<module name="UpperEll"/>
|
||||||
|
<module name="ModifierOrder"/>
|
||||||
|
<module name="EmptyLineSeparator">
|
||||||
|
<property name="tokens"
|
||||||
|
value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
|
||||||
|
STATIC_INIT, INSTANCE_INIT, METHOD_DEF, CTOR_DEF, VARIABLE_DEF, RECORD_DEF,
|
||||||
|
COMPACT_CTOR_DEF"/>
|
||||||
|
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<property name="id" value="SeparatorWrapDot"/>
|
||||||
|
<property name="tokens" value="DOT"/>
|
||||||
|
<property name="option" value="nl"/>
|
||||||
|
</module>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<property name="id" value="SeparatorWrapComma"/>
|
||||||
|
<property name="tokens" value="COMMA"/>
|
||||||
|
<property name="option" value="EOL"/>
|
||||||
|
</module>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/259 -->
|
||||||
|
<property name="id" value="SeparatorWrapEllipsis"/>
|
||||||
|
<property name="tokens" value="ELLIPSIS"/>
|
||||||
|
<property name="option" value="EOL"/>
|
||||||
|
</module>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/258 -->
|
||||||
|
<property name="id" value="SeparatorWrapArrayDeclarator"/>
|
||||||
|
<property name="tokens" value="ARRAY_DECLARATOR"/>
|
||||||
|
<property name="option" value="EOL"/>
|
||||||
|
</module>
|
||||||
|
<module name="SeparatorWrap">
|
||||||
|
<property name="id" value="SeparatorWrapMethodRef"/>
|
||||||
|
<property name="tokens" value="METHOD_REF"/>
|
||||||
|
<property name="option" value="nl"/>
|
||||||
|
</module>
|
||||||
|
<module name="PackageName">
|
||||||
|
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Package name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="TypeName">
|
||||||
|
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
|
||||||
|
ANNOTATION_DEF, RECORD_DEF"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="MemberName">
|
||||||
|
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="ParameterName">
|
||||||
|
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="LambdaParameterName">
|
||||||
|
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="CatchParameterName">
|
||||||
|
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="LocalVariableName">
|
||||||
|
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Local variable name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="PatternVariableName">
|
||||||
|
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Pattern variable name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="ClassTypeParameterName">
|
||||||
|
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="RecordComponentName">
|
||||||
|
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Record component name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="RecordTypeParameterName">
|
||||||
|
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Record type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="MethodTypeParameterName">
|
||||||
|
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="InterfaceTypeParameterName">
|
||||||
|
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="NoFinalizer"/>
|
||||||
|
<module name="GenericWhitespace">
|
||||||
|
<message key="ws.followed"
|
||||||
|
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
|
||||||
|
<message key="ws.preceded"
|
||||||
|
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
|
||||||
|
<message key="ws.illegalFollow"
|
||||||
|
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
|
||||||
|
<message key="ws.notPreceded"
|
||||||
|
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
|
||||||
|
</module>
|
||||||
|
<module name="AbbreviationAsWordInName">
|
||||||
|
<property name="ignoreFinal" value="false"/>
|
||||||
|
<property name="allowedAbbreviationLength" value="3"/>
|
||||||
|
<property name="tokens"
|
||||||
|
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
|
||||||
|
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, PATTERN_VARIABLE_DEF, RECORD_DEF,
|
||||||
|
RECORD_COMPONENT_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="OverloadMethodsDeclarationOrder"/>
|
||||||
|
<module name="VariableDeclarationUsageDistance"/>
|
||||||
|
<module name="MethodParamPad">
|
||||||
|
<property name="tokens"
|
||||||
|
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
|
||||||
|
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="NoWhitespaceBefore">
|
||||||
|
<property name="tokens"
|
||||||
|
value="COMMA, SEMI, POST_INC, POST_DEC, DOT,
|
||||||
|
LABELED_STAT, METHOD_REF"/>
|
||||||
|
<property name="allowLineBreaks" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="ParenPad">
|
||||||
|
<property name="tokens"
|
||||||
|
value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, DOT, ENUM_CONSTANT_DEF,
|
||||||
|
EXPR, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW,
|
||||||
|
LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, METHOD_CALL,
|
||||||
|
METHOD_DEF, QUESTION, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA,
|
||||||
|
RECORD_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="OperatorWrap">
|
||||||
|
<property name="option" value="NL"/>
|
||||||
|
<property name="tokens"
|
||||||
|
value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR,
|
||||||
|
LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF,
|
||||||
|
TYPE_EXTENSION_AND "/>
|
||||||
|
</module>
|
||||||
|
<module name="AnnotationLocation">
|
||||||
|
<property name="id" value="AnnotationLocationMostCases"/>
|
||||||
|
<property name="tokens"
|
||||||
|
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF,
|
||||||
|
RECORD_DEF, COMPACT_CTOR_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="AnnotationLocation">
|
||||||
|
<property name="id" value="AnnotationLocationVariables"/>
|
||||||
|
<property name="tokens" value="VARIABLE_DEF"/>
|
||||||
|
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||||
|
</module>
|
||||||
|
<module name="NonEmptyAtclauseDescription"/>
|
||||||
|
<module name="InvalidJavadocPosition"/>
|
||||||
|
<module name="JavadocTagContinuationIndentation"/>
|
||||||
|
<module name="JavadocParagraph"/>
|
||||||
|
<module name="RequireEmptyLineBeforeBlockTagGroup"/>
|
||||||
|
<module name="AtclauseOrder">
|
||||||
|
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
|
||||||
|
<property name="target"
|
||||||
|
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="JavadocMethod">
|
||||||
|
<property name="accessModifiers" value="public"/>
|
||||||
|
<property name="allowMissingParamTags" value="true"/>
|
||||||
|
<property name="allowMissingReturnTag" value="true"/>
|
||||||
|
<property name="allowedAnnotations" value="Override, Test"/>
|
||||||
|
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF"/>
|
||||||
|
</module>
|
||||||
|
<module name="MethodName">
|
||||||
|
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
|
||||||
|
<message key="name.invalidPattern"
|
||||||
|
value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||||
|
</module>
|
||||||
|
<module name="SingleLineJavadoc"/>
|
||||||
|
<module name="EmptyCatchBlock">
|
||||||
|
<property name="exceptionVariableName" value="expected"/>
|
||||||
|
</module>
|
||||||
|
<module name="CommentsIndentation">
|
||||||
|
<property name="tokens" value="SINGLE_LINE_COMMENT, BLOCK_COMMENT_BEGIN"/>
|
||||||
|
</module>
|
||||||
|
<!-- https://checkstyle.org/config_filters.html#SuppressionXpathFilter -->
|
||||||
|
<module name="SuppressionXpathFilter">
|
||||||
|
<property name="file" value="${org.checkstyle.google.suppressionxpathfilter.config}"
|
||||||
|
default="checkstyle-xpath-suppressions.xml"/>
|
||||||
|
<property name="optional" value="true"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- prettyZoo extra rule -->
|
||||||
|
<module name="IllegalImport"/>
|
||||||
|
<module name="RedundantImport"/>
|
||||||
|
<module name="UnusedImports"/>
|
||||||
|
<module name="EmptyLineSeparator">
|
||||||
|
<property name="allowMultipleEmptyLines" value="false"/>
|
||||||
|
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
|
||||||
|
</module>
|
||||||
|
<module name="RegexpSinglelineJava">
|
||||||
|
<!-- Check for e.printStackTrace() in catch clauses.-->
|
||||||
|
<property name="format" value="e\.printStackTrace.*"/>
|
||||||
|
<property name="message" value="使用 log.error() 替代 e.printStackTrace()"/>
|
||||||
|
<property name="ignoreComments" value="true"/>
|
||||||
|
</module>
|
||||||
|
</module>
|
||||||
|
</module>
|
|
@ -121,10 +121,11 @@ public class DocumentService {
|
||||||
|
|
||||||
Integer currentDatabaseDocumentId = databaseDocumentId;
|
Integer currentDatabaseDocumentId = databaseDocumentId;
|
||||||
if (databaseDocumentId == null) {
|
if (databaseDocumentId == null) {
|
||||||
currentDatabaseDocumentId =
|
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, 1L);
|
||||||
databaseDocumentDao.insertAndReturnId(documentPojoConverter.toDatabasePojo(projectId, meta, 1L));
|
currentDatabaseDocumentId = databaseDocumentDao.insertAndReturnId(pojo);
|
||||||
} else {
|
} else {
|
||||||
databaseDocumentDao.update(documentPojoConverter.toDatabasePojo(projectId, meta, databaseDocumentId, version));
|
var pojo = documentPojoConverter.toDatabasePojo(projectId, meta, databaseDocumentId, version);
|
||||||
|
databaseDocumentDao.update(pojo);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Integer docId = currentDatabaseDocumentId;
|
final Integer docId = currentDatabaseDocumentId;
|
||||||
|
@ -132,11 +133,14 @@ public class DocumentService {
|
||||||
TableDocumentPojo tableMeta =
|
TableDocumentPojo tableMeta =
|
||||||
documentPojoConverter.toTablePojo(docId, table);
|
documentPojoConverter.toTablePojo(docId, table);
|
||||||
Integer tableMetaId = tableDocumentDao.insertAndReturnId(tableMeta);
|
Integer tableMetaId = tableDocumentDao.insertAndReturnId(tableMeta);
|
||||||
List<TableColumnDocumentPojo> tableColumnMetas = documentPojoConverter.toColumnPojo(docId, tableMetaId, table.getColumns());
|
List<TableColumnDocumentPojo> tableColumnMetas =
|
||||||
|
documentPojoConverter.toColumnPojo(docId, tableMetaId, table.getColumns());
|
||||||
tableColumnDocumentDao.batchInsert(tableColumnMetas);
|
tableColumnDocumentDao.batchInsert(tableColumnMetas);
|
||||||
List<TableIndexDocumentPojo> tableIndexMetas = documentPojoConverter.toIndexPojo(docId, tableMetaId, table.getIndexes());
|
List<TableIndexDocumentPojo> tableIndexMetas =
|
||||||
|
documentPojoConverter.toIndexPojo(docId, tableMetaId, table.getIndexes());
|
||||||
tableIndexDocumentDao.batchInsert(tableIndexMetas);
|
tableIndexDocumentDao.batchInsert(tableIndexMetas);
|
||||||
List<TableTriggerDocumentPojo> tableTriggerMetas = documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
|
List<TableTriggerDocumentPojo> tableTriggerMetas =
|
||||||
|
documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
|
||||||
tableTriggerDocumentDao.batchInsert(tableTriggerMetas);
|
tableTriggerDocumentDao.batchInsert(tableTriggerMetas);
|
||||||
});
|
});
|
||||||
log.info("save new meta info success");
|
log.info("save new meta info success");
|
||||||
|
@ -147,21 +151,25 @@ public class DocumentService {
|
||||||
return databaseDocumentDao.selectOptionalByProjectId(projectId)
|
return databaseDocumentDao.selectOptionalByProjectId(projectId)
|
||||||
.map(document -> {
|
.map(document -> {
|
||||||
Integer id = document.getId();
|
Integer id = document.getId();
|
||||||
List<TableDocumentPojo> tables = tableDocumentDao.selectByDatabaseDocumentId(id);
|
var tables = tableDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
List<TableColumnDocumentPojo> columns = tableColumnDocumentDao.selectByDatabaseDocumentId(id);
|
var columns = tableColumnDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
List<TableIndexDocumentPojo> indexes = tableIndexDocumentDao.selectByDatabaseMetaId(id);
|
var indexes = tableIndexDocumentDao.selectByDatabaseMetaId(id);
|
||||||
List<TableTriggerDocumentPojo> triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(id);
|
var triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
Map<Integer, List<TableColumnDocumentPojo>> columnsGroupByTableMetaId = columns.stream()
|
Map<Integer, List<TableColumnDocumentPojo>> columnsGroupByTableMetaId = columns.stream()
|
||||||
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
|
||||||
Map<Integer, List<TableIndexDocumentPojo>> indexesGroupByTableMetaId = indexes.stream()
|
Map<Integer, List<TableIndexDocumentPojo>> indexesGroupByTableMetaId = indexes.stream()
|
||||||
.collect(Collectors.groupingBy(TableIndexDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableIndexDocumentPojo::getTableDocumentId));
|
||||||
Map<Integer, List<TableTriggerDocumentPojo>> triggersGroupByTableMetaId = triggers.stream()
|
Map<Integer, List<TableTriggerDocumentPojo>> triggersGroupByTableMetaId = triggers.stream()
|
||||||
.collect(Collectors.groupingBy(TableTriggerDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableTriggerDocumentPojo::getTableDocumentId));
|
||||||
List<DatabaseDocumentResponse.TableDocumentResponse> tableDocumentResponseList = tables.stream()
|
var tableDocumentResponseList = tables.stream()
|
||||||
.map(table -> {
|
.map(table -> {
|
||||||
List<TableColumnDocumentPojo> subColumns = columnsGroupByTableMetaId.getOrDefault(table.getId(), Collections.emptyList());
|
Integer tableId = table.getId();
|
||||||
List<TableIndexDocumentPojo> subIndexes = indexesGroupByTableMetaId.getOrDefault(table.getId(), Collections.emptyList());
|
var subColumns =
|
||||||
List<TableTriggerDocumentPojo> subTriggers = triggersGroupByTableMetaId.getOrDefault(table.getId(), Collections.emptyList());
|
columnsGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
|
var subIndexes =
|
||||||
|
indexesGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
|
var subTriggers =
|
||||||
|
triggersGroupByTableMetaId.getOrDefault(tableId, Collections.emptyList());
|
||||||
return documentResponseConverter.of(table, subColumns, subIndexes, subTriggers);
|
return documentResponseConverter.of(table, subColumns, subIndexes, subTriggers);
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -175,11 +183,12 @@ public class DocumentService {
|
||||||
|
|
||||||
public Page<DatabaseDocumentVersionResponse> getVersionsBySchemaSourceId(Integer projectId, Pageable page) {
|
public Page<DatabaseDocumentVersionResponse> getVersionsBySchemaSourceId(Integer projectId, Pageable page) {
|
||||||
return databaseDocumentDao.selectOptionalByProjectId(projectId)
|
return databaseDocumentDao.selectOptionalByProjectId(projectId)
|
||||||
.map(schemaMeta -> databaseDocumentHistoryDao.selectVersionPageByDatabaseDocumentId(page, schemaMeta.getId())
|
.map(schemaMeta ->
|
||||||
.map(history -> DatabaseDocumentVersionResponse.builder()
|
databaseDocumentHistoryDao.selectVersionPageByDatabaseDocumentId(page, schemaMeta.getId())
|
||||||
.version(history.getVersion())
|
.map(history -> DatabaseDocumentVersionResponse.builder()
|
||||||
.createAt(history.getCreateAt())
|
.version(history.getVersion())
|
||||||
.build()))
|
.createAt(history.getCreateAt())
|
||||||
|
.build()))
|
||||||
.orElseGet(Page::empty);
|
.orElseGet(Page::empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,11 +202,13 @@ public class DocumentService {
|
||||||
List<List<String>> overviewContent = new ArrayList<>();
|
List<List<String>> overviewContent = new ArrayList<>();
|
||||||
for (int i = 0; i < doc.getTables().size(); i++) {
|
for (int i = 0; i < doc.getTables().size(); i++) {
|
||||||
DatabaseDocumentResponse.TableDocumentResponse table = doc.getTables().get(i);
|
DatabaseDocumentResponse.TableDocumentResponse table = doc.getTables().get(i);
|
||||||
overviewContent.add(List.of((i + 1) + "", table.getName(), table.getType(), table.getComment()));
|
overviewContent.add(List.of((i + 1) + "", table.getName(), table.getType(),
|
||||||
|
table.getComment()));
|
||||||
}
|
}
|
||||||
builder.table(List.of("", "表名", "类型", "备注"), overviewContent);
|
builder.table(List.of("", "表名", "类型", "备注"), overviewContent);
|
||||||
|
|
||||||
Function<DatabaseDocumentResponse.TableDocumentResponse.ColumnDocumentResponse, String> columnDefaultValueMapping = column -> {
|
Function<DatabaseDocumentResponse.TableDocumentResponse.ColumnDocumentResponse, String>
|
||||||
|
columnDefaultValueMapping = column -> {
|
||||||
if (Objects.equals(column.getNullable(), "YES")) {
|
if (Objects.equals(column.getNullable(), "YES")) {
|
||||||
return Objects.requireNonNullElse(column.getDefaultValue(), "null");
|
return Objects.requireNonNullElse(column.getDefaultValue(), "null");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.databasir.core.domain.group.data;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class GroupMemberRoleUpdateRequest {
|
public class GroupMemberRoleUpdateRequest {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -88,10 +87,10 @@ public class GroupService {
|
||||||
.stream()
|
.stream()
|
||||||
.map(GroupPojo::getId)
|
.map(GroupPojo::getId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
Map<Integer, List<GroupMemberSimplePojo>> ownersGroupByGroupId = userRoleDao.selectOwnerNamesByGroupIdIn(groupIdList)
|
var ownersGroupByGroupId = userRoleDao.selectOwnerNamesByGroupIdIn(groupIdList)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.groupingBy(GroupMemberSimplePojo::getGroupId));
|
.collect(Collectors.groupingBy(GroupMemberSimplePojo::getGroupId));
|
||||||
Map<Integer, GroupProjectCountPojo> projectCountMapByGroupId = projectDao.selectCountByGroupIds(groupIdList)
|
var projectCountMapByGroupId = projectDao.selectCountByGroupIds(groupIdList)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(GroupProjectCountPojo::getGroupId, v -> v));
|
.collect(Collectors.toMap(GroupProjectCountPojo::getGroupId, v -> v));
|
||||||
return page.map(groupPojo -> {
|
return page.map(groupPojo -> {
|
||||||
|
|
|
@ -1,20 +1,14 @@
|
||||||
package com.databasir.core.domain.project.converter;
|
package com.databasir.core.domain.project.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.project.data.ProjectCreateRequest;
|
import com.databasir.core.domain.project.data.ProjectCreateRequest;
|
||||||
import com.databasir.core.domain.project.data.ProjectDetailResponse;
|
|
||||||
import com.databasir.core.domain.project.data.ProjectSimpleResponse;
|
|
||||||
import com.databasir.core.domain.project.data.ProjectUpdateRequest;
|
import com.databasir.core.domain.project.data.ProjectUpdateRequest;
|
||||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||||
import com.databasir.dao.tables.pojos.DataSourcePojo;
|
|
||||||
import com.databasir.dao.tables.pojos.DataSourcePropertyPojo;
|
|
||||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
import com.databasir.dao.tables.pojos.ProjectPojo;
|
||||||
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo;
|
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.ReportingPolicy;
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = JsonConverter.class)
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = JsonConverter.class)
|
||||||
public interface ProjectPojoConverter {
|
public interface ProjectPojoConverter {
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class ProjectService {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
SysKeyPojo sysKey = sysKeyDao.selectTopOne();
|
SysKeyPojo sysKey = sysKeyDao.selectTopOne();
|
||||||
// String decryptedPassword = Rsa.decryptFromBase64DataByPrivateKey(password, sysKey.getRsaPrivateKey());
|
// String decryptedPassword = Rsa.decryptFromBase64DataByPrivateKey(password, sysKey.getRsaPrivateKey());
|
||||||
return Optional.of(Aes.encryptToBase64Data(password, sysKey.getAesKey()));
|
return Optional.of(Aes.encryptToBase64Data(password, sysKey.getAesKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class SystemService {
|
||||||
|
|
||||||
private final UserRoleDao userRoleDao;
|
private final UserRoleDao userRoleDao;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:all")
|
||||||
private BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
|
private BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
|
@ -83,11 +84,12 @@ public class SystemService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEmailSetting(SystemEmailUpdateRequest request) {
|
public void updateEmailSetting(SystemEmailUpdateRequest request) {
|
||||||
Optional<Integer> idOpt = sysMailDao.selectOptionTopOne().map(SysMailPojo::getId);
|
|
||||||
SysMailPojo sysMailPojo = new SysMailPojo();
|
SysMailPojo sysMailPojo = new SysMailPojo();
|
||||||
sysMailPojo.setSmtpHost(request.getSmtpHost());
|
sysMailPojo.setSmtpHost(request.getSmtpHost());
|
||||||
sysMailPojo.setSmtpPort(request.getSmtpPort());
|
sysMailPojo.setSmtpPort(request.getSmtpPort());
|
||||||
sysMailPojo.setUsername(request.getUsername());
|
sysMailPojo.setUsername(request.getUsername());
|
||||||
|
|
||||||
|
Optional<Integer> idOpt = sysMailDao.selectOptionTopOne().map(SysMailPojo::getId);
|
||||||
idOpt.ifPresent(sysMailPojo::setId);
|
idOpt.ifPresent(sysMailPojo::setId);
|
||||||
if (request.getPassword() != null) {
|
if (request.getPassword() != null) {
|
||||||
// TODO encrypt password ?
|
// TODO encrypt password ?
|
||||||
|
|
|
@ -13,7 +13,6 @@ import java.util.stream.Collectors;
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface UserResponseConverter {
|
public interface UserResponseConverter {
|
||||||
|
|
||||||
|
|
||||||
default UserDetailResponse detailResponse(UserPojo user,
|
default UserDetailResponse detailResponse(UserPojo user,
|
||||||
List<UserRolePojo> userRoles,
|
List<UserRolePojo> userRoles,
|
||||||
Map<Integer, String> groupNameMapById) {
|
Map<Integer, String> groupNameMapById) {
|
||||||
|
|
|
@ -25,7 +25,9 @@ public class UserLoginResponse {
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class RoleResponse {
|
public static class RoleResponse {
|
||||||
|
|
||||||
private String role;
|
private String role;
|
||||||
|
|
||||||
private Integer groupId;
|
private Integer groupId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class UserService {
|
||||||
|
|
||||||
private final MailSender mailSender;
|
private final MailSender mailSender;
|
||||||
|
|
||||||
|
@SuppressWarnings("checkstyle:all")
|
||||||
private BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
|
private BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
|
||||||
|
|
||||||
public Page<UserPageResponse> list(Pageable pageable, UserPageCondition condition) {
|
public Page<UserPageResponse> list(Pageable pageable, UserPageCondition condition) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.databasir.core.infrastructure.connection;
|
package com.databasir.core.infrastructure.connection;
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
|
@ -20,11 +20,6 @@ public class JsonConverter {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
public JSON toJson(List<String> array) {
|
|
||||||
String json = objToJson(array);
|
|
||||||
return JSON.valueOf(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> fromJson(JSON json) {
|
public List<String> fromJson(JSON json) {
|
||||||
String data = json.data();
|
String data = json.data();
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
|
@ -40,11 +35,21 @@ public class JsonConverter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JSON toJson(List<String> array) {
|
||||||
|
String json = objToJson(array);
|
||||||
|
return JSON.valueOf(json);
|
||||||
|
}
|
||||||
|
|
||||||
public JSON toJson(DatabaseDocumentResponse response) {
|
public JSON toJson(DatabaseDocumentResponse response) {
|
||||||
String json = objToJson(response);
|
String json = objToJson(response);
|
||||||
return JSON.valueOf(json);
|
return JSON.valueOf(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JSON toJson(JsonData<Object> data) {
|
||||||
|
String json = objToJson(data);
|
||||||
|
return JSON.valueOf(json);
|
||||||
|
}
|
||||||
|
|
||||||
public DatabaseDocumentResponse of(JSON json) {
|
public DatabaseDocumentResponse of(JSON json) {
|
||||||
try {
|
try {
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
|
@ -67,11 +72,6 @@ public class JsonConverter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSON toJson(JsonData<Object> data) {
|
|
||||||
String json = objToJson(data);
|
|
||||||
return JSON.valueOf(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JSON objToJsonData(Object obj) {
|
public JSON objToJsonData(Object obj) {
|
||||||
String json = objToJson(obj);
|
String json = objToJson(obj);
|
||||||
return JSON.valueOf(json);
|
return JSON.valueOf(json);
|
||||||
|
|
|
@ -12,12 +12,13 @@ import java.nio.charset.StandardCharsets;
|
||||||
public class MailSender {
|
public class MailSender {
|
||||||
|
|
||||||
public void send(SysMailPojo mail, String to, String subject, String content) {
|
public void send(SysMailPojo mail, String to, String subject, String content) {
|
||||||
JavaMailSender sender = initJavaMailSender(mail);
|
|
||||||
SimpleMailMessage message = new SimpleMailMessage();
|
SimpleMailMessage message = new SimpleMailMessage();
|
||||||
message.setFrom(mail.getUsername());
|
message.setFrom(mail.getUsername());
|
||||||
message.setTo(to);
|
message.setTo(to);
|
||||||
message.setSubject(subject);
|
message.setSubject(subject);
|
||||||
message.setText(content);
|
message.setText(content);
|
||||||
|
|
||||||
|
JavaMailSender sender = initJavaMailSender(mail);
|
||||||
sender.send(message);
|
sender.send(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,4 +74,6 @@ jooq {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkstyleMain.source = "src/main/java"
|
||||||
|
|
|
@ -18,7 +18,10 @@ public class DataNotExistsException extends RuntimeException {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected DataNotExistsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
protected DataNotExistsException(String message,
|
||||||
|
Throwable cause,
|
||||||
|
boolean enableSuppression,
|
||||||
|
boolean writableStackTrace) {
|
||||||
super(message, cause, enableSuppression, writableStackTrace);
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.databasir.dao.impl;
|
package com.databasir.dao.impl;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.dao.exception.DataNotExistsException;
|
import com.databasir.dao.exception.DataNotExistsException;
|
||||||
import org.jooq.*;
|
import org.jooq.*;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
@ -12,13 +11,13 @@ import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class BaseDao<PO> {
|
public abstract class BaseDao<R> {
|
||||||
|
|
||||||
private final Table<?> table;
|
private final Table<?> table;
|
||||||
|
|
||||||
private final Class<PO> pojoType;
|
private final Class<R> pojoType;
|
||||||
|
|
||||||
public BaseDao(Table<?> table, Class<PO> pojoType) {
|
public BaseDao(Table<?> table, Class<R> pojoType) {
|
||||||
this.table = table;
|
this.table = table;
|
||||||
this.pojoType = pojoType;
|
this.pojoType = pojoType;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +28,7 @@ public abstract class BaseDao<PO> {
|
||||||
return getDslContext().fetchExists(table, identity().eq(id));
|
return getDslContext().fetchExists(table, identity().eq(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T insertAndReturnId(PO pojo) {
|
public <T> T insertAndReturnId(R pojo) {
|
||||||
Record record = getDslContext().newRecord(table, pojo);
|
Record record = getDslContext().newRecord(table, pojo);
|
||||||
UpdatableRecord<?> updatableRecord = (UpdatableRecord<?>) record;
|
UpdatableRecord<?> updatableRecord = (UpdatableRecord<?>) record;
|
||||||
updatableRecord.store();
|
updatableRecord.store();
|
||||||
|
@ -37,7 +36,7 @@ public abstract class BaseDao<PO> {
|
||||||
return (T) identityType().cast(value);
|
return (T) identityType().cast(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int batchInsert(Collection<PO> pojoList) {
|
public int batchInsert(Collection<R> pojoList) {
|
||||||
List<TableRecord<?>> records = pojoList.stream()
|
List<TableRecord<?>> records = pojoList.stream()
|
||||||
.map(pojo -> {
|
.map(pojo -> {
|
||||||
Record record = getDslContext().newRecord(table, pojo);
|
Record record = getDslContext().newRecord(table, pojo);
|
||||||
|
@ -53,24 +52,25 @@ public abstract class BaseDao<PO> {
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int updateById(PO pojo) {
|
public int updateById(R pojo) {
|
||||||
Record record = getDslContext().newRecord(table, pojo);
|
Record record = getDslContext().newRecord(table, pojo);
|
||||||
record.changed(table.getIdentity().getField(), false);
|
record.changed(table.getIdentity().getField(), false);
|
||||||
return getDslContext().executeUpdate((UpdatableRecord<?>) record);
|
return getDslContext().executeUpdate((UpdatableRecord<?>) record);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Serializable> Optional<PO> selectOptionalById(T id) {
|
public <T extends Serializable> Optional<R> selectOptionalById(T id) {
|
||||||
return getDslContext()
|
return getDslContext()
|
||||||
.select(table.fields()).from(table).where(identity().eq(id))
|
.select(table.fields()).from(table).where(identity().eq(id))
|
||||||
.fetchOptionalInto(pojoType);
|
.fetchOptionalInto(pojoType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends Serializable> PO selectById(T id) {
|
public <T extends Serializable> R selectById(T id) {
|
||||||
return selectOptionalById(id)
|
return selectOptionalById(id)
|
||||||
.orElseThrow(() -> new DataNotExistsException("data not exists in " + table.getName() + " with id = " + id));
|
.orElseThrow(() ->
|
||||||
|
new DataNotExistsException("data not exists in " + table.getName() + " with id = " + id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PO> selectInIds(List<? extends Serializable> ids) {
|
public List<R> selectInIds(List<? extends Serializable> ids) {
|
||||||
if (ids == null || ids.isEmpty()) {
|
if (ids == null || ids.isEmpty()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -80,12 +80,12 @@ public abstract class BaseDao<PO> {
|
||||||
.fetchInto(pojoType);
|
.fetchInto(pojoType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<PO> selectByPage(Pageable request, Condition condition) {
|
public Page<R> selectByPage(Pageable request, Condition condition) {
|
||||||
Integer count = getDslContext()
|
Integer count = getDslContext()
|
||||||
.selectCount().from(table).where(condition)
|
.selectCount().from(table).where(condition)
|
||||||
.fetchOne(0, int.class);
|
.fetchOne(0, int.class);
|
||||||
int total = count == null ? 0 : count;
|
int total = count == null ? 0 : count;
|
||||||
List<PO> data = getDslContext()
|
List<R> data = getDslContext()
|
||||||
.selectFrom(table).where(condition)
|
.selectFrom(table).where(condition)
|
||||||
.orderBy(getSortFields(request.getSort()))
|
.orderBy(getSortFields(request.getSort()))
|
||||||
.offset(request.getOffset()).limit(request.getPageSize())
|
.offset(request.getOffset()).limit(request.getPageSize())
|
||||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Optional;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.DATA_SOURCE;
|
import static com.databasir.dao.Tables.DATA_SOURCE;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class DataSourceDao extends BaseDao<DataSourcePojo> {
|
public class DataSourceDao extends BaseDao<DataSourcePojo> {
|
||||||
|
|
||||||
|
@ -36,7 +35,10 @@ public class DataSourceDao extends BaseDao<DataSourcePojo> {
|
||||||
return getDslContext()
|
return getDslContext()
|
||||||
.select(DATA_SOURCE.fields()).from(DATA_SOURCE).where(DATA_SOURCE.PROJECT_ID.eq(projectId))
|
.select(DATA_SOURCE.fields()).from(DATA_SOURCE).where(DATA_SOURCE.PROJECT_ID.eq(projectId))
|
||||||
.fetchOptionalInto(DataSourcePojo.class)
|
.fetchOptionalInto(DataSourcePojo.class)
|
||||||
.orElseThrow(() -> new DataNotExistsException("data not exists in " + table().getName() + " with schemaSourceId = " + projectId));
|
.orElseThrow(() -> new DataNotExistsException("data not exists in "
|
||||||
|
+ table().getName()
|
||||||
|
+ " with schemaSourceId = "
|
||||||
|
+ projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int updateByProjectId(DataSourcePojo dataSource) {
|
public int updateByProjectId(DataSourcePojo dataSource) {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.DATA_SOURCE_PROPERTY;
|
import static com.databasir.dao.Tables.DATA_SOURCE_PROPERTY;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class DataSourcePropertyDao extends BaseDao<DataSourcePropertyPojo> {
|
public class DataSourcePropertyDao extends BaseDao<DataSourcePropertyPojo> {
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Optional;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.DATABASE_DOCUMENT;
|
import static com.databasir.dao.Tables.DATABASE_DOCUMENT;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class DatabaseDocumentDao extends BaseDao<DatabaseDocumentPojo> {
|
public class DatabaseDocumentDao extends BaseDao<DatabaseDocumentPojo> {
|
||||||
|
|
||||||
|
@ -25,7 +24,8 @@ public class DatabaseDocumentDao extends BaseDao<DatabaseDocumentPojo> {
|
||||||
|
|
||||||
public Optional<DatabaseDocumentPojo> selectOptionalByProjectId(Integer projectId) {
|
public Optional<DatabaseDocumentPojo> selectOptionalByProjectId(Integer projectId) {
|
||||||
return getDslContext()
|
return getDslContext()
|
||||||
.select(DATABASE_DOCUMENT.fields()).from(DATABASE_DOCUMENT).where(DATABASE_DOCUMENT.PROJECT_ID.eq(projectId))
|
.select(DATABASE_DOCUMENT.fields()).from(DATABASE_DOCUMENT)
|
||||||
|
.where(DATABASE_DOCUMENT.PROJECT_ID.eq(projectId))
|
||||||
.fetchOptionalInto(DatabaseDocumentPojo.class);
|
.fetchOptionalInto(DatabaseDocumentPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.Optional;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.DATABASE_DOCUMENT_HISTORY;
|
import static com.databasir.dao.Tables.DATABASE_DOCUMENT_HISTORY;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class DatabaseDocumentHistoryDao extends BaseDao<DatabaseDocumentHistoryPojo> {
|
public class DatabaseDocumentHistoryDao extends BaseDao<DatabaseDocumentHistoryPojo> {
|
||||||
|
|
||||||
|
@ -30,11 +29,14 @@ public class DatabaseDocumentHistoryDao extends BaseDao<DatabaseDocumentHistoryP
|
||||||
|
|
||||||
public Optional<DatabaseDocumentHistoryPojo> selectOptionalByProjectIdAndVersion(Integer projectId, Long version) {
|
public Optional<DatabaseDocumentHistoryPojo> selectOptionalByProjectIdAndVersion(Integer projectId, Long version) {
|
||||||
return dslContext
|
return dslContext
|
||||||
.selectFrom(DATABASE_DOCUMENT_HISTORY).where(DATABASE_DOCUMENT_HISTORY.PROJECT_ID.eq(projectId).and(DATABASE_DOCUMENT_HISTORY.VERSION.eq(version)))
|
.selectFrom(DATABASE_DOCUMENT_HISTORY)
|
||||||
|
.where(DATABASE_DOCUMENT_HISTORY.PROJECT_ID.eq(projectId)
|
||||||
|
.and(DATABASE_DOCUMENT_HISTORY.VERSION.eq(version)))
|
||||||
.fetchOptionalInto(DatabaseDocumentHistoryPojo.class);
|
.fetchOptionalInto(DatabaseDocumentHistoryPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<DatabaseDocumentVersionPojo> selectVersionPageByDatabaseDocumentId(Pageable request, Integer schemaDocumentId) {
|
public Page<DatabaseDocumentVersionPojo> selectVersionPageByDatabaseDocumentId(Pageable request,
|
||||||
|
Integer schemaDocumentId) {
|
||||||
Condition condition = DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID.eq(schemaDocumentId);
|
Condition condition = DATABASE_DOCUMENT_HISTORY.DATABASE_DOCUMENT_ID.eq(schemaDocumentId);
|
||||||
Integer count = getDslContext()
|
Integer count = getDslContext()
|
||||||
.selectCount().from(DATABASE_DOCUMENT_HISTORY).where(condition)
|
.selectCount().from(DATABASE_DOCUMENT_HISTORY).where(condition)
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.Optional;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.DOCUMENT_REMARK;
|
import static com.databasir.dao.Tables.DOCUMENT_REMARK;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class DocumentRemarkDao extends BaseDao<DocumentRemarkPojo> {
|
public class DocumentRemarkDao extends BaseDao<DocumentRemarkPojo> {
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ public class GroupDao extends BaseDao<GroupPojo> {
|
||||||
super(GROUP, GroupPojo.class);
|
super(GROUP, GroupPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends Serializable> int deleteById(T id) {
|
public <T extends Serializable> int deleteById(T id) {
|
||||||
return dslContext
|
return dslContext
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Optional;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.LOGIN;
|
import static com.databasir.dao.Tables.LOGIN;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class LoginDao extends BaseDao<LoginPojo> {
|
public class LoginDao extends BaseDao<LoginPojo> {
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.util.stream.Collectors;
|
||||||
import static com.databasir.dao.Tables.DATA_SOURCE;
|
import static com.databasir.dao.Tables.DATA_SOURCE;
|
||||||
import static com.databasir.dao.Tables.PROJECT;
|
import static com.databasir.dao.Tables.PROJECT;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class ProjectDao extends BaseDao<ProjectPojo> {
|
public class ProjectDao extends BaseDao<ProjectPojo> {
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,19 @@ public class ProjectSyncRuleDao extends BaseDao<ProjectSyncRulePojo> {
|
||||||
|
|
||||||
public Optional<ProjectSyncRulePojo> selectOptionalByProjectId(Integer projectId) {
|
public Optional<ProjectSyncRulePojo> selectOptionalByProjectId(Integer projectId) {
|
||||||
return getDslContext()
|
return getDslContext()
|
||||||
.select(PROJECT_SYNC_RULE.fields()).from(PROJECT_SYNC_RULE).where(PROJECT_SYNC_RULE.PROJECT_ID.eq(projectId))
|
.select(PROJECT_SYNC_RULE.fields()).from(PROJECT_SYNC_RULE)
|
||||||
|
.where(PROJECT_SYNC_RULE.PROJECT_ID.eq(projectId))
|
||||||
.fetchOptionalInto(ProjectSyncRulePojo.class);
|
.fetchOptionalInto(ProjectSyncRulePojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectSyncRulePojo selectByProjectId(Integer projectId) {
|
public ProjectSyncRulePojo selectByProjectId(Integer projectId) {
|
||||||
return getDslContext()
|
return getDslContext()
|
||||||
.select(PROJECT_SYNC_RULE.fields()).from(PROJECT_SYNC_RULE).where(PROJECT_SYNC_RULE.PROJECT_ID.eq(projectId))
|
.select(PROJECT_SYNC_RULE.fields()).from(PROJECT_SYNC_RULE)
|
||||||
|
.where(PROJECT_SYNC_RULE.PROJECT_ID.eq(projectId))
|
||||||
.fetchOptionalInto(ProjectSyncRulePojo.class)
|
.fetchOptionalInto(ProjectSyncRulePojo.class)
|
||||||
.orElseThrow(() -> new DataNotExistsException("data not exists in " + table().getName() + " with projectId = " + projectId));
|
.orElseThrow(() -> new DataNotExistsException("data not exists in "
|
||||||
|
+ table().getName()
|
||||||
|
+ " with projectId = " + projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int updateByProjectId(ProjectSyncRulePojo rule) {
|
public int updateByProjectId(ProjectSyncRulePojo rule) {
|
||||||
|
@ -76,7 +80,8 @@ public class ProjectSyncRuleDao extends BaseDao<ProjectSyncRulePojo> {
|
||||||
.fetchInto(ProjectSyncRulePojo.class);
|
.fetchInto(ProjectSyncRulePojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProjectSyncRulePojo> selectByIsAutoSyncAndNotInProjectIds(boolean isAutoSync, List<Integer> projectIds) {
|
public List<ProjectSyncRulePojo> selectByIsAutoSyncAndNotInProjectIds(boolean isAutoSync,
|
||||||
|
List<Integer> projectIds) {
|
||||||
if (projectIds == null || projectIds.isEmpty()) {
|
if (projectIds == null || projectIds.isEmpty()) {
|
||||||
return getDslContext()
|
return getDslContext()
|
||||||
.selectFrom(PROJECT_SYNC_RULE)
|
.selectFrom(PROJECT_SYNC_RULE)
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.TABLE_COLUMN_DOCUMENT;
|
import static com.databasir.dao.Tables.TABLE_COLUMN_DOCUMENT;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class TableColumnDocumentDao extends BaseDao<TableColumnDocumentPojo> {
|
public class TableColumnDocumentDao extends BaseDao<TableColumnDocumentPojo> {
|
||||||
|
|
||||||
|
@ -31,7 +30,8 @@ public class TableColumnDocumentDao extends BaseDao<TableColumnDocumentPojo> {
|
||||||
|
|
||||||
public void deleteByDatabaseDocumentId(Integer schemaDocumentId) {
|
public void deleteByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||||
getDslContext()
|
getDslContext()
|
||||||
.deleteFrom(TABLE_COLUMN_DOCUMENT).where(TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
.deleteFrom(TABLE_COLUMN_DOCUMENT)
|
||||||
|
.where(TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class TableDocumentDao extends BaseDao<TableDocumentPojo> {
|
||||||
|
|
||||||
public List<TableDocumentPojo> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
public List<TableDocumentPojo> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||||
return getDslContext()
|
return getDslContext()
|
||||||
.select(TABLE_DOCUMENT.fields()).from(TABLE_DOCUMENT).where(TABLE_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
.select(TABLE_DOCUMENT.fields()).from(TABLE_DOCUMENT)
|
||||||
|
.where(TABLE_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
||||||
.fetchInto(TableDocumentPojo.class);
|
.fetchInto(TableDocumentPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.List;
|
||||||
|
|
||||||
import static com.databasir.dao.Tables.TABLE_INDEX_DOCUMENT;
|
import static com.databasir.dao.Tables.TABLE_INDEX_DOCUMENT;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class TableIndexDocumentDao extends BaseDao<TableIndexDocumentPojo> {
|
public class TableIndexDocumentDao extends BaseDao<TableIndexDocumentPojo> {
|
||||||
|
|
||||||
|
|
|
@ -23,13 +23,15 @@ public class TableTriggerDocumentDao extends BaseDao<TableTriggerDocumentPojo> {
|
||||||
|
|
||||||
public List<TableTriggerDocumentPojo> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
public List<TableTriggerDocumentPojo> selectByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||||
return getDslContext()
|
return getDslContext()
|
||||||
.select(TABLE_TRIGGER_DOCUMENT.fields()).from(TABLE_TRIGGER_DOCUMENT).where(TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
.select(TABLE_TRIGGER_DOCUMENT.fields()).from(TABLE_TRIGGER_DOCUMENT)
|
||||||
|
.where(TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
||||||
.fetchInto(TableTriggerDocumentPojo.class);
|
.fetchInto(TableTriggerDocumentPojo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteByDatabaseDocumentId(Integer schemaDocumentId) {
|
public void deleteByDatabaseDocumentId(Integer schemaDocumentId) {
|
||||||
getDslContext()
|
getDslContext()
|
||||||
.deleteFrom(TABLE_TRIGGER_DOCUMENT).where(TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
.deleteFrom(TABLE_TRIGGER_DOCUMENT)
|
||||||
|
.where(TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID.eq(schemaDocumentId))
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.util.*;
|
||||||
import static com.databasir.dao.Tables.USER;
|
import static com.databasir.dao.Tables.USER;
|
||||||
import static com.databasir.dao.Tables.USER_ROLE;
|
import static com.databasir.dao.Tables.USER_ROLE;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class UserDao extends BaseDao<UserPojo> {
|
public class UserDao extends BaseDao<UserPojo> {
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.List;
|
||||||
import static com.databasir.dao.Tables.USER;
|
import static com.databasir.dao.Tables.USER;
|
||||||
import static com.databasir.dao.Tables.USER_ROLE;
|
import static com.databasir.dao.Tables.USER_ROLE;
|
||||||
|
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class UserRoleDao extends BaseDao<UserRolePojo> {
|
public class UserRoleDao extends BaseDao<UserRolePojo> {
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ public interface SqlProvider {
|
||||||
* </table>
|
* </table>
|
||||||
* <br>
|
* <br>
|
||||||
*
|
*
|
||||||
* @param databaseName
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
default Optional<String> databaseMetaSql(String databaseName) {
|
default Optional<String> databaseMetaSql(String databaseName) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
@ -54,9 +52,6 @@ public interface SqlProvider {
|
||||||
* </tr>
|
* </tr>
|
||||||
* </table>
|
* </table>
|
||||||
*
|
*
|
||||||
* @param databaseName
|
|
||||||
* @param tableName
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
default Optional<String> tableMetaSql(String databaseName, String tableName) {
|
default Optional<String> tableMetaSql(String databaseName, String tableName) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
|
|
@ -20,5 +20,4 @@ public class TableCondition extends Condition {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,26 +18,26 @@ public class MysqlTableTriggerMetaRepository implements TriggerMetaRepository {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TriggerMeta> selectTriggers(Connection connection, TableCondition condition) {
|
public List<TriggerMeta> selectTriggers(Connection connection, TableCondition condition) {
|
||||||
String sql = "SELECT TRIGGER_CATALOG,\n" +
|
String sql = "SELECT TRIGGER_CATALOG,\n"
|
||||||
" TRIGGER_SCHEMA,\n" +
|
+ " TRIGGER_SCHEMA,\n"
|
||||||
" TRIGGER_NAME,\n" +
|
+ " TRIGGER_NAME,\n"
|
||||||
" EVENT_MANIPULATION,\n" +
|
+ " EVENT_MANIPULATION,\n"
|
||||||
" EVENT_OBJECT_CATALOG,\n" +
|
+ " EVENT_OBJECT_CATALOG,\n"
|
||||||
" EVENT_OBJECT_SCHEMA,\n" +
|
+ " EVENT_OBJECT_SCHEMA,\n"
|
||||||
" EVENT_OBJECT_TABLE,\n" +
|
+ " EVENT_OBJECT_TABLE,\n"
|
||||||
" ACTION_ORDER,\n" +
|
+ " ACTION_ORDER,\n"
|
||||||
" ACTION_CONDITION,\n" +
|
+ " ACTION_CONDITION,\n"
|
||||||
" ACTION_STATEMENT,\n" +
|
+ " ACTION_STATEMENT,\n"
|
||||||
" ACTION_ORIENTATION,\n" +
|
+ " ACTION_ORIENTATION,\n"
|
||||||
" ACTION_TIMING,\n" +
|
+ " ACTION_TIMING,\n"
|
||||||
" ACTION_REFERENCE_OLD_TABLE,\n" +
|
+ " ACTION_REFERENCE_OLD_TABLE,\n"
|
||||||
" ACTION_REFERENCE_NEW_TABLE,\n" +
|
+ " ACTION_REFERENCE_NEW_TABLE,\n"
|
||||||
" ACTION_REFERENCE_OLD_ROW,\n" +
|
+ " ACTION_REFERENCE_OLD_ROW,\n"
|
||||||
" ACTION_REFERENCE_NEW_ROW,\n" +
|
+ " ACTION_REFERENCE_NEW_ROW,\n"
|
||||||
" CREATED,\n" +
|
+ " CREATED,\n"
|
||||||
" SQL_MODE,\n" +
|
+ " SQL_MODE,\n"
|
||||||
" DEFINER\n " +
|
+ " DEFINER\n "
|
||||||
"FROM information_schema.TRIGGERS WHERE EVENT_OBJECT_SCHEMA = ? AND EVENT_OBJECT_TABLE = ?";
|
+ "FROM information_schema.TRIGGERS WHERE EVENT_OBJECT_SCHEMA = ? AND EVENT_OBJECT_TABLE = ?";
|
||||||
try {
|
try {
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement(sql);
|
PreparedStatement preparedStatement = connection.prepareStatement(sql);
|
||||||
preparedStatement.setObject(1, condition.getDatabaseName());
|
preparedStatement.setObject(1, condition.getDatabaseName());
|
||||||
|
|
|
@ -45,14 +45,6 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository {
|
||||||
log.warn("ignore column: " + columnName);
|
log.warn("ignore column: " + columnName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String columnType = columnsResult.getString("TYPE_NAME");
|
|
||||||
Integer columnSize = columnsResult.getInt("COLUMN_SIZE");
|
|
||||||
Integer decimalDigits;
|
|
||||||
if (columnsResult.getObject("DECIMAL_DIGITS") == null) {
|
|
||||||
decimalDigits = null;
|
|
||||||
} else {
|
|
||||||
decimalDigits = columnsResult.getInt("DECIMAL_DIGITS");
|
|
||||||
}
|
|
||||||
String defaultValue = columnsResult.getString("COLUMN_DEF");
|
String defaultValue = columnsResult.getString("COLUMN_DEF");
|
||||||
String isNullable = columnsResult.getString("IS_NULLABLE");
|
String isNullable = columnsResult.getString("IS_NULLABLE");
|
||||||
if (isNullable.trim().equals("")) {
|
if (isNullable.trim().equals("")) {
|
||||||
|
@ -62,10 +54,18 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository {
|
||||||
if (isAutoIncrement.trim().equals("")) {
|
if (isAutoIncrement.trim().equals("")) {
|
||||||
isAutoIncrement = "UNKNOWN";
|
isAutoIncrement = "UNKNOWN";
|
||||||
}
|
}
|
||||||
String columnComment = columnsResult.getString("REMARKS");
|
|
||||||
if (defaultValue != null && defaultValue.trim().equals("")) {
|
if (defaultValue != null && defaultValue.trim().equals("")) {
|
||||||
defaultValue = "'" + defaultValue + "'";
|
defaultValue = "'" + defaultValue + "'";
|
||||||
}
|
}
|
||||||
|
Integer decimalDigits;
|
||||||
|
if (columnsResult.getObject("DECIMAL_DIGITS") == null) {
|
||||||
|
decimalDigits = null;
|
||||||
|
} else {
|
||||||
|
decimalDigits = columnsResult.getInt("DECIMAL_DIGITS");
|
||||||
|
}
|
||||||
|
Integer columnSize = columnsResult.getInt("COLUMN_SIZE");
|
||||||
|
String columnType = columnsResult.getString("TYPE_NAME");
|
||||||
|
String columnComment = columnsResult.getString("REMARKS");
|
||||||
ColumnMeta columnMeta = ColumnMeta.builder()
|
ColumnMeta columnMeta = ColumnMeta.builder()
|
||||||
.name(columnName)
|
.name(columnName)
|
||||||
.type(columnType)
|
.type(columnType)
|
||||||
|
@ -84,7 +84,9 @@ public class JdbcColumnMetaRepository implements ColumnMetaRepository {
|
||||||
return columnDocs;
|
return columnDocs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> selectPrimaryKeyColumns(DatabaseMetaData meta, String catalog, String tableName) throws SQLException {
|
private List<String> selectPrimaryKeyColumns(DatabaseMetaData meta,
|
||||||
|
String catalog,
|
||||||
|
String tableName) throws SQLException {
|
||||||
ResultSet result = meta.getPrimaryKeys(catalog, null, tableName);
|
ResultSet result = meta.getPrimaryKeys(catalog, null, tableName);
|
||||||
List<String> columns = new ArrayList<>();
|
List<String> columns = new ArrayList<>();
|
||||||
while (result.next()) {
|
while (result.next()) {
|
||||||
|
|
|
@ -19,11 +19,14 @@ public class RenderConfig {
|
||||||
|
|
||||||
private Boolean renderTriggers = true;
|
private Boolean renderTriggers = true;
|
||||||
|
|
||||||
private LinkedHashMap<String, Function<ColumnMeta, String>> columnTitleAndValueMapping = columnTitleAndValueMapping();
|
private LinkedHashMap<String, Function<ColumnMeta, String>> columnTitleAndValueMapping =
|
||||||
|
columnTitleAndValueMapping();
|
||||||
|
|
||||||
private LinkedHashMap<String, Function<IndexMeta, String>> indexTitleAndValueMapping = indexTitleAndValueMapping();
|
private LinkedHashMap<String, Function<IndexMeta, String>> indexTitleAndValueMapping =
|
||||||
|
indexTitleAndValueMapping();
|
||||||
|
|
||||||
private LinkedHashMap<String, Function<TriggerMeta, String>> triggerTitleAndValueMapping = triggerTitleAndValueMapping();
|
private LinkedHashMap<String, Function<TriggerMeta, String>> triggerTitleAndValueMapping =
|
||||||
|
triggerTitleAndValueMapping();
|
||||||
|
|
||||||
protected LinkedHashMap<String, Function<ColumnMeta, String>> columnTitleAndValueMapping() {
|
protected LinkedHashMap<String, Function<ColumnMeta, String>> columnTitleAndValueMapping() {
|
||||||
LinkedHashMap<String, Function<ColumnMeta, String>> mapping = new LinkedHashMap<>();
|
LinkedHashMap<String, Function<ColumnMeta, String>> mapping = new LinkedHashMap<>();
|
||||||
|
@ -39,18 +42,6 @@ public class RenderConfig {
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
});
|
});
|
||||||
// mapping.put("Not Null", column -> column.getIsNullable() ? "" : "YES");
|
|
||||||
// mapping.put("Auto Increment", column -> column.getIsAutoIncrement() ? "YES" : "");
|
|
||||||
// mapping.put("Default", column -> {
|
|
||||||
// if (column.getDefaultValue() == null) {
|
|
||||||
// return "";
|
|
||||||
// }
|
|
||||||
// if (column.getDefaultValue().trim().equals("")) {
|
|
||||||
// return "'" + column.getDefaultValue() + "'";
|
|
||||||
// }
|
|
||||||
// return column.getDefaultValue();
|
|
||||||
// });
|
|
||||||
// mapping.put("Comment", ColumnMeta::getComment);
|
|
||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue