refactor: rename pojo class name
This commit is contained in:
parent
a003316f56
commit
8948745321
|
@ -39,7 +39,7 @@ public class DocumentDescriptionController {
|
||||||
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
Integer userId = principal.getUserPojo().getId();
|
Integer userId = principal.getUser().getId();
|
||||||
documentDescriptionService.save(groupId, projectId, userId, request);
|
documentDescriptionService.save(groupId, projectId, userId, request);
|
||||||
return JsonData.ok();
|
return JsonData.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class DocumentDiscussionController {
|
||||||
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
Integer userId = principal.getUserPojo().getId();
|
Integer userId = principal.getUser().getId();
|
||||||
documentDiscussionService.create(groupId, projectId, userId, request);
|
documentDiscussionService.create(groupId, projectId, userId, request);
|
||||||
return JsonData.ok();
|
return JsonData.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class LoginController {
|
||||||
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
Integer userId = user.getUserPojo().getId();
|
Integer userId = user.getUser().getId();
|
||||||
return JsonData.ok(loginService.getUserLoginData(userId));
|
return JsonData.ok(loginService.getUserLoginData(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class ProjectController {
|
||||||
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
Integer userId = user.getUserPojo().getId();
|
Integer userId = user.getUser().getId();
|
||||||
return JsonData.ok(projectService.list(userId, page, condition));
|
return JsonData.ok(projectService.list(userId, page, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class UserProjectController {
|
||||||
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
Integer userId = user.getUserPojo().getId();
|
Integer userId = user.getUser().getId();
|
||||||
return JsonData.ok(userProjectService.listFavorites(pageable, userId, condition));
|
return JsonData.ok(userProjectService.listFavorites(pageable, userId, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class UserProjectController {
|
||||||
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
Integer userId = user.getUserPojo().getId();
|
Integer userId = user.getUser().getId();
|
||||||
userProjectService.addFavorites(projectId, userId);
|
userProjectService.addFavorites(projectId, userId);
|
||||||
return JsonData.ok();
|
return JsonData.ok();
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class UserProjectController {
|
||||||
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails user = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
Integer userId = user.getUserPojo().getId();
|
Integer userId = user.getUser().getId();
|
||||||
userProjectService.removeFavorites(projectId, userId);
|
userProjectService.removeFavorites(projectId, userId);
|
||||||
return JsonData.ok();
|
return JsonData.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.databasir.core.domain.log.annotation.AuditLog;
|
||||||
import com.databasir.core.domain.log.data.OperationLogRequest;
|
import com.databasir.core.domain.log.data.OperationLogRequest;
|
||||||
import com.databasir.core.domain.log.service.OperationLogService;
|
import com.databasir.core.domain.log.service.OperationLogService;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
import com.databasir.dao.tables.pojos.Project;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
@ -75,12 +75,12 @@ public class OperationLogAspect {
|
||||||
&& operation.retrieveInvolvedGroupId()
|
&& operation.retrieveInvolvedGroupId()
|
||||||
&& involvedProjectId != null) {
|
&& involvedProjectId != null) {
|
||||||
involvedGroupId = projectDao.selectOptionalById(involvedProjectId)
|
involvedGroupId = projectDao.selectOptionalById(involvedProjectId)
|
||||||
.map(ProjectPojo::getGroupId)
|
.map(Project::getGroupId)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
int userId = userId();
|
int userId = userId();
|
||||||
String username = principal.getUserPojo().getUsername();
|
String username = principal.getUser().getUsername();
|
||||||
String nickname = principal.getUserPojo().getNickname();
|
String nickname = principal.getUser().getNickname();
|
||||||
if (userId == AuditLog.Types.SYSTEM_USER_ID) {
|
if (userId == AuditLog.Types.SYSTEM_USER_ID) {
|
||||||
username = "system";
|
username = "system";
|
||||||
nickname = "system";
|
nickname = "system";
|
||||||
|
@ -105,7 +105,7 @@ public class OperationLogAspect {
|
||||||
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
return principal.getUserPojo().getId();
|
return principal.getUser().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> Optional<T> getValueBySPEL(Method method,
|
private <T> Optional<T> getValueBySPEL(Method method,
|
||||||
|
|
|
@ -9,6 +9,6 @@ public class LoginUserContext {
|
||||||
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
return principal.getUserPojo().getId();
|
return principal.getUser().getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,16 +36,16 @@ public class OAuth2AuthenticationSuccessHandler implements AuthenticationSuccess
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
Authentication authentication) throws IOException, ServletException {
|
Authentication authentication) throws IOException, ServletException {
|
||||||
DatabasirUserDetails details = (DatabasirUserDetails) authentication.getPrincipal();
|
DatabasirUserDetails details = (DatabasirUserDetails) authentication.getPrincipal();
|
||||||
loginService.generate(details.getUserPojo().getId());
|
loginService.generate(details.getUser().getId());
|
||||||
UserLoginResponse data = loginService.getUserLoginData(details.getUserPojo().getId())
|
UserLoginResponse data = loginService.getUserLoginData(details.getUser().getId())
|
||||||
.orElseThrow(() -> {
|
.orElseThrow(() -> {
|
||||||
operationLogService.saveLoginLog(details.getUserPojo(), false, null);
|
operationLogService.saveLoginLog(details.getUser(), false, null);
|
||||||
return new CredentialsExpiredException("请重新登陆");
|
return new CredentialsExpiredException("请重新登陆");
|
||||||
});
|
});
|
||||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||||
objectMapper.writeValue(response.getWriter(), JsonData.ok(data));
|
objectMapper.writeValue(response.getWriter(), JsonData.ok(data));
|
||||||
operationLogService.saveLoginLog(details.getUserPojo(), true, null);
|
operationLogService.saveLoginLog(details.getUser(), true, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,13 @@ public class DatabasirAuthenticationSuccessHandler implements AuthenticationSucc
|
||||||
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
|
||||||
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
|
||||||
|
|
||||||
loginService.generate(user.getUserPojo().getId());
|
loginService.generate(user.getUser().getId());
|
||||||
UserLoginResponse data = loginService.getUserLoginData(user.getUserPojo().getId())
|
UserLoginResponse data = loginService.getUserLoginData(user.getUser().getId())
|
||||||
.orElseThrow(() -> {
|
.orElseThrow(() -> {
|
||||||
operationLogService.saveLoginLog(user.getUserPojo(), false, null);
|
operationLogService.saveLoginLog(user.getUser(), false, null);
|
||||||
return new CredentialsExpiredException("请重新登陆");
|
return new CredentialsExpiredException("请重新登陆");
|
||||||
});
|
});
|
||||||
operationLogService.saveLoginLog(user.getUserPojo(), true, null);
|
operationLogService.saveLoginLog(user.getUser(), true, null);
|
||||||
objectMapper.writeValue(response.getWriter(), JsonData.ok(data));
|
objectMapper.writeValue(response.getWriter(), JsonData.ok(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.databasir.api.config.security;
|
||||||
import com.databasir.core.domain.log.service.OperationLogService;
|
import com.databasir.core.domain.log.service.OperationLogService;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.impl.UserRoleDao;
|
import com.databasir.dao.impl.UserRoleDao;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
@ -28,12 +28,12 @@ public class DatabasirUserDetailService implements UserDetailsService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
UserPojo user = userDao.selectByEmailOrUsername(username)
|
User user = userDao.selectByEmailOrUsername(username)
|
||||||
.orElseThrow(() -> {
|
.orElseThrow(() -> {
|
||||||
operationLogService.saveLoginFailedLog(username, "用户名不存在");
|
operationLogService.saveLoginFailedLog(username, "用户名不存在");
|
||||||
return new UsernameNotFoundException("用户名或密码错误");
|
return new UsernameNotFoundException("用户名或密码错误");
|
||||||
});
|
});
|
||||||
List<UserRolePojo> roles = userRoleDao.selectByUserIds(Collections.singletonList(user.getId()));
|
List<UserRole> roles = userRoleDao.selectByUserIds(Collections.singletonList(user.getId()));
|
||||||
return new DatabasirUserDetails(user, roles);
|
return new DatabasirUserDetails(user, roles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.api.config.security;
|
package com.databasir.api.config.security;
|
||||||
|
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
@ -16,10 +16,10 @@ import java.util.stream.Collectors;
|
||||||
public class DatabasirUserDetails implements UserDetails {
|
public class DatabasirUserDetails implements UserDetails {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final UserPojo userPojo;
|
private final User user;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final List<UserRolePojo> roles;
|
private final List<UserRole> roles;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||||
|
@ -36,12 +36,12 @@ public class DatabasirUserDetails implements UserDetails {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return userPojo.getPassword();
|
return user.getPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return userPojo.getEmail();
|
return user.getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,6 +61,6 @@ public class DatabasirUserDetails implements UserDetails {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return userPojo.getEnabled();
|
return user.getEnabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class UserOperationValidator {
|
||||||
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
if (principal.getUserPojo().getId().equals(userId)) {
|
if (principal.getUser().getId().equals(userId)) {
|
||||||
throw DomainErrors.CANNOT_UPDATE_SELF_ROLE.exception();
|
throw DomainErrors.CANNOT_UPDATE_SELF_ROLE.exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class UserOperationValidator {
|
||||||
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
DatabasirUserDetails principal = (DatabasirUserDetails) SecurityContextHolder.getContext()
|
||||||
.getAuthentication()
|
.getAuthentication()
|
||||||
.getPrincipal();
|
.getPrincipal();
|
||||||
return principal.getUserPojo().getId().equals(userId);
|
return principal.getUser().getId().equals(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.databasir.job;
|
||||||
|
|
||||||
import com.databasir.core.domain.document.service.DocumentService;
|
import com.databasir.core.domain.document.service.DocumentService;
|
||||||
import com.databasir.dao.impl.ProjectSyncRuleDao;
|
import com.databasir.dao.impl.ProjectSyncRuleDao;
|
||||||
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo;
|
import com.databasir.dao.tables.pojos.ProjectSyncRule;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.quartz.*;
|
import org.quartz.*;
|
||||||
|
@ -135,7 +135,7 @@ public class ProjectSyncJobScheduler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Pair<JobDetail, Trigger> jobAndTriggers(ProjectSyncRulePojo rule) {
|
private Pair<JobDetail, Trigger> jobAndTriggers(ProjectSyncRule rule) {
|
||||||
JobDataMap dataMap = new JobDataMap();
|
JobDataMap dataMap = new JobDataMap();
|
||||||
Integer projectId = rule.getProjectId();
|
Integer projectId = rule.getProjectId();
|
||||||
Integer ruleId = rule.getId();
|
Integer ruleId = rule.getId();
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.databasir.dao.enums.ProjectSyncTaskStatus;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.impl.ProjectSyncTaskDao;
|
import com.databasir.dao.impl.ProjectSyncTaskDao;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.tables.pojos.ProjectSyncTaskPojo;
|
import com.databasir.dao.tables.pojos.ProjectSyncTask;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
@ -44,9 +44,9 @@ public class ProjectSyncTaskScheduler {
|
||||||
@Scheduled(fixedRate = 5000L)
|
@Scheduled(fixedRate = 5000L)
|
||||||
public void startSyncTask() {
|
public void startSyncTask() {
|
||||||
final int size = 10;
|
final int size = 10;
|
||||||
List<ProjectSyncTaskPojo> tasks = projectSyncTaskDao.listNewTasks(size);
|
List<ProjectSyncTask> tasks = projectSyncTaskDao.listNewTasks(size);
|
||||||
List<Integer> projectIds = tasks.stream()
|
List<Integer> projectIds = tasks.stream()
|
||||||
.map(ProjectSyncTaskPojo::getProjectId)
|
.map(ProjectSyncTask::getProjectId)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
Map<Integer, Integer> groupIdAndProjectIdMap = projectDao.selectGroupIdsByProjectIdIn(projectIds);
|
Map<Integer, Integer> groupIdAndProjectIdMap = projectDao.selectGroupIdsByProjectIdIn(projectIds);
|
||||||
|
@ -88,7 +88,7 @@ public class ProjectSyncTaskScheduler {
|
||||||
operatorUsername = "system";
|
operatorUsername = "system";
|
||||||
operationName = "定时同步";
|
operationName = "定时同步";
|
||||||
} else {
|
} else {
|
||||||
UserPojo user = userDao.selectById(userId);
|
User user = userDao.selectById(userId);
|
||||||
operatorNickName = user.getNickname();
|
operatorNickName = user.getNickname();
|
||||||
operatorUsername = user.getUsername();
|
operatorUsername = user.getUsername();
|
||||||
operationName = "手动同步";
|
operationName = "手动同步";
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.domain.app;
|
package com.databasir.core.domain.app;
|
||||||
|
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.app.converter.OAuthAppPojoConverter;
|
import com.databasir.core.domain.app.converter.OauthAppConverter;
|
||||||
import com.databasir.core.domain.app.converter.OAuthAppResponseConverter;
|
import com.databasir.core.domain.app.converter.OAuthAppResponseConverter;
|
||||||
import com.databasir.core.domain.app.data.*;
|
import com.databasir.core.domain.app.data.*;
|
||||||
import com.databasir.core.domain.app.handler.OAuthProcessResult;
|
import com.databasir.core.domain.app.handler.OAuthProcessResult;
|
||||||
|
@ -10,7 +10,7 @@ import com.databasir.core.domain.user.data.UserCreateRequest;
|
||||||
import com.databasir.core.domain.user.data.UserDetailResponse;
|
import com.databasir.core.domain.user.data.UserDetailResponse;
|
||||||
import com.databasir.core.domain.user.service.UserService;
|
import com.databasir.core.domain.user.service.UserService;
|
||||||
import com.databasir.dao.impl.OauthAppDao;
|
import com.databasir.dao.impl.OauthAppDao;
|
||||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
import com.databasir.dao.tables.pojos.OauthApp;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.dao.DuplicateKeyException;
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
@ -35,7 +35,7 @@ public class OpenAuthAppService {
|
||||||
|
|
||||||
private final OAuthAppResponseConverter oauthAppResponseConverter;
|
private final OAuthAppResponseConverter oauthAppResponseConverter;
|
||||||
|
|
||||||
private final OAuthAppPojoConverter oauthAppPojoConverter;
|
private final OauthAppConverter oauthAppConverter;
|
||||||
|
|
||||||
public UserDetailResponse oauthCallback(String registrationId, Map<String, String[]> params) {
|
public UserDetailResponse oauthCallback(String registrationId, Map<String, String[]> params) {
|
||||||
// process by handler
|
// process by handler
|
||||||
|
@ -57,7 +57,7 @@ public class OpenAuthAppService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OAuthAppResponse> listAll() {
|
public List<OAuthAppResponse> listAll() {
|
||||||
List<OauthAppPojo> apps = oauthAppDao.selectAll();
|
List<OauthApp> apps = oauthAppDao.selectAll();
|
||||||
return apps.stream()
|
return apps.stream()
|
||||||
.map(oauthAppResponseConverter::to)
|
.map(oauthAppResponseConverter::to)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -70,7 +70,7 @@ public class OpenAuthAppService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateById(OAuthAppUpdateRequest request) {
|
public void updateById(OAuthAppUpdateRequest request) {
|
||||||
OauthAppPojo pojo = oauthAppPojoConverter.of(request);
|
OauthApp pojo = oauthAppConverter.of(request);
|
||||||
try {
|
try {
|
||||||
oauthAppDao.updateById(pojo);
|
oauthAppDao.updateById(pojo);
|
||||||
} catch (DuplicateKeyException e) {
|
} catch (DuplicateKeyException e) {
|
||||||
|
@ -79,7 +79,7 @@ public class OpenAuthAppService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer create(OAuthAppCreateRequest request) {
|
public Integer create(OAuthAppCreateRequest request) {
|
||||||
OauthAppPojo pojo = oauthAppPojoConverter.of(request);
|
OauthApp pojo = oauthAppConverter.of(request);
|
||||||
try {
|
try {
|
||||||
return oauthAppDao.insertAndReturnId(pojo);
|
return oauthAppDao.insertAndReturnId(pojo);
|
||||||
} catch (DuplicateKeyException e) {
|
} catch (DuplicateKeyException e) {
|
||||||
|
@ -88,10 +88,10 @@ public class OpenAuthAppService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<OAuthAppPageResponse> listPage(Pageable page, OAuthAppPageCondition condition) {
|
public Page<OAuthAppPageResponse> listPage(Pageable page, OAuthAppPageCondition condition) {
|
||||||
return oauthAppDao.selectByPage(page, condition.toCondition()).map(oauthAppPojoConverter::toPageResponse);
|
return oauthAppDao.selectByPage(page, condition.toCondition()).map(oauthAppConverter::toPageResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<OAuthAppDetailResponse> getOne(Integer id) {
|
public Optional<OAuthAppDetailResponse> getOne(Integer id) {
|
||||||
return oauthAppDao.selectOptionalById(id).map(oauthAppPojoConverter::toDetailResponse);
|
return oauthAppDao.selectOptionalById(id).map(oauthAppConverter::toDetailResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.databasir.core.domain.app.converter;
|
package com.databasir.core.domain.app.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.app.data.OAuthAppResponse;
|
import com.databasir.core.domain.app.data.OAuthAppResponse;
|
||||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
import com.databasir.dao.tables.pojos.OauthApp;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface OAuthAppResponseConverter {
|
public interface OAuthAppResponseConverter {
|
||||||
|
|
||||||
OAuthAppResponse to(OauthAppPojo pojo);
|
OAuthAppResponse to(OauthApp pojo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,23 +4,23 @@ import com.databasir.core.domain.app.data.OAuthAppCreateRequest;
|
||||||
import com.databasir.core.domain.app.data.OAuthAppDetailResponse;
|
import com.databasir.core.domain.app.data.OAuthAppDetailResponse;
|
||||||
import com.databasir.core.domain.app.data.OAuthAppPageResponse;
|
import com.databasir.core.domain.app.data.OAuthAppPageResponse;
|
||||||
import com.databasir.core.domain.app.data.OAuthAppUpdateRequest;
|
import com.databasir.core.domain.app.data.OAuthAppUpdateRequest;
|
||||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
import com.databasir.dao.tables.pojos.OauthApp;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface OAuthAppPojoConverter {
|
public interface OauthAppConverter {
|
||||||
|
|
||||||
@Mapping(target = "id", ignore = true)
|
@Mapping(target = "id", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
@Mapping(target = "updateAt", ignore = true)
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
OauthAppPojo of(OAuthAppCreateRequest request);
|
OauthApp of(OAuthAppCreateRequest request);
|
||||||
|
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
@Mapping(target = "updateAt", ignore = true)
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
OauthAppPojo of(OAuthAppUpdateRequest request);
|
OauthApp of(OAuthAppUpdateRequest request);
|
||||||
|
|
||||||
OAuthAppPageResponse toPageResponse(OauthAppPojo pojo);
|
OAuthAppPageResponse toPageResponse(OauthApp pojo);
|
||||||
|
|
||||||
OAuthAppDetailResponse toDetailResponse(OauthAppPojo pojo);
|
OAuthAppDetailResponse toDetailResponse(OauthApp pojo);
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.app.exception.DatabasirAuthenticationException;
|
import com.databasir.core.domain.app.exception.DatabasirAuthenticationException;
|
||||||
import com.databasir.core.infrastructure.remote.github.GithubRemoteService;
|
import com.databasir.core.infrastructure.remote.github.GithubRemoteService;
|
||||||
import com.databasir.dao.enums.OAuthAppType;
|
import com.databasir.dao.enums.OAuthAppType;
|
||||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
import com.databasir.dao.tables.pojos.OauthApp;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.jooq.tools.StringUtils;
|
import org.jooq.tools.StringUtils;
|
||||||
|
@ -26,7 +26,7 @@ public class GithubOpenAuthHandler implements OpenAuthHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String authorizationUrl(OauthAppPojo app, Map<String, String[]> requestParams) {
|
public String authorizationUrl(OauthApp app, Map<String, String[]> requestParams) {
|
||||||
String authUrl = app.getAuthUrl();
|
String authUrl = app.getAuthUrl();
|
||||||
String clientId = app.getClientId();
|
String clientId = app.getClientId();
|
||||||
String authorizeUrl = authUrl + "/login/oauth/authorize";
|
String authorizeUrl = authUrl + "/login/oauth/authorize";
|
||||||
|
@ -40,7 +40,7 @@ public class GithubOpenAuthHandler implements OpenAuthHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OAuthProcessResult process(OauthAppPojo app, Map<String, String[]> requestParams) {
|
public OAuthProcessResult process(OauthApp app, Map<String, String[]> requestParams) {
|
||||||
String clientId = app.getClientId();
|
String clientId = app.getClientId();
|
||||||
String clientSecret = app.getClientSecret();
|
String clientSecret = app.getClientSecret();
|
||||||
String authUrl = app.getAuthUrl();
|
String authUrl = app.getAuthUrl();
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.app.exception.DatabasirAuthenticationException;
|
import com.databasir.core.domain.app.exception.DatabasirAuthenticationException;
|
||||||
import com.databasir.core.infrastructure.remote.gitlab.GitlabRemoteService;
|
import com.databasir.core.infrastructure.remote.gitlab.GitlabRemoteService;
|
||||||
import com.databasir.dao.enums.OAuthAppType;
|
import com.databasir.dao.enums.OAuthAppType;
|
||||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
import com.databasir.dao.tables.pojos.OauthApp;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -24,7 +24,7 @@ public class GitlabOpenAuthHandler implements OpenAuthHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String authorizationUrl(OauthAppPojo app, Map<String, String[]> params) {
|
public String authorizationUrl(OauthApp app, Map<String, String[]> params) {
|
||||||
if (!params.containsKey("redirect_uri")) {
|
if (!params.containsKey("redirect_uri")) {
|
||||||
throw DomainErrors.MISS_REQUIRED_PARAMETERS.exception("缺少参数 redirect_uri", null);
|
throw DomainErrors.MISS_REQUIRED_PARAMETERS.exception("缺少参数 redirect_uri", null);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class GitlabOpenAuthHandler implements OpenAuthHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OAuthProcessResult process(OauthAppPojo app, Map<String, String[]> requestParams) {
|
public OAuthProcessResult process(OauthApp app, Map<String, String[]> requestParams) {
|
||||||
if (!requestParams.containsKey("redirect_uri")) {
|
if (!requestParams.containsKey("redirect_uri")) {
|
||||||
throw DomainErrors.MISS_REQUIRED_PARAMETERS.exception("缺少参数 redirect_uri", null);
|
throw DomainErrors.MISS_REQUIRED_PARAMETERS.exception("缺少参数 redirect_uri", null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.databasir.core.domain.app.handler;
|
package com.databasir.core.domain.app.handler;
|
||||||
|
|
||||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
import com.databasir.dao.tables.pojos.OauthApp;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -17,7 +17,7 @@ public class OAuthProcessContext {
|
||||||
|
|
||||||
private String registrationId;
|
private String registrationId;
|
||||||
|
|
||||||
private OauthAppPojo app;
|
private OauthApp app;
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private Map<String, String[]> parameters = new HashMap<>();
|
private Map<String, String[]> parameters = new HashMap<>();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.domain.app.handler;
|
package com.databasir.core.domain.app.handler;
|
||||||
|
|
||||||
import com.databasir.dao.enums.OAuthAppType;
|
import com.databasir.dao.enums.OAuthAppType;
|
||||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
import com.databasir.dao.tables.pojos.OauthApp;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public interface OpenAuthHandler {
|
||||||
|
|
||||||
boolean support(OAuthAppType oauthAppType);
|
boolean support(OAuthAppType oauthAppType);
|
||||||
|
|
||||||
String authorizationUrl(OauthAppPojo app, Map<String, String[]> requestParams);
|
String authorizationUrl(OauthApp app, Map<String, String[]> requestParams);
|
||||||
|
|
||||||
OAuthProcessResult process(OauthAppPojo app, Map<String, String[]> requestParams);
|
OAuthProcessResult process(OauthApp app, Map<String, String[]> requestParams);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.databasir.core.domain.app.handler;
|
||||||
|
|
||||||
import com.databasir.core.domain.app.exception.DatabasirAuthenticationException;
|
import com.databasir.core.domain.app.exception.DatabasirAuthenticationException;
|
||||||
import com.databasir.dao.impl.OauthAppDao;
|
import com.databasir.dao.impl.OauthAppDao;
|
||||||
import com.databasir.dao.tables.pojos.OauthAppPojo;
|
import com.databasir.dao.tables.pojos.OauthApp;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class OpenAuthHandlers {
|
||||||
private final OauthAppDao oauthAppDao;
|
private final OauthAppDao oauthAppDao;
|
||||||
|
|
||||||
public String authorizeUrl(String registrationId, Map<String, String[]> parameters) {
|
public String authorizeUrl(String registrationId, Map<String, String[]> parameters) {
|
||||||
OauthAppPojo app = oauthAppDao.selectByRegistrationId(registrationId);
|
OauthApp app = oauthAppDao.selectByRegistrationId(registrationId);
|
||||||
return handlers.stream()
|
return handlers.stream()
|
||||||
.filter(handler -> handler.support(app.getAppType()))
|
.filter(handler -> handler.support(app.getAppType()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
|
@ -29,7 +29,7 @@ public class OpenAuthHandlers {
|
||||||
}
|
}
|
||||||
|
|
||||||
public OAuthProcessResult process(String registrationId, Map<String, String[]> parameters) {
|
public OAuthProcessResult process(String registrationId, Map<String, String[]> parameters) {
|
||||||
OauthAppPojo app = oauthAppDao.selectOptionByRegistrationId(registrationId)
|
OauthApp app = oauthAppDao.selectOptionByRegistrationId(registrationId)
|
||||||
.orElseThrow(() -> {
|
.orElseThrow(() -> {
|
||||||
var bizErr = REGISTRATION_ID_NOT_FOUND.exception("应用 ID [" + registrationId + "] 不存在");
|
var bizErr = REGISTRATION_ID_NOT_FOUND.exception("应用 ID [" + registrationId + "] 不存在");
|
||||||
return new DatabasirAuthenticationException(bizErr);
|
return new DatabasirAuthenticationException(bizErr);
|
||||||
|
|
|
@ -4,25 +4,25 @@ import com.databasir.core.domain.database.data.DatabaseTypeCreateRequest;
|
||||||
import com.databasir.core.domain.database.data.DatabaseTypeDetailResponse;
|
import com.databasir.core.domain.database.data.DatabaseTypeDetailResponse;
|
||||||
import com.databasir.core.domain.database.data.DatabaseTypePageResponse;
|
import com.databasir.core.domain.database.data.DatabaseTypePageResponse;
|
||||||
import com.databasir.core.domain.database.data.DatabaseTypeUpdateRequest;
|
import com.databasir.core.domain.database.data.DatabaseTypeUpdateRequest;
|
||||||
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
|
import com.databasir.dao.tables.pojos.DatabaseType;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface DatabaseTypePojoConverter {
|
public interface DatabaseTypeConverter {
|
||||||
|
|
||||||
@Mapping(target = "id", ignore = true)
|
@Mapping(target = "id", ignore = true)
|
||||||
@Mapping(target = "updateAt", ignore = true)
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
@Mapping(target = "jdbcDriverFilePath", source = "jdbcDriverFilePath")
|
@Mapping(target = "jdbcDriverFilePath", source = "jdbcDriverFilePath")
|
||||||
DatabaseTypePojo of(DatabaseTypeCreateRequest request, String jdbcDriverFilePath);
|
DatabaseType of(DatabaseTypeCreateRequest request, String jdbcDriverFilePath);
|
||||||
|
|
||||||
@Mapping(target = "jdbcDriverFilePath", source = "jdbcDriverFilePath")
|
@Mapping(target = "jdbcDriverFilePath", source = "jdbcDriverFilePath")
|
||||||
DatabaseTypePojo of(DatabaseTypeUpdateRequest request, String jdbcDriverFilePath);
|
DatabaseType of(DatabaseTypeUpdateRequest request, String jdbcDriverFilePath);
|
||||||
|
|
||||||
DatabaseTypePojo of(DatabaseTypeUpdateRequest request);
|
DatabaseType of(DatabaseTypeUpdateRequest request);
|
||||||
|
|
||||||
DatabaseTypeDetailResponse toDetailResponse(DatabaseTypePojo data);
|
DatabaseTypeDetailResponse toDetailResponse(DatabaseType data);
|
||||||
|
|
||||||
DatabaseTypePageResponse toPageResponse(DatabaseTypePojo pojo, Integer projectCount);
|
DatabaseTypePageResponse toPageResponse(DatabaseType pojo, Integer projectCount);
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.domain.database.service;
|
package com.databasir.core.domain.database.service;
|
||||||
|
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.database.converter.DatabaseTypePojoConverter;
|
import com.databasir.core.domain.database.converter.DatabaseTypeConverter;
|
||||||
import com.databasir.core.domain.database.data.*;
|
import com.databasir.core.domain.database.data.*;
|
||||||
import com.databasir.core.domain.database.validator.DatabaseTypeUpdateValidator;
|
import com.databasir.core.domain.database.validator.DatabaseTypeUpdateValidator;
|
||||||
import com.databasir.core.infrastructure.connection.DatabaseTypes;
|
import com.databasir.core.infrastructure.connection.DatabaseTypes;
|
||||||
|
@ -9,7 +9,7 @@ import com.databasir.core.infrastructure.driver.DriverResources;
|
||||||
import com.databasir.core.infrastructure.driver.DriverResult;
|
import com.databasir.core.infrastructure.driver.DriverResult;
|
||||||
import com.databasir.dao.impl.DatabaseTypeDao;
|
import com.databasir.dao.impl.DatabaseTypeDao;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
|
import com.databasir.dao.tables.pojos.DatabaseType;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -40,7 +40,7 @@ public class DatabaseTypeService {
|
||||||
|
|
||||||
private final ProjectDao projectDao;
|
private final ProjectDao projectDao;
|
||||||
|
|
||||||
private final DatabaseTypePojoConverter databaseTypePojoConverter;
|
private final DatabaseTypeConverter databaseTypeConverter;
|
||||||
|
|
||||||
private final DatabaseTypeUpdateValidator databaseTypeUpdateValidator;
|
private final DatabaseTypeUpdateValidator databaseTypeUpdateValidator;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class DatabaseTypeService {
|
||||||
DriverResult result = loadAndValidate(request.getJdbcDriverFileUrl(),
|
DriverResult result = loadAndValidate(request.getJdbcDriverFileUrl(),
|
||||||
request.getJdbcDriverFilePath(), request.getJdbcDriverClassName());
|
request.getJdbcDriverFilePath(), request.getJdbcDriverClassName());
|
||||||
String targetPath = driverResources.copyToStandardDirectory(result.getDriverFile(), databaseType);
|
String targetPath = driverResources.copyToStandardDirectory(result.getDriverFile(), databaseType);
|
||||||
DatabaseTypePojo pojo = databaseTypePojoConverter.of(request, targetPath);
|
DatabaseType pojo = databaseTypeConverter.of(request, targetPath);
|
||||||
// TODO workaround
|
// TODO workaround
|
||||||
pojo.setJdbcDriverFileUrl(StringUtils.defaultIfBlank(request.getJdbcDriverFileUrl(), ""));
|
pojo.setJdbcDriverFileUrl(StringUtils.defaultIfBlank(request.getJdbcDriverFileUrl(), ""));
|
||||||
try {
|
try {
|
||||||
|
@ -77,7 +77,7 @@ public class DatabaseTypeService {
|
||||||
databaseTypeDao.selectOptionalById(request.getId()).ifPresent(data -> {
|
databaseTypeDao.selectOptionalById(request.getId()).ifPresent(data -> {
|
||||||
databaseTypeUpdateValidator.validDatabaseTypeIfNecessary(request, data);
|
databaseTypeUpdateValidator.validDatabaseTypeIfNecessary(request, data);
|
||||||
String databaseType = request.getDatabaseType();
|
String databaseType = request.getDatabaseType();
|
||||||
DatabaseTypePojo pojo;
|
DatabaseType pojo;
|
||||||
if (databaseTypeUpdateValidator.shouldReloadDriver(request, data)) {
|
if (databaseTypeUpdateValidator.shouldReloadDriver(request, data)) {
|
||||||
// 名称修改,下载地址修改需要删除原有的 driver 并重新下载验证
|
// 名称修改,下载地址修改需要删除原有的 driver 并重新下载验证
|
||||||
driverResources.deleteByDatabaseType(data.getDatabaseType());
|
driverResources.deleteByDatabaseType(data.getDatabaseType());
|
||||||
|
@ -85,10 +85,10 @@ public class DatabaseTypeService {
|
||||||
DriverResult result = loadAndValidate(request.getJdbcDriverFileUrl(),
|
DriverResult result = loadAndValidate(request.getJdbcDriverFileUrl(),
|
||||||
request.getJdbcDriverFilePath(), request.getJdbcDriverClassName());
|
request.getJdbcDriverFilePath(), request.getJdbcDriverClassName());
|
||||||
String targetPath = driverResources.copyToStandardDirectory(result.getDriverFile(), databaseType);
|
String targetPath = driverResources.copyToStandardDirectory(result.getDriverFile(), databaseType);
|
||||||
pojo = databaseTypePojoConverter.of(request, targetPath);
|
pojo = databaseTypeConverter.of(request, targetPath);
|
||||||
pojo.setJdbcDriverFileUrl(StringUtils.defaultIfBlank(request.getJdbcDriverFileUrl(), ""));
|
pojo.setJdbcDriverFileUrl(StringUtils.defaultIfBlank(request.getJdbcDriverFileUrl(), ""));
|
||||||
} else {
|
} else {
|
||||||
pojo = databaseTypePojoConverter.of(request);
|
pojo = databaseTypeConverter.of(request);
|
||||||
pojo.setJdbcDriverFileUrl(StringUtils.defaultIfBlank(request.getJdbcDriverFileUrl(), ""));
|
pojo.setJdbcDriverFileUrl(StringUtils.defaultIfBlank(request.getJdbcDriverFileUrl(), ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,13 +123,13 @@ public class DatabaseTypeService {
|
||||||
|
|
||||||
public Page<DatabaseTypePageResponse> findByPage(Pageable page,
|
public Page<DatabaseTypePageResponse> findByPage(Pageable page,
|
||||||
DatabaseTypePageCondition condition) {
|
DatabaseTypePageCondition condition) {
|
||||||
Page<DatabaseTypePojo> pageData = databaseTypeDao.selectByPage(page, condition.toCondition());
|
Page<DatabaseType> pageData = databaseTypeDao.selectByPage(page, condition.toCondition());
|
||||||
List<String> databaseTypes = pageData.map(DatabaseTypePojo::getDatabaseType).toList();
|
List<String> databaseTypes = pageData.map(DatabaseType::getDatabaseType).toList();
|
||||||
Map<String, Integer> projectCountMapByDatabaseType = projectDao.countByDatabaseTypes(databaseTypes);
|
Map<String, Integer> projectCountMapByDatabaseType = projectDao.countByDatabaseTypes(databaseTypes);
|
||||||
return pageData
|
return pageData
|
||||||
.map(data -> {
|
.map(data -> {
|
||||||
Integer count = projectCountMapByDatabaseType.getOrDefault(data.getDatabaseType(), 0);
|
Integer count = projectCountMapByDatabaseType.getOrDefault(data.getDatabaseType(), 0);
|
||||||
return databaseTypePojoConverter.toPageResponse(data, count);
|
return databaseTypeConverter.toPageResponse(data, count);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class DatabaseTypeService {
|
||||||
|
|
||||||
public Optional<DatabaseTypeDetailResponse> selectOne(Integer id) {
|
public Optional<DatabaseTypeDetailResponse> selectOne(Integer id) {
|
||||||
return databaseTypeDao.selectOptionalById(id)
|
return databaseTypeDao.selectOptionalById(id)
|
||||||
.map(databaseTypePojoConverter::toDetailResponse);
|
.map(databaseTypeConverter::toDetailResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String resolveDriverClassName(DriverClassNameResolveRequest request) {
|
public String resolveDriverClassName(DriverClassNameResolveRequest request) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.databasir.core.domain.database.data.DatabaseTypeCreateRequest;
|
||||||
import com.databasir.core.domain.database.data.DatabaseTypeUpdateRequest;
|
import com.databasir.core.domain.database.data.DatabaseTypeUpdateRequest;
|
||||||
import com.databasir.core.domain.database.data.DriverClassNameResolveRequest;
|
import com.databasir.core.domain.database.data.DriverClassNameResolveRequest;
|
||||||
import com.databasir.dao.impl.DatabaseTypeDao;
|
import com.databasir.dao.impl.DatabaseTypeDao;
|
||||||
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
|
import com.databasir.dao.tables.pojos.DatabaseType;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -36,7 +36,7 @@ public class DatabaseTypeUpdateValidator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validDatabaseTypeIfNecessary(DatabaseTypeUpdateRequest request, DatabaseTypePojo origin) {
|
public void validDatabaseTypeIfNecessary(DatabaseTypeUpdateRequest request, DatabaseType origin) {
|
||||||
if (!Objects.equals(request.getDatabaseType(), origin.getDatabaseType())) {
|
if (!Objects.equals(request.getDatabaseType(), origin.getDatabaseType())) {
|
||||||
if (databaseTypeDao.existsByDatabaseType(request.getDatabaseType())) {
|
if (databaseTypeDao.existsByDatabaseType(request.getDatabaseType())) {
|
||||||
throw DomainErrors.DATABASE_TYPE_NAME_DUPLICATE.exception();
|
throw DomainErrors.DATABASE_TYPE_NAME_DUPLICATE.exception();
|
||||||
|
@ -44,7 +44,7 @@ public class DatabaseTypeUpdateValidator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldReloadDriver(DatabaseTypeUpdateRequest request, DatabaseTypePojo origin) {
|
public boolean shouldReloadDriver(DatabaseTypeUpdateRequest request, DatabaseType origin) {
|
||||||
if (!Objects.equals(request.getDatabaseType(), origin.getDatabaseType())) {
|
if (!Objects.equals(request.getDatabaseType(), origin.getDatabaseType())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package com.databasir.core.domain.description.converter;
|
package com.databasir.core.domain.description.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest;
|
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest;
|
||||||
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo;
|
import com.databasir.dao.tables.pojos.DocumentDescription;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface DocumentDescriptionPojoConverter {
|
public interface DocumentDescriptionConverter {
|
||||||
|
|
||||||
@Mapping(target = "id", ignore = true)
|
@Mapping(target = "id", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
@Mapping(target = "updateAt", ignore = true)
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
DocumentDescriptionPojo of(Integer projectId,
|
DocumentDescription of(Integer projectId,
|
||||||
Integer updateBy,
|
Integer updateBy,
|
||||||
DocumentDescriptionSaveRequest request);
|
DocumentDescriptionSaveRequest request);
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package com.databasir.core.domain.description.service;
|
package com.databasir.core.domain.description.service;
|
||||||
|
|
||||||
import com.databasir.core.domain.description.converter.DocumentDescriptionPojoConverter;
|
import com.databasir.core.domain.description.converter.DocumentDescriptionConverter;
|
||||||
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest;
|
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest;
|
||||||
import com.databasir.core.domain.description.event.DescriptionUpdated;
|
import com.databasir.core.domain.description.event.DescriptionUpdated;
|
||||||
import com.databasir.core.infrastructure.event.EventPublisher;
|
import com.databasir.core.infrastructure.event.EventPublisher;
|
||||||
import com.databasir.dao.impl.DocumentDescriptionDao;
|
import com.databasir.dao.impl.DocumentDescriptionDao;
|
||||||
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo;
|
import com.databasir.dao.tables.pojos.DocumentDescription;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -16,7 +16,7 @@ public class DocumentDescriptionService {
|
||||||
|
|
||||||
private final DocumentDescriptionDao documentDescriptionDao;
|
private final DocumentDescriptionDao documentDescriptionDao;
|
||||||
|
|
||||||
private final DocumentDescriptionPojoConverter documentDescriptionPojoConverter;
|
private final DocumentDescriptionConverter documentDescriptionConverter;
|
||||||
|
|
||||||
private final EventPublisher eventPublisher;
|
private final EventPublisher eventPublisher;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class DocumentDescriptionService {
|
||||||
Integer userId,
|
Integer userId,
|
||||||
DocumentDescriptionSaveRequest request) {
|
DocumentDescriptionSaveRequest request) {
|
||||||
|
|
||||||
DocumentDescriptionPojo pojo = documentDescriptionPojoConverter.of(projectId, userId, request);
|
DocumentDescription pojo = documentDescriptionConverter.of(projectId, userId, request);
|
||||||
if (!documentDescriptionDao.exists(projectId, request.getTableName(), request.getColumnName())) {
|
if (!documentDescriptionDao.exists(projectId, request.getTableName(), request.getColumnName())) {
|
||||||
documentDescriptionDao.insertAndReturnId(pojo);
|
documentDescriptionDao.insertAndReturnId(pojo);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.databasir.core.domain.discussion.converter;
|
package com.databasir.core.domain.discussion.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.discussion.data.DiscussionResponse;
|
import com.databasir.core.domain.discussion.data.DiscussionResponse;
|
||||||
import com.databasir.dao.tables.pojos.DocumentDiscussionPojo;
|
import com.databasir.dao.tables.pojos.DocumentDiscussion;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
@ -12,6 +12,6 @@ public interface DiscussionResponseConverter {
|
||||||
@Mapping(target = "id", source = "discussion.id")
|
@Mapping(target = "id", source = "discussion.id")
|
||||||
@Mapping(target = "createAt", source = "discussion.createAt")
|
@Mapping(target = "createAt", source = "discussion.createAt")
|
||||||
@Mapping(target = "content", source = "discussion.content")
|
@Mapping(target = "content", source = "discussion.content")
|
||||||
DiscussionResponse of(DocumentDiscussionPojo discussion,
|
DiscussionResponse of(DocumentDiscussion discussion,
|
||||||
UserPojo discussBy);
|
User discussBy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.domain.discussion.event.converter;
|
package com.databasir.core.domain.discussion.event.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.discussion.event.DiscussionCreated;
|
import com.databasir.core.domain.discussion.event.DiscussionCreated;
|
||||||
import com.databasir.dao.tables.pojos.DocumentDiscussionPojo;
|
import com.databasir.dao.tables.pojos.DocumentDiscussion;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
@ -9,6 +9,6 @@ import org.mapstruct.Mapping;
|
||||||
public interface DiscussionEventConverter {
|
public interface DiscussionEventConverter {
|
||||||
|
|
||||||
@Mapping(target = "createByUserId", source = "pojo.userId")
|
@Mapping(target = "createByUserId", source = "pojo.userId")
|
||||||
DiscussionCreated of(DocumentDiscussionPojo pojo, Integer discussionId);
|
DiscussionCreated of(DocumentDiscussion pojo, Integer discussionId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import com.databasir.core.infrastructure.event.EventPublisher;
|
||||||
import com.databasir.dao.impl.DocumentDiscussionDao;
|
import com.databasir.dao.impl.DocumentDiscussionDao;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.tables.pojos.DocumentDiscussionPojo;
|
import com.databasir.dao.tables.pojos.DocumentDiscussion;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
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;
|
||||||
|
@ -54,19 +54,19 @@ public class DocumentDiscussionService {
|
||||||
Pageable pageable,
|
Pageable pageable,
|
||||||
DiscussionListCondition condition) {
|
DiscussionListCondition condition) {
|
||||||
if (projectDao.exists(groupId, projectId)) {
|
if (projectDao.exists(groupId, projectId)) {
|
||||||
Page<DocumentDiscussionPojo> data =
|
Page<DocumentDiscussion> data =
|
||||||
documentDiscussionDao.selectByPage(pageable, condition.toCondition(projectId));
|
documentDiscussionDao.selectByPage(pageable, condition.toCondition(projectId));
|
||||||
Set<Integer> userIdList = data.getContent()
|
Set<Integer> userIdList = data.getContent()
|
||||||
.stream()
|
.stream()
|
||||||
.map(DocumentDiscussionPojo::getUserId)
|
.map(DocumentDiscussion::getUserId)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
Map<Integer, UserPojo> userMapById = userDao.selectUserIdIn(userIdList)
|
Map<Integer, User> userMapById = userDao.selectUserIdIn(userIdList)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(UserPojo::getId, Function.identity()));
|
.collect(Collectors.toMap(User::getId, Function.identity()));
|
||||||
return data
|
return data
|
||||||
.map(discussionPojo -> {
|
.map(discussionPojo -> {
|
||||||
UserPojo userPojo = userMapById.get(discussionPojo.getUserId());
|
User user = userMapById.get(discussionPojo.getUserId());
|
||||||
return discussionResponseConverter.of(discussionPojo, userPojo);
|
return discussionResponseConverter.of(discussionPojo, user);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new Forbidden();
|
throw new Forbidden();
|
||||||
|
@ -75,7 +75,7 @@ public class DocumentDiscussionService {
|
||||||
|
|
||||||
public void create(Integer groupId, Integer projectId, Integer userId, DiscussionCreateRequest request) {
|
public void create(Integer groupId, Integer projectId, Integer userId, DiscussionCreateRequest request) {
|
||||||
if (projectDao.exists(groupId, projectId)) {
|
if (projectDao.exists(groupId, projectId)) {
|
||||||
DocumentDiscussionPojo pojo = new DocumentDiscussionPojo();
|
DocumentDiscussion pojo = new DocumentDiscussion();
|
||||||
pojo.setUserId(userId);
|
pojo.setUserId(userId);
|
||||||
pojo.setProjectId(projectId);
|
pojo.setProjectId(projectId);
|
||||||
pojo.setContent(request.getContent());
|
pojo.setContent(request.getContent());
|
||||||
|
|
|
@ -16,25 +16,25 @@ import java.util.stream.Collectors;
|
||||||
@Mapper(componentModel = "spring", uses = JsonConverter.class)
|
@Mapper(componentModel = "spring", uses = JsonConverter.class)
|
||||||
public interface DatabaseMetaConverter {
|
public interface DatabaseMetaConverter {
|
||||||
|
|
||||||
default DatabaseMeta of(DatabaseDocumentPojo database,
|
default DatabaseMeta of(DatabaseDocument database,
|
||||||
List<TableDocumentPojo> tables,
|
List<TableDocument> tables,
|
||||||
List<TableColumnDocumentPojo> columns,
|
List<TableColumnDocument> columns,
|
||||||
List<TableIndexDocumentPojo> indexes,
|
List<TableIndexDocument> indexes,
|
||||||
List<TableTriggerDocumentPojo> triggers,
|
List<TableTriggerDocument> triggers,
|
||||||
List<TableForeignKeyDocumentPojo> foreignKeys) {
|
List<TableForeignKeyDocument> foreignKeys) {
|
||||||
var columnMap = groupBy(columns, TableColumnDocumentPojo::getTableDocumentId);
|
var columnMap = groupBy(columns, TableColumnDocument::getTableDocumentId);
|
||||||
var indexMap = groupBy(indexes, TableIndexDocumentPojo::getTableDocumentId);
|
var indexMap = groupBy(indexes, TableIndexDocument::getTableDocumentId);
|
||||||
var triggerMap = groupBy(triggers, TableTriggerDocumentPojo::getTableDocumentId);
|
var triggerMap = groupBy(triggers, TableTriggerDocument::getTableDocumentId);
|
||||||
var fkMap = groupBy(foreignKeys, TableForeignKeyDocumentPojo::getTableDocumentId);
|
var fkMap = groupBy(foreignKeys, TableForeignKeyDocument::getTableDocumentId);
|
||||||
return of(database, tables, columnMap, indexMap, triggerMap, fkMap);
|
return of(database, tables, columnMap, indexMap, triggerMap, fkMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
default DatabaseMeta of(DatabaseDocumentPojo database,
|
default DatabaseMeta of(DatabaseDocument database,
|
||||||
List<TableDocumentPojo> tables,
|
List<TableDocument> tables,
|
||||||
Map<Integer, List<TableColumnDocumentPojo>> columnGroupByTableId,
|
Map<Integer, List<TableColumnDocument>> columnGroupByTableId,
|
||||||
Map<Integer, List<TableIndexDocumentPojo>> indexGroupByTableId,
|
Map<Integer, List<TableIndexDocument>> indexGroupByTableId,
|
||||||
Map<Integer, List<TableTriggerDocumentPojo>> triggerGroupByTableId,
|
Map<Integer, List<TableTriggerDocument>> triggerGroupByTableId,
|
||||||
Map<Integer, List<TableForeignKeyDocumentPojo>> fkGroupByTableId) {
|
Map<Integer, List<TableForeignKeyDocument>> fkGroupByTableId) {
|
||||||
List<TableMeta> tableMetas = tables.stream()
|
List<TableMeta> tableMetas = tables.stream()
|
||||||
.map(table -> {
|
.map(table -> {
|
||||||
Integer id = table.getId();
|
Integer id = table.getId();
|
||||||
|
@ -48,22 +48,22 @@ public interface DatabaseMetaConverter {
|
||||||
return of(database, tableMetas);
|
return of(database, tableMetas);
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseMeta of(DatabaseDocumentPojo database, List<TableMeta> tables);
|
DatabaseMeta of(DatabaseDocument database, List<TableMeta> tables);
|
||||||
|
|
||||||
TableMeta of(TableDocumentPojo table,
|
TableMeta of(TableDocument table,
|
||||||
List<TableColumnDocumentPojo> columns,
|
List<TableColumnDocument> columns,
|
||||||
List<TableIndexDocumentPojo> indexes,
|
List<TableIndexDocument> indexes,
|
||||||
List<TableTriggerDocumentPojo> triggers,
|
List<TableTriggerDocument> triggers,
|
||||||
List<TableForeignKeyDocumentPojo> foreignKeys);
|
List<TableForeignKeyDocument> foreignKeys);
|
||||||
|
|
||||||
ColumnMeta of(TableColumnDocumentPojo pojo);
|
ColumnMeta of(TableColumnDocument pojo);
|
||||||
|
|
||||||
@Mapping(target = "isUniqueKey", source = "pojo.isUnique")
|
@Mapping(target = "isUniqueKey", source = "pojo.isUnique")
|
||||||
@Mapping(target = "columnNames", source = "pojo.columnNameArray")
|
@Mapping(target = "columnNames", source = "pojo.columnNameArray")
|
||||||
IndexMeta of(TableIndexDocumentPojo pojo);
|
IndexMeta of(TableIndexDocument pojo);
|
||||||
|
|
||||||
@Mapping(target = "createAt", source = "pojo.triggerCreateAt")
|
@Mapping(target = "createAt", source = "pojo.triggerCreateAt")
|
||||||
TriggerMeta of(TableTriggerDocumentPojo pojo);
|
TriggerMeta of(TableTriggerDocument pojo);
|
||||||
|
|
||||||
List<TableMeta> of(List<TableDocumentResponse> table);
|
List<TableMeta> of(List<TableDocumentResponse> table);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface DocumentFullTextPojoConverter {
|
public interface DocumentFullTextConverter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* groupName、groupDescription, projectName, projectDescription 等信息需要动态获取,所以不保存
|
* groupName、groupDescription, projectName, projectDescription 等信息需要动态获取,所以不保存
|
||||||
|
@ -28,11 +28,11 @@ public interface DocumentFullTextPojoConverter {
|
||||||
@Mapping(target = "groupDescription", ignore = true)
|
@Mapping(target = "groupDescription", ignore = true)
|
||||||
@Mapping(target = "projectName", ignore = true)
|
@Mapping(target = "projectName", ignore = true)
|
||||||
@Mapping(target = "projectDescription", ignore = true)
|
@Mapping(target = "projectDescription", ignore = true)
|
||||||
DocumentFullTextPojo toPojo(GroupPojo group,
|
DocumentFullText toPojo(Group group,
|
||||||
ProjectPojo project,
|
Project project,
|
||||||
DatabaseDocumentPojo db,
|
DatabaseDocument db,
|
||||||
TableDocumentPojo table,
|
TableDocument table,
|
||||||
TableColumnDocumentPojo column,
|
TableColumnDocument column,
|
||||||
String tableDescription,
|
String tableDescription,
|
||||||
String columnDescription);
|
String columnDescription);
|
||||||
}
|
}
|
|
@ -16,14 +16,14 @@ public interface DocumentPojoConverter {
|
||||||
@Mapping(target = "databaseName", source = "meta.databaseName")
|
@Mapping(target = "databaseName", source = "meta.databaseName")
|
||||||
@Mapping(target = "schemaName", source = "meta.schemaName")
|
@Mapping(target = "schemaName", source = "meta.schemaName")
|
||||||
@Mapping(target = "isArchive", constant = "false")
|
@Mapping(target = "isArchive", constant = "false")
|
||||||
DatabaseDocumentPojo toDatabasePojo(Integer projectId,
|
DatabaseDocument toDatabasePojo(Integer projectId,
|
||||||
DatabaseMeta meta,
|
DatabaseMeta meta,
|
||||||
Long version);
|
Long version);
|
||||||
|
|
||||||
TableDocumentPojo toTablePojo(Integer databaseDocumentId,
|
TableDocument toTablePojo(Integer databaseDocumentId,
|
||||||
com.databasir.core.meta.data.TableMeta meta);
|
com.databasir.core.meta.data.TableMeta meta);
|
||||||
|
|
||||||
default List<TableColumnDocumentPojo> toColumnPojo(Integer databaseDocumentId,
|
default List<TableColumnDocument> toColumnPojo(Integer databaseDocumentId,
|
||||||
Integer tableDocumentId,
|
Integer tableDocumentId,
|
||||||
List<ColumnMeta> metaList) {
|
List<ColumnMeta> metaList) {
|
||||||
return metaList.stream()
|
return metaList.stream()
|
||||||
|
@ -31,11 +31,11 @@ public interface DocumentPojoConverter {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
TableColumnDocumentPojo toColumnPojo(Integer databaseDocumentId,
|
TableColumnDocument toColumnPojo(Integer databaseDocumentId,
|
||||||
Integer tableDocumentId,
|
Integer tableDocumentId,
|
||||||
ColumnMeta meta);
|
ColumnMeta meta);
|
||||||
|
|
||||||
default List<TableIndexDocumentPojo> toIndexPojo(Integer databaseDocumentId,
|
default List<TableIndexDocument> toIndexPojo(Integer databaseDocumentId,
|
||||||
Integer tableDocumentId,
|
Integer tableDocumentId,
|
||||||
List<IndexMeta> metaList) {
|
List<IndexMeta> metaList) {
|
||||||
return metaList.stream()
|
return metaList.stream()
|
||||||
|
@ -45,11 +45,11 @@ public interface DocumentPojoConverter {
|
||||||
|
|
||||||
@Mapping(target = "isUnique", source = "meta.isUniqueKey")
|
@Mapping(target = "isUnique", source = "meta.isUniqueKey")
|
||||||
@Mapping(target = "columnNameArray", source = "meta.columnNames")
|
@Mapping(target = "columnNameArray", source = "meta.columnNames")
|
||||||
TableIndexDocumentPojo toIndexPojo(Integer databaseDocumentId,
|
TableIndexDocument toIndexPojo(Integer databaseDocumentId,
|
||||||
Integer tableDocumentId,
|
Integer tableDocumentId,
|
||||||
IndexMeta meta);
|
IndexMeta meta);
|
||||||
|
|
||||||
default List<TableTriggerDocumentPojo> toTriggerPojo(Integer databaseDocumentId,
|
default List<TableTriggerDocument> toTriggerPojo(Integer databaseDocumentId,
|
||||||
Integer tableDocumentId,
|
Integer tableDocumentId,
|
||||||
List<TriggerMeta> metaList) {
|
List<TriggerMeta> metaList) {
|
||||||
return metaList.stream()
|
return metaList.stream()
|
||||||
|
@ -59,11 +59,11 @@ public interface DocumentPojoConverter {
|
||||||
|
|
||||||
@Mapping(target = "triggerCreateAt", source = "meta.createAt")
|
@Mapping(target = "triggerCreateAt", source = "meta.createAt")
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
TableTriggerDocumentPojo toTriggerPojo(Integer databaseDocumentId,
|
TableTriggerDocument toTriggerPojo(Integer databaseDocumentId,
|
||||||
Integer tableDocumentId,
|
Integer tableDocumentId,
|
||||||
TriggerMeta meta);
|
TriggerMeta meta);
|
||||||
|
|
||||||
default List<TableForeignKeyDocumentPojo> toForeignKeyPojo(Integer docId,
|
default List<TableForeignKeyDocument> toForeignKeyPojo(Integer docId,
|
||||||
Integer tableMetaId,
|
Integer tableMetaId,
|
||||||
List<ForeignKeyMeta> foreignKeys) {
|
List<ForeignKeyMeta> foreignKeys) {
|
||||||
return foreignKeys.stream()
|
return foreignKeys.stream()
|
||||||
|
@ -73,7 +73,7 @@ public interface DocumentPojoConverter {
|
||||||
|
|
||||||
@Mapping(target = "id", ignore = true)
|
@Mapping(target = "id", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
TableForeignKeyDocumentPojo toForeignKeyPojo(Integer databaseDocumentId,
|
TableForeignKeyDocument toForeignKeyPojo(Integer databaseDocumentId,
|
||||||
Integer tableDocumentId,
|
Integer tableDocumentId,
|
||||||
ForeignKeyMeta foreignKey);
|
ForeignKeyMeta foreignKey);
|
||||||
|
|
||||||
|
|
|
@ -19,31 +19,31 @@ public interface DocumentResponseConverter {
|
||||||
@Mapping(target = "indexes", source = "indexes")
|
@Mapping(target = "indexes", source = "indexes")
|
||||||
@Mapping(target = "foreignKeys", source = "foreignKeys")
|
@Mapping(target = "foreignKeys", source = "foreignKeys")
|
||||||
@Mapping(target = "triggers", source = "triggers")
|
@Mapping(target = "triggers", source = "triggers")
|
||||||
TableDocumentResponse of(TableDocumentPojo tableDocument,
|
TableDocumentResponse of(TableDocument tableDocument,
|
||||||
List<TableColumnDocumentPojo> columns,
|
List<TableColumnDocument> columns,
|
||||||
List<TableIndexDocumentPojo> indexes,
|
List<TableIndexDocument> indexes,
|
||||||
List<TableForeignKeyDocumentPojo> foreignKeys,
|
List<TableForeignKeyDocument> foreignKeys,
|
||||||
List<TableTriggerDocumentPojo> triggers);
|
List<TableTriggerDocument> triggers);
|
||||||
|
|
||||||
@Mapping(target = "columns", source = "columns")
|
@Mapping(target = "columns", source = "columns")
|
||||||
@Mapping(target = "indexes", source = "indexes")
|
@Mapping(target = "indexes", source = "indexes")
|
||||||
@Mapping(target = "foreignKeys", source = "foreignKeys")
|
@Mapping(target = "foreignKeys", source = "foreignKeys")
|
||||||
@Mapping(target = "triggers", source = "triggers")
|
@Mapping(target = "triggers", source = "triggers")
|
||||||
@SuppressWarnings("checkstyle:all")
|
@SuppressWarnings("checkstyle:all")
|
||||||
TableDocumentResponse of(TableDocumentPojo tableDocument,
|
TableDocumentResponse of(TableDocument tableDocument,
|
||||||
Integer discussionCount,
|
Integer discussionCount,
|
||||||
String description,
|
String description,
|
||||||
List<TableDocumentResponse.ColumnDocumentResponse> columns,
|
List<TableDocumentResponse.ColumnDocumentResponse> columns,
|
||||||
List<TableIndexDocumentPojo> indexes,
|
List<TableIndexDocument> indexes,
|
||||||
List<TableForeignKeyDocumentPojo> foreignKeys,
|
List<TableForeignKeyDocument> foreignKeys,
|
||||||
List<TableTriggerDocumentPojo> triggers);
|
List<TableTriggerDocument> triggers);
|
||||||
|
|
||||||
TableDocumentResponse.ColumnDocumentResponse of(TableColumnDocumentPojo pojo,
|
TableDocumentResponse.ColumnDocumentResponse of(TableColumnDocument pojo,
|
||||||
Integer discussionCount,
|
Integer discussionCount,
|
||||||
String description);
|
String description);
|
||||||
|
|
||||||
default List<TableDocumentResponse.ColumnDocumentResponse> of(
|
default List<TableDocumentResponse.ColumnDocumentResponse> of(
|
||||||
List<TableColumnDocumentPojo> columns,
|
List<TableColumnDocument> columns,
|
||||||
String tableName,
|
String tableName,
|
||||||
Map<String, Integer> discussionCountMapByJoinName,
|
Map<String, Integer> discussionCountMapByJoinName,
|
||||||
Map<String, String> descriptionMapByJoinName) {
|
Map<String, String> descriptionMapByJoinName) {
|
||||||
|
@ -57,11 +57,11 @@ public interface DocumentResponseConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mapping(target = "columnNames", source = "columnNameArray")
|
@Mapping(target = "columnNames", source = "columnNameArray")
|
||||||
TableDocumentResponse.IndexDocumentResponse of(TableIndexDocumentPojo indexDocument);
|
TableDocumentResponse.IndexDocumentResponse of(TableIndexDocument indexDocument);
|
||||||
|
|
||||||
@Mapping(target = "id", source = "databaseDocument.id")
|
@Mapping(target = "id", source = "databaseDocument.id")
|
||||||
@Mapping(target = "createAt", source = "databaseDocument.createAt")
|
@Mapping(target = "createAt", source = "databaseDocument.createAt")
|
||||||
@Mapping(target = "documentVersion", source = "databaseDocument.version")
|
@Mapping(target = "documentVersion", source = "databaseDocument.version")
|
||||||
DatabaseDocumentResponse of(DatabaseDocumentPojo databaseDocument,
|
DatabaseDocumentResponse of(DatabaseDocument databaseDocument,
|
||||||
List<TableDocumentResponse> tables);
|
List<TableDocumentResponse> tables);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.databasir.core.domain.document.converter;
|
||||||
import com.databasir.core.diff.data.DiffType;
|
import com.databasir.core.diff.data.DiffType;
|
||||||
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
|
import com.databasir.core.domain.document.data.DatabaseDocumentSimpleResponse;
|
||||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||||
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
|
import com.databasir.dao.tables.pojos.DatabaseDocument;
|
||||||
import com.databasir.dao.tables.pojos.TableDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableDocument;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.ReportingPolicy;
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
@ -19,16 +19,16 @@ public interface DocumentSimpleResponseConverter {
|
||||||
@Mapping(target = "id", source = "databaseDocument.id")
|
@Mapping(target = "id", source = "databaseDocument.id")
|
||||||
@Mapping(target = "createAt", source = "databaseDocument.createAt")
|
@Mapping(target = "createAt", source = "databaseDocument.createAt")
|
||||||
@Mapping(target = "documentVersion", source = "databaseDocument.version")
|
@Mapping(target = "documentVersion", source = "databaseDocument.version")
|
||||||
DatabaseDocumentSimpleResponse of(DatabaseDocumentPojo databaseDocument,
|
DatabaseDocumentSimpleResponse of(DatabaseDocument databaseDocument,
|
||||||
List<DatabaseDocumentSimpleResponse.TableData> tables,
|
List<DatabaseDocumentSimpleResponse.TableData> tables,
|
||||||
DiffType diffType,
|
DiffType diffType,
|
||||||
String projectName);
|
String projectName);
|
||||||
|
|
||||||
DatabaseDocumentSimpleResponse.TableData of(TableDocumentPojo tables,
|
DatabaseDocumentSimpleResponse.TableData of(TableDocument tables,
|
||||||
Integer discussionCount,
|
Integer discussionCount,
|
||||||
String description);
|
String description);
|
||||||
|
|
||||||
default List<DatabaseDocumentSimpleResponse.TableData> of(List<TableDocumentPojo> tables,
|
default List<DatabaseDocumentSimpleResponse.TableData> of(List<TableDocument> tables,
|
||||||
Map<String, Integer> discussionCountMapByTableName,
|
Map<String, Integer> discussionCountMapByTableName,
|
||||||
Map<String, String> descriptionMapByTableName) {
|
Map<String, String> descriptionMapByTableName) {
|
||||||
return tables.stream()
|
return tables.stream()
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.databasir.core.domain.document.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.document.data.DocumentTemplatePropertiesUpdateRequest;
|
import com.databasir.core.domain.document.data.DocumentTemplatePropertiesUpdateRequest;
|
||||||
import com.databasir.dao.enums.DocumentTemplatePropertyType;
|
import com.databasir.dao.enums.DocumentTemplatePropertyType;
|
||||||
import com.databasir.dao.tables.pojos.DocumentTemplatePropertyPojo;
|
import com.databasir.dao.tables.pojos.DocumentTemplateProperty;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ import java.util.stream.Collectors;
|
||||||
public interface DocumentTemplatePropertiesUpdateRequestConverter {
|
public interface DocumentTemplatePropertiesUpdateRequestConverter {
|
||||||
|
|
||||||
@Mapping(target = "defaultValue", constant = "")
|
@Mapping(target = "defaultValue", constant = "")
|
||||||
DocumentTemplatePropertyPojo toPojo(DocumentTemplatePropertiesUpdateRequest.PropertyRequest property,
|
DocumentTemplateProperty toPojo(DocumentTemplatePropertiesUpdateRequest.PropertyRequest property,
|
||||||
DocumentTemplatePropertyType type);
|
DocumentTemplatePropertyType type);
|
||||||
|
|
||||||
default List<DocumentTemplatePropertyPojo> toPojo(DocumentTemplatePropertiesUpdateRequest request) {
|
default List<DocumentTemplateProperty> toPojo(DocumentTemplatePropertiesUpdateRequest request) {
|
||||||
return request.getProperties().stream()
|
return request.getProperties().stream()
|
||||||
.map(prop -> toPojo(prop, request.getType()))
|
.map(prop -> toPojo(prop, request.getType()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.domain.document.converter;
|
package com.databasir.core.domain.document.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.document.data.DocumentTemplatePropertiesResponse;
|
import com.databasir.core.domain.document.data.DocumentTemplatePropertiesResponse;
|
||||||
import com.databasir.dao.tables.pojos.DocumentTemplatePropertyPojo;
|
import com.databasir.dao.tables.pojos.DocumentTemplateProperty;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -10,6 +10,6 @@ import java.util.List;
|
||||||
public interface DocumentTemplatePropertyResponseConverter {
|
public interface DocumentTemplatePropertyResponseConverter {
|
||||||
|
|
||||||
List<DocumentTemplatePropertiesResponse.DocumentTemplatePropertyResponse> of(
|
List<DocumentTemplatePropertiesResponse.DocumentTemplatePropertyResponse> of(
|
||||||
List<DocumentTemplatePropertyPojo> pojoList);
|
List<DocumentTemplateProperty> pojoList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.databasir.core.domain.document.converter;
|
package com.databasir.core.domain.document.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.document.data.TableResponse;
|
import com.databasir.core.domain.document.data.TableResponse;
|
||||||
import com.databasir.dao.tables.pojos.TableColumnDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableColumnDocument;
|
||||||
import com.databasir.dao.tables.pojos.TableDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableDocument;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -12,14 +12,14 @@ import java.util.stream.Collectors;
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface TableResponseConverter {
|
public interface TableResponseConverter {
|
||||||
|
|
||||||
default List<TableResponse> from(List<TableDocumentPojo> tables,
|
default List<TableResponse> from(List<TableDocument> tables,
|
||||||
Map<Integer, List<TableColumnDocumentPojo>> columnMapByTableId) {
|
Map<Integer, List<TableColumnDocument>> columnMapByTableId) {
|
||||||
return tables.stream()
|
return tables.stream()
|
||||||
.map(table -> from(table, columnMapByTableId.get(table.getId())))
|
.map(table -> from(table, columnMapByTableId.get(table.getId())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
TableResponse from(TableDocumentPojo table, List<TableColumnDocumentPojo> columns);
|
TableResponse from(TableDocument table, List<TableColumnDocument> columns);
|
||||||
|
|
||||||
TableResponse.ColumnResponse from(TableColumnDocumentPojo column);
|
TableResponse.ColumnResponse from(TableColumnDocument column);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ public class DocumentUpdated {
|
||||||
|
|
||||||
private Integer projectId;
|
private Integer projectId;
|
||||||
|
|
||||||
|
private Integer databaseDocumentId;
|
||||||
|
|
||||||
public Optional<Long> getOldVersion() {
|
public Optional<Long> getOldVersion() {
|
||||||
return Optional.ofNullable(oldVersion);
|
return Optional.ofNullable(oldVersion);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class DocumentService {
|
||||||
|
|
||||||
private final DocumentPojoConverter documentPojoConverter;
|
private final DocumentPojoConverter documentPojoConverter;
|
||||||
|
|
||||||
private final DocumentFullTextPojoConverter documentFullTextPojoConverter;
|
private final DocumentFullTextConverter documentFullTextConverter;
|
||||||
|
|
||||||
private final DocumentResponseConverter documentResponseConverter;
|
private final DocumentResponseConverter documentResponseConverter;
|
||||||
|
|
||||||
|
@ -102,9 +102,9 @@ public class DocumentService {
|
||||||
projectDao.selectOptionalById(projectId)
|
projectDao.selectOptionalById(projectId)
|
||||||
.orElseThrow(DomainErrors.PROJECT_NOT_FOUND::exception);
|
.orElseThrow(DomainErrors.PROJECT_NOT_FOUND::exception);
|
||||||
DatabaseMeta current = retrieveDatabaseMeta(projectId);
|
DatabaseMeta current = retrieveDatabaseMeta(projectId);
|
||||||
Optional<DatabaseDocumentPojo> originalOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
Optional<DatabaseDocument> originalOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
||||||
if (originalOption.isPresent()) {
|
if (originalOption.isPresent()) {
|
||||||
DatabaseDocumentPojo original = originalOption.get();
|
DatabaseDocument original = originalOption.get();
|
||||||
DatabaseMeta originalMeta = retrieveOriginalDatabaseMeta(original);
|
DatabaseMeta originalMeta = retrieveOriginalDatabaseMeta(original);
|
||||||
RootDiff diff = Diffs.diff(originalMeta, current);
|
RootDiff diff = Diffs.diff(originalMeta, current);
|
||||||
if (diff.getDiffType() == DiffType.NONE) {
|
if (diff.getDiffType() == DiffType.NONE) {
|
||||||
|
@ -117,34 +117,34 @@ public class DocumentService {
|
||||||
// archive old version
|
// archive old version
|
||||||
databaseDocumentDao.updateIsArchiveById(previousDocumentId, true);
|
databaseDocumentDao.updateIsArchiveById(previousDocumentId, true);
|
||||||
Long version = original.getVersion();
|
Long version = original.getVersion();
|
||||||
saveNewDocument(current, version + 1, original.getProjectId());
|
Integer docId = saveNewDocument(current, version + 1, original.getProjectId());
|
||||||
eventPublisher.publish(new DocumentUpdated(diff, version + 1, version, projectId));
|
eventPublisher.publish(new DocumentUpdated(diff, version + 1, version, projectId, docId));
|
||||||
} else {
|
} else {
|
||||||
saveNewDocument(current, 1L, projectId);
|
Integer docId = saveNewDocument(current, 1L, projectId);
|
||||||
RootDiff diff = null;
|
RootDiff diff = null;
|
||||||
try {
|
try {
|
||||||
diff = Diffs.diff(null, current);
|
diff = Diffs.diff(null, current);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("diff project " + projectId + " error, fallback diff type to NONE", e);
|
log.error("diff project " + projectId + " error, fallback diff type to NONE", e);
|
||||||
}
|
}
|
||||||
eventPublisher.publish(new DocumentUpdated(diff, 1L, null, projectId));
|
eventPublisher.publish(new DocumentUpdated(diff, 1L, null, projectId, docId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DatabaseMeta retrieveOriginalDatabaseMeta(DatabaseDocumentPojo original) {
|
private DatabaseMeta retrieveOriginalDatabaseMeta(DatabaseDocument original) {
|
||||||
Integer docId = original.getId();
|
Integer docId = original.getId();
|
||||||
List<TableDocumentPojo> tables = tableDocumentDao.selectByDatabaseDocumentId(docId);
|
List<TableDocument> tables = tableDocumentDao.selectByDatabaseDocumentId(docId);
|
||||||
List<TableColumnDocumentPojo> columns = tableColumnDocumentDao.selectByDatabaseDocumentId(docId);
|
List<TableColumnDocument> columns = tableColumnDocumentDao.selectByDatabaseDocumentId(docId);
|
||||||
List<TableIndexDocumentPojo> indexes = tableIndexDocumentDao.selectByDatabaseMetaId(docId);
|
List<TableIndexDocument> indexes = tableIndexDocumentDao.selectByDatabaseMetaId(docId);
|
||||||
List<TableTriggerDocumentPojo> triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(docId);
|
List<TableTriggerDocument> triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(docId);
|
||||||
List<TableForeignKeyDocumentPojo> fks = tableForeignKeyDocumentDao.selectByDatabaseDocumentId(docId);
|
List<TableForeignKeyDocument> fks = tableForeignKeyDocumentDao.selectByDatabaseDocumentId(docId);
|
||||||
return databaseMetaConverter.of(original, tables, columns, indexes, triggers, fks);
|
return databaseMetaConverter.of(original, tables, columns, indexes, triggers, fks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DatabaseMeta retrieveDatabaseMeta(Integer projectId) {
|
private DatabaseMeta retrieveDatabaseMeta(Integer projectId) {
|
||||||
ProjectSyncRulePojo rule = projectSyncRuleDao.selectByProjectId(projectId);
|
ProjectSyncRule rule = projectSyncRuleDao.selectByProjectId(projectId);
|
||||||
DataSourcePojo dataSource = dataSourceDao.selectByProjectId(projectId);
|
DataSource dataSource = dataSourceDao.selectByProjectId(projectId);
|
||||||
List<DataSourcePropertyPojo> properties = dataSourcePropertyDao.selectByDataSourceId(dataSource.getId());
|
List<DataSourceProperty> properties = dataSourcePropertyDao.selectByDataSourceId(dataSource.getId());
|
||||||
Connection jdbcConnection = databaseConnectionService.create(dataSource, properties);
|
Connection jdbcConnection = databaseConnectionService.create(dataSource, properties);
|
||||||
DatabasirConfig databasirConfig = new DatabasirConfig();
|
DatabasirConfig databasirConfig = new DatabasirConfig();
|
||||||
databasirConfig.setIgnoreTableNameRegex(jsonConverter.fromJson(rule.getIgnoreTableNameRegexArray()));
|
databasirConfig.setIgnoreTableNameRegex(jsonConverter.fromJson(rule.getIgnoreTableNameRegexArray()));
|
||||||
|
@ -168,9 +168,9 @@ public class DocumentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveNewDocument(DatabaseMeta meta,
|
private Integer saveNewDocument(DatabaseMeta meta,
|
||||||
Long version,
|
Long version,
|
||||||
Integer projectId) {
|
Integer projectId) {
|
||||||
|
|
||||||
var dbDocPojo = documentPojoConverter.toDatabasePojo(projectId, meta, version);
|
var dbDocPojo = documentPojoConverter.toDatabasePojo(projectId, meta, version);
|
||||||
final Integer docId;
|
final Integer docId;
|
||||||
|
@ -182,7 +182,7 @@ public class DocumentService {
|
||||||
throw new DatabasirException(DomainErrors.DATABASE_DOCUMENT_DUPLICATE_KEY);
|
throw new DatabasirException(DomainErrors.DATABASE_DOCUMENT_DUPLICATE_KEY);
|
||||||
}
|
}
|
||||||
meta.getTables().forEach(table -> {
|
meta.getTables().forEach(table -> {
|
||||||
TableDocumentPojo tableMeta =
|
TableDocument tableMeta =
|
||||||
documentPojoConverter.toTablePojo(docId, table);
|
documentPojoConverter.toTablePojo(docId, table);
|
||||||
Integer tableMetaId = tableDocumentDao.insertAndReturnId(tableMeta);
|
Integer tableMetaId = tableDocumentDao.insertAndReturnId(tableMeta);
|
||||||
tableMeta.setId(tableMetaId);
|
tableMeta.setId(tableMetaId);
|
||||||
|
@ -209,42 +209,27 @@ public class DocumentService {
|
||||||
// trigger
|
// trigger
|
||||||
var triggers = documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
|
var triggers = documentPojoConverter.toTriggerPojo(docId, tableMetaId, table.getTriggers());
|
||||||
tableTriggerDocumentDao.batchInsert(triggers);
|
tableTriggerDocumentDao.batchInsert(triggers);
|
||||||
|
|
||||||
// save full text
|
|
||||||
var descriptionMapByJoinName = documentDescriptionDao.selectByProjectId(projectId)
|
|
||||||
.stream()
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
d -> {
|
|
||||||
if (d.getColumnName() == null) {
|
|
||||||
return d.getTableName();
|
|
||||||
}
|
|
||||||
return String.join(".",
|
|
||||||
d.getTableName(),
|
|
||||||
StringUtils.defaultIfBlank(d.getColumnName(), ""));
|
|
||||||
},
|
|
||||||
DocumentDescriptionPojo::getContent,
|
|
||||||
(a, b) -> a));
|
|
||||||
saveDocumentFullText(projectId, dbDocPojo, tableMeta, descriptionMapByJoinName);
|
|
||||||
});
|
});
|
||||||
log.info("save new version document success: projectId = {}, name = {}, version = {}",
|
log.info("save new version document success: projectId = {}, name = {}, version = {}",
|
||||||
projectId, meta.getDatabaseName(), version);
|
projectId, meta.getDatabaseName(), version);
|
||||||
|
return docId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveDocumentFullText(Integer projectId,
|
private void saveDocumentFullText(Integer projectId,
|
||||||
DatabaseDocumentPojo database,
|
DatabaseDocument database,
|
||||||
TableDocumentPojo table,
|
TableDocument table,
|
||||||
Map<String, String> descriptionMapByJoinName) {
|
Map<String, String> descriptionMapByJoinName) {
|
||||||
ProjectPojo project = projectDao.selectById(projectId);
|
Project project = projectDao.selectById(projectId);
|
||||||
GroupPojo group = groupDao.selectById(project.getGroupId());
|
Group group = groupDao.selectById(project.getGroupId());
|
||||||
List<TableColumnDocumentPojo> columns = tableColumnDocumentDao.selectByTableDocumentId(table.getId());
|
List<TableColumnDocument> columns = tableColumnDocumentDao.selectByTableDocumentId(table.getId());
|
||||||
// clear outdated data before save
|
// clear outdated data before save
|
||||||
documentFullTextDao.deleteTableFullText(table.getId());
|
documentFullTextDao.deleteTableFullText(table.getId());
|
||||||
List<DocumentFullTextPojo> fullTextPojoList = columns.stream()
|
List<DocumentFullText> fullTextPojoList = columns.stream()
|
||||||
.map(column -> {
|
.map(column -> {
|
||||||
String tableName = table.getName();
|
String tableName = table.getName();
|
||||||
String tableDescription = descriptionMapByJoinName.get(tableName);
|
String tableDescription = descriptionMapByJoinName.get(tableName);
|
||||||
String columnDescription = descriptionMapByJoinName.get(tableName + "." + column.getName());
|
String columnDescription = descriptionMapByJoinName.get(tableName + "." + column.getName());
|
||||||
return documentFullTextPojoConverter.toPojo(group, project, database, table, column,
|
return documentFullTextConverter.toPojo(group, project, database, table, column,
|
||||||
tableDescription, columnDescription);
|
tableDescription, columnDescription);
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -255,10 +240,10 @@ public class DocumentService {
|
||||||
Long version,
|
Long version,
|
||||||
Long originalVersion) {
|
Long originalVersion) {
|
||||||
String projectName = projectDao.selectOptionalById(projectId)
|
String projectName = projectDao.selectOptionalById(projectId)
|
||||||
.map(ProjectPojo::getName)
|
.map(Project::getName)
|
||||||
.orElseThrow(DomainErrors.PROJECT_NOT_FOUND::exception);
|
.orElseThrow(DomainErrors.PROJECT_NOT_FOUND::exception);
|
||||||
|
|
||||||
Optional<DatabaseDocumentPojo> documentOption;
|
Optional<DatabaseDocument> documentOption;
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
documentOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
documentOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -331,7 +316,7 @@ public class DocumentService {
|
||||||
public List<TableDiffResult> tableDiffs(Integer projectId, Long originalVersion, Long currentVersion) {
|
public List<TableDiffResult> tableDiffs(Integer projectId, Long originalVersion, Long currentVersion) {
|
||||||
var original = databaseDocumentDao.selectOptionalByProjectIdAndVersion(projectId, originalVersion)
|
var original = databaseDocumentDao.selectOptionalByProjectIdAndVersion(projectId, originalVersion)
|
||||||
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
||||||
DatabaseDocumentPojo current;
|
DatabaseDocument current;
|
||||||
if (currentVersion == null) {
|
if (currentVersion == null) {
|
||||||
current = databaseDocumentDao.selectNotArchivedByProjectId(projectId)
|
current = databaseDocumentDao.selectNotArchivedByProjectId(projectId)
|
||||||
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
||||||
|
@ -346,7 +331,7 @@ public class DocumentService {
|
||||||
|
|
||||||
public Optional<DatabaseDocumentResponse> getOneByProjectId(Integer projectId, Long version) {
|
public Optional<DatabaseDocumentResponse> getOneByProjectId(Integer projectId, Long version) {
|
||||||
|
|
||||||
Optional<DatabaseDocumentPojo> documentOption;
|
Optional<DatabaseDocument> documentOption;
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
documentOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
documentOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -359,14 +344,14 @@ public class DocumentService {
|
||||||
var indexes = tableIndexDocumentDao.selectByDatabaseMetaId(id);
|
var indexes = tableIndexDocumentDao.selectByDatabaseMetaId(id);
|
||||||
var triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(id);
|
var triggers = tableTriggerDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
var foreignKeys = tableForeignKeyDocumentDao.selectByDatabaseDocumentId(id);
|
var foreignKeys = tableForeignKeyDocumentDao.selectByDatabaseDocumentId(id);
|
||||||
Map<Integer, List<TableColumnDocumentPojo>> columnsGroupByTableMetaId = columns.stream()
|
Map<Integer, List<TableColumnDocument>> columnsGroupByTableMetaId = columns.stream()
|
||||||
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableColumnDocument::getTableDocumentId));
|
||||||
Map<Integer, List<TableIndexDocumentPojo>> indexesGroupByTableMetaId = indexes.stream()
|
Map<Integer, List<TableIndexDocument>> indexesGroupByTableMetaId = indexes.stream()
|
||||||
.collect(Collectors.groupingBy(TableIndexDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableIndexDocument::getTableDocumentId));
|
||||||
Map<Integer, List<TableTriggerDocumentPojo>> triggersGroupByTableMetaId = triggers.stream()
|
Map<Integer, List<TableTriggerDocument>> triggersGroupByTableMetaId = triggers.stream()
|
||||||
.collect(Collectors.groupingBy(TableTriggerDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableTriggerDocument::getTableDocumentId));
|
||||||
Map<Integer, List<TableForeignKeyDocumentPojo>> foreignKeysGroupByTableMetaId = foreignKeys.stream()
|
Map<Integer, List<TableForeignKeyDocument>> foreignKeysGroupByTableMetaId = foreignKeys.stream()
|
||||||
.collect(Collectors.groupingBy(TableForeignKeyDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableForeignKeyDocument::getTableDocumentId));
|
||||||
var tableDocumentResponseList = tables.stream()
|
var tableDocumentResponseList = tables.stream()
|
||||||
.map(table -> {
|
.map(table -> {
|
||||||
Integer tableId = table.getId();
|
Integer tableId = table.getId();
|
||||||
|
@ -412,26 +397,26 @@ public class DocumentService {
|
||||||
// column
|
// column
|
||||||
var columns =
|
var columns =
|
||||||
tableColumnDocumentDao.selectByDatabaseDocumentIdAndTableIdIn(databaseDocumentId, tableIds);
|
tableColumnDocumentDao.selectByDatabaseDocumentIdAndTableIdIn(databaseDocumentId, tableIds);
|
||||||
Map<Integer, List<TableColumnDocumentPojo>> columnsGroupByTableMetaId = columns.stream()
|
Map<Integer, List<TableColumnDocument>> columnsGroupByTableMetaId = columns.stream()
|
||||||
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableColumnDocument::getTableDocumentId));
|
||||||
|
|
||||||
// index
|
// index
|
||||||
var indexes =
|
var indexes =
|
||||||
tableIndexDocumentDao.selectByDatabaseDocumentIdAndIdIn(databaseDocumentId, tableIds);
|
tableIndexDocumentDao.selectByDatabaseDocumentIdAndIdIn(databaseDocumentId, tableIds);
|
||||||
Map<Integer, List<TableIndexDocumentPojo>> indexesGroupByTableMetaId = indexes.stream()
|
Map<Integer, List<TableIndexDocument>> indexesGroupByTableMetaId = indexes.stream()
|
||||||
.collect(Collectors.groupingBy(TableIndexDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableIndexDocument::getTableDocumentId));
|
||||||
|
|
||||||
// foreign keys
|
// foreign keys
|
||||||
var foreignKeys =
|
var foreignKeys =
|
||||||
tableForeignKeyDocumentDao.selectByDatabaseDocumentIdAndTableIdIn(databaseDocumentId, tableIds);
|
tableForeignKeyDocumentDao.selectByDatabaseDocumentIdAndTableIdIn(databaseDocumentId, tableIds);
|
||||||
Map<Integer, List<TableForeignKeyDocumentPojo>> foreignKeysGroupByTableMetaId = foreignKeys.stream()
|
Map<Integer, List<TableForeignKeyDocument>> foreignKeysGroupByTableMetaId = foreignKeys.stream()
|
||||||
.collect(Collectors.groupingBy(TableForeignKeyDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableForeignKeyDocument::getTableDocumentId));
|
||||||
|
|
||||||
// trigger
|
// trigger
|
||||||
var triggers =
|
var triggers =
|
||||||
tableTriggerDocumentDao.selectByDatabaseDocumentIdAndIdIn(databaseDocumentId, tableIds);
|
tableTriggerDocumentDao.selectByDatabaseDocumentIdAndIdIn(databaseDocumentId, tableIds);
|
||||||
Map<Integer, List<TableTriggerDocumentPojo>> triggersGroupByTableMetaId = triggers.stream()
|
Map<Integer, List<TableTriggerDocument>> triggersGroupByTableMetaId = triggers.stream()
|
||||||
.collect(Collectors.groupingBy(TableTriggerDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableTriggerDocument::getTableDocumentId));
|
||||||
|
|
||||||
// discussion
|
// discussion
|
||||||
var discussions = documentDiscussionDao.selectAllDiscussionCount(projectId);
|
var discussions = documentDiscussionDao.selectAllDiscussionCount(projectId);
|
||||||
|
@ -450,7 +435,7 @@ public class DocumentService {
|
||||||
d -> String.join(".",
|
d -> String.join(".",
|
||||||
d.getTableName(),
|
d.getTableName(),
|
||||||
StringUtils.defaultIfBlank(d.getColumnName(), "")),
|
StringUtils.defaultIfBlank(d.getColumnName(), "")),
|
||||||
DocumentDescriptionPojo::getContent,
|
DocumentDescription::getContent,
|
||||||
(a, b) -> a));
|
(a, b) -> a));
|
||||||
|
|
||||||
return tables.stream()
|
return tables.stream()
|
||||||
|
@ -491,7 +476,7 @@ public class DocumentService {
|
||||||
List<Integer> currentTableIds = current.stream().map(t -> t.getId()).collect(Collectors.toList());
|
List<Integer> currentTableIds = current.stream().map(t -> t.getId()).collect(Collectors.toList());
|
||||||
var missedIds = CollectionUtils.disjunction(currentTableIds, request.getTableIds());
|
var missedIds = CollectionUtils.disjunction(currentTableIds, request.getTableIds());
|
||||||
if (request.getOriginalVersion() != null) {
|
if (request.getOriginalVersion() != null) {
|
||||||
DatabaseDocumentPojo doc =
|
DatabaseDocument doc =
|
||||||
databaseDocumentDao.selectOptionalByProjectIdAndVersion(projectId, request.getOriginalVersion())
|
databaseDocumentDao.selectOptionalByProjectIdAndVersion(projectId, request.getOriginalVersion())
|
||||||
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
||||||
List<String> tableNames = current.stream().map(t -> t.getName()).distinct().collect(Collectors.toList());
|
List<String> tableNames = current.stream().map(t -> t.getName()).distinct().collect(Collectors.toList());
|
||||||
|
@ -544,7 +529,7 @@ public class DocumentService {
|
||||||
doc = getOneByProjectId(projectId, version)
|
doc = getOneByProjectId(projectId, version)
|
||||||
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
||||||
} else {
|
} else {
|
||||||
DatabaseDocumentPojo databaseDoc;
|
DatabaseDocument databaseDoc;
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
databaseDoc = databaseDocumentDao.selectNotArchivedByProjectId(projectId)
|
databaseDoc = databaseDocumentDao.selectNotArchivedByProjectId(projectId)
|
||||||
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
.orElseThrow(DomainErrors.DOCUMENT_VERSION_IS_INVALID::exception);
|
||||||
|
@ -567,7 +552,7 @@ public class DocumentService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TableResponse> getTableAndColumns(Integer projectId, Long version) {
|
public List<TableResponse> getTableAndColumns(Integer projectId, Long version) {
|
||||||
Optional<DatabaseDocumentPojo> documentOption;
|
Optional<DatabaseDocument> documentOption;
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
documentOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
documentOption = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -576,11 +561,11 @@ public class DocumentService {
|
||||||
if (documentOption.isEmpty()) {
|
if (documentOption.isEmpty()) {
|
||||||
return emptyList();
|
return emptyList();
|
||||||
} else {
|
} else {
|
||||||
DatabaseDocumentPojo databaseDoc = documentOption.get();
|
DatabaseDocument databaseDoc = documentOption.get();
|
||||||
var tables = tableDocumentDao.selectByDatabaseDocumentId(databaseDoc.getId());
|
var tables = tableDocumentDao.selectByDatabaseDocumentId(databaseDoc.getId());
|
||||||
var columns = tableColumnDocumentDao.selectByDatabaseDocumentId(databaseDoc.getId());
|
var columns = tableColumnDocumentDao.selectByDatabaseDocumentId(databaseDoc.getId());
|
||||||
var columnMapByTableId = columns.stream()
|
var columnMapByTableId = columns.stream()
|
||||||
.collect(Collectors.groupingBy(TableColumnDocumentPojo::getTableDocumentId));
|
.collect(Collectors.groupingBy(TableColumnDocument::getTableDocumentId));
|
||||||
return tableResponseConverter.from(tables, columnMapByTableId);
|
return tableResponseConverter.from(tables, columnMapByTableId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.databasir.core.domain.document.converter.DocumentTemplatePropertyResp
|
||||||
import com.databasir.core.domain.document.data.DocumentTemplatePropertiesResponse;
|
import com.databasir.core.domain.document.data.DocumentTemplatePropertiesResponse;
|
||||||
import com.databasir.core.domain.document.data.DocumentTemplatePropertiesUpdateRequest;
|
import com.databasir.core.domain.document.data.DocumentTemplatePropertiesUpdateRequest;
|
||||||
import com.databasir.dao.impl.DocumentTemplatePropertyDao;
|
import com.databasir.dao.impl.DocumentTemplatePropertyDao;
|
||||||
import com.databasir.dao.tables.pojos.DocumentTemplatePropertyPojo;
|
import com.databasir.dao.tables.pojos.DocumentTemplateProperty;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -27,7 +27,7 @@ public class DocumentTemplateService {
|
||||||
private final DocumentTemplatePropertiesUpdateRequestConverter documentTemplatePropertiesUpdateRequestConverter;
|
private final DocumentTemplatePropertiesUpdateRequestConverter documentTemplatePropertiesUpdateRequestConverter;
|
||||||
|
|
||||||
public DocumentTemplatePropertiesResponse getAllProperties() {
|
public DocumentTemplatePropertiesResponse getAllProperties() {
|
||||||
List<DocumentTemplatePropertyPojo> properties = documentTemplatePropertyDao.selectAll();
|
List<DocumentTemplateProperty> properties = documentTemplatePropertyDao.selectAll();
|
||||||
var propertiesGroupByType = documentTemplatePropertyResponseConverter.of(properties)
|
var propertiesGroupByType = documentTemplatePropertyResponseConverter.of(properties)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.groupingBy(d -> d.getType()));
|
.collect(Collectors.groupingBy(d -> d.getType()));
|
||||||
|
@ -41,7 +41,7 @@ public class DocumentTemplateService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateByType(DocumentTemplatePropertiesUpdateRequest request) {
|
public void updateByType(DocumentTemplatePropertiesUpdateRequest request) {
|
||||||
List<DocumentTemplatePropertyPojo> pojoList = documentTemplatePropertiesUpdateRequestConverter.toPojo(request);
|
List<DocumentTemplateProperty> pojoList = documentTemplatePropertiesUpdateRequestConverter.toPojo(request);
|
||||||
documentTemplatePropertyDao.batchInsertOnDuplicateKeyUpdateValue(pojoList);
|
documentTemplatePropertyDao.batchInsertOnDuplicateKeyUpdateValue(pojoList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,23 +2,23 @@ package com.databasir.core.domain.group.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.group.data.GroupCreateRequest;
|
import com.databasir.core.domain.group.data.GroupCreateRequest;
|
||||||
import com.databasir.core.domain.group.data.GroupUpdateRequest;
|
import com.databasir.core.domain.group.data.GroupUpdateRequest;
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
import com.databasir.dao.tables.pojos.Group;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface GroupPojoConverter {
|
public interface GroupConverter {
|
||||||
|
|
||||||
@Mapping(target = "id", ignore = true)
|
@Mapping(target = "id", ignore = true)
|
||||||
@Mapping(target = "deleted", ignore = true)
|
@Mapping(target = "deleted", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
@Mapping(target = "updateAt", ignore = true)
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
GroupPojo of(GroupCreateRequest groupCreateRequest);
|
Group of(GroupCreateRequest groupCreateRequest);
|
||||||
|
|
||||||
@Mapping(target = "deleted", ignore = true)
|
@Mapping(target = "deleted", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
@Mapping(target = "updateAt", ignore = true)
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
GroupPojo of(GroupUpdateRequest groupUpdateRequest);
|
Group of(GroupUpdateRequest groupUpdateRequest);
|
||||||
|
|
||||||
default String nullToEmpty(String description) {
|
default String nullToEmpty(String description) {
|
||||||
return description == null ? "" : description;
|
return description == null ? "" : description;
|
|
@ -3,8 +3,8 @@ package com.databasir.core.domain.group.converter;
|
||||||
import com.databasir.core.domain.group.data.GroupMemberPageResponse;
|
import com.databasir.core.domain.group.data.GroupMemberPageResponse;
|
||||||
import com.databasir.core.domain.group.data.GroupPageResponse;
|
import com.databasir.core.domain.group.data.GroupPageResponse;
|
||||||
import com.databasir.core.domain.group.data.GroupResponse;
|
import com.databasir.core.domain.group.data.GroupResponse;
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
import com.databasir.dao.tables.pojos.Group;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.value.GroupMemberDetailPojo;
|
import com.databasir.dao.value.GroupMemberDetailPojo;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import java.util.stream.Collectors;
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface GroupResponseConverter {
|
public interface GroupResponseConverter {
|
||||||
|
|
||||||
default List<GroupPageResponse> toResponse(List<GroupPojo> pojos,
|
default List<GroupPageResponse> toResponse(List<Group> pojos,
|
||||||
Map<Integer, List<String>> groupOwnerGroupByGroupId,
|
Map<Integer, List<String>> groupOwnerGroupByGroupId,
|
||||||
Map<Integer, Integer> projectCountMapByGroupId) {
|
Map<Integer, Integer> projectCountMapByGroupId) {
|
||||||
return pojos.stream()
|
return pojos.stream()
|
||||||
|
@ -29,11 +29,11 @@ public interface GroupResponseConverter {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupPageResponse toResponse(GroupPojo groupPojo,
|
GroupPageResponse toResponse(Group group,
|
||||||
List<String> groupOwnerNames,
|
List<String> groupOwnerNames,
|
||||||
Integer projectCount);
|
Integer projectCount);
|
||||||
|
|
||||||
GroupResponse toResponse(GroupPojo groupPojo, List<UserPojo> groupOwners);
|
GroupResponse toResponse(Group group, List<User> groupOwners);
|
||||||
|
|
||||||
GroupMemberPageResponse toResponse(GroupMemberDetailPojo data);
|
GroupMemberPageResponse toResponse(GroupMemberDetailPojo data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.domain.group.service;
|
package com.databasir.core.domain.group.service;
|
||||||
|
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.group.converter.GroupPojoConverter;
|
import com.databasir.core.domain.group.converter.GroupConverter;
|
||||||
import com.databasir.core.domain.group.converter.GroupResponseConverter;
|
import com.databasir.core.domain.group.converter.GroupResponseConverter;
|
||||||
import com.databasir.core.domain.group.data.*;
|
import com.databasir.core.domain.group.data.*;
|
||||||
import com.databasir.core.domain.group.event.GroupCreated;
|
import com.databasir.core.domain.group.event.GroupCreated;
|
||||||
|
@ -9,9 +9,9 @@ import com.databasir.core.domain.group.event.GroupDeleted;
|
||||||
import com.databasir.core.domain.group.event.GroupUpdated;
|
import com.databasir.core.domain.group.event.GroupUpdated;
|
||||||
import com.databasir.core.infrastructure.event.EventPublisher;
|
import com.databasir.core.infrastructure.event.EventPublisher;
|
||||||
import com.databasir.dao.impl.*;
|
import com.databasir.dao.impl.*;
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
import com.databasir.dao.tables.pojos.Group;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import com.databasir.dao.value.GroupMemberSimplePojo;
|
import com.databasir.dao.value.GroupMemberSimplePojo;
|
||||||
import com.databasir.dao.value.GroupProjectCountPojo;
|
import com.databasir.dao.value.GroupProjectCountPojo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
@ -42,18 +42,18 @@ public class GroupService {
|
||||||
|
|
||||||
private final ProjectSyncRuleDao projectSyncRuleDao;
|
private final ProjectSyncRuleDao projectSyncRuleDao;
|
||||||
|
|
||||||
private final GroupPojoConverter groupPojoConverter;
|
private final GroupConverter groupConverter;
|
||||||
|
|
||||||
private final GroupResponseConverter groupResponseConverter;
|
private final GroupResponseConverter groupResponseConverter;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Integer create(GroupCreateRequest request) {
|
public Integer create(GroupCreateRequest request) {
|
||||||
GroupPojo groupPojo = groupPojoConverter.of(request);
|
Group group = groupConverter.of(request);
|
||||||
Integer groupId = groupDao.insertAndReturnId(groupPojo);
|
Integer groupId = groupDao.insertAndReturnId(group);
|
||||||
List<UserRolePojo> roles = request.getGroupOwnerUserIds()
|
List<UserRole> roles = request.getGroupOwnerUserIds()
|
||||||
.stream()
|
.stream()
|
||||||
.map(userId -> {
|
.map(userId -> {
|
||||||
UserRolePojo role = new UserRolePojo();
|
UserRole role = new UserRole();
|
||||||
role.setUserId(userId);
|
role.setUserId(userId);
|
||||||
role.setRole(GROUP_OWNER);
|
role.setRole(GROUP_OWNER);
|
||||||
role.setGroupId(groupId);
|
role.setGroupId(groupId);
|
||||||
|
@ -67,16 +67,16 @@ public class GroupService {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void update(GroupUpdateRequest request) {
|
public void update(GroupUpdateRequest request) {
|
||||||
GroupPojo groupPojo = groupPojoConverter.of(request);
|
Group group = groupConverter.of(request);
|
||||||
groupDao.updateById(groupPojo);
|
groupDao.updateById(group);
|
||||||
userRoleDao.deleteByRoleAndGroupId(GROUP_OWNER, groupPojo.getId());
|
userRoleDao.deleteByRoleAndGroupId(GROUP_OWNER, group.getId());
|
||||||
List<UserRolePojo> roles = request.getGroupOwnerUserIds()
|
List<UserRole> roles = request.getGroupOwnerUserIds()
|
||||||
.stream()
|
.stream()
|
||||||
.map(userId -> {
|
.map(userId -> {
|
||||||
UserRolePojo role = new UserRolePojo();
|
UserRole role = new UserRole();
|
||||||
role.setUserId(userId);
|
role.setUserId(userId);
|
||||||
role.setRole(GROUP_OWNER);
|
role.setRole(GROUP_OWNER);
|
||||||
role.setGroupId(groupPojo.getId());
|
role.setGroupId(group.getId());
|
||||||
return role;
|
return role;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -94,10 +94,10 @@ public class GroupService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<GroupPageResponse> list(Pageable pageable, GroupPageCondition condition) {
|
public Page<GroupPageResponse> list(Pageable pageable, GroupPageCondition condition) {
|
||||||
Page<GroupPojo> page = groupDao.selectByPage(pageable, condition.toCondition());
|
Page<Group> page = groupDao.selectByPage(pageable, condition.toCondition());
|
||||||
List<Integer> groupIdList = page.getContent()
|
List<Integer> groupIdList = page.getContent()
|
||||||
.stream()
|
.stream()
|
||||||
.map(GroupPojo::getId)
|
.map(Group::getId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
var ownersGroupByGroupId = userRoleDao.selectOwnerNamesByGroupIdIn(groupIdList)
|
var ownersGroupByGroupId = userRoleDao.selectOwnerNamesByGroupIdIn(groupIdList)
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -105,15 +105,15 @@ public class GroupService {
|
||||||
var 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(group -> {
|
||||||
Integer groupId = groupPojo.getId();
|
Integer groupId = group.getId();
|
||||||
List<String> owners = ownersGroupByGroupId.getOrDefault(groupId, new ArrayList<>())
|
List<String> owners = ownersGroupByGroupId.getOrDefault(groupId, new ArrayList<>())
|
||||||
.stream()
|
.stream()
|
||||||
.map(GroupMemberSimplePojo::getNickname)
|
.map(GroupMemberSimplePojo::getNickname)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
GroupProjectCountPojo countPojo = projectCountMapByGroupId.get(groupId);
|
GroupProjectCountPojo countPojo = projectCountMapByGroupId.get(groupId);
|
||||||
Integer projectCount = countPojo == null ? 0 : countPojo.getCount();
|
Integer projectCount = countPojo == null ? 0 : countPojo.getCount();
|
||||||
return groupResponseConverter.toResponse(groupPojo, owners, projectCount);
|
return groupResponseConverter.toResponse(group, owners, projectCount);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +125,9 @@ public class GroupService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupResponse get(Integer groupId) {
|
public GroupResponse get(Integer groupId) {
|
||||||
GroupPojo groupPojo = groupDao.selectById(groupId);
|
Group group = groupDao.selectById(groupId);
|
||||||
List<UserPojo> users = userDao.selectLimitUsersByRoleAndGroup(groupId, GROUP_OWNER, 50);
|
List<User> users = userDao.selectLimitUsersByRoleAndGroup(groupId, GROUP_OWNER, 50);
|
||||||
return groupResponseConverter.toResponse(groupPojo, users);
|
return groupResponseConverter.toResponse(group, users);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMember(Integer groupId, Integer userId) {
|
public void removeMember(Integer groupId, Integer userId) {
|
||||||
|
@ -138,7 +138,7 @@ public class GroupService {
|
||||||
if (userRoleDao.hasRole(request.getUserId(), groupId)) {
|
if (userRoleDao.hasRole(request.getUserId(), groupId)) {
|
||||||
throw DomainErrors.USER_ROLE_DUPLICATE.exception();
|
throw DomainErrors.USER_ROLE_DUPLICATE.exception();
|
||||||
}
|
}
|
||||||
UserRolePojo pojo = new UserRolePojo();
|
UserRole pojo = new UserRole();
|
||||||
pojo.setGroupId(groupId);
|
pojo.setGroupId(groupId);
|
||||||
pojo.setUserId(request.getUserId());
|
pojo.setUserId(request.getUserId());
|
||||||
pojo.setRole(request.getRole());
|
pojo.setRole(request.getRole());
|
||||||
|
@ -149,7 +149,7 @@ public class GroupService {
|
||||||
if (!userRoleDao.hasRole(userId, groupId, role)) {
|
if (!userRoleDao.hasRole(userId, groupId, role)) {
|
||||||
// TODO 最多 20 个组长
|
// TODO 最多 20 个组长
|
||||||
userRoleDao.deleteByUserIdAndGroupId(userId, groupId);
|
userRoleDao.deleteByUserIdAndGroupId(userId, groupId);
|
||||||
UserRolePojo pojo = new UserRolePojo();
|
UserRole pojo = new UserRole();
|
||||||
pojo.setUserId(userId);
|
pojo.setUserId(userId);
|
||||||
pojo.setGroupId(groupId);
|
pojo.setGroupId(groupId);
|
||||||
pojo.setRole(role);
|
pojo.setRole(role);
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.databasir.core.domain.log.converter;
|
||||||
|
|
||||||
|
import com.databasir.core.domain.log.data.OperationLogPageResponse;
|
||||||
|
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||||
|
import com.databasir.dao.tables.pojos.Group;
|
||||||
|
import com.databasir.dao.tables.pojos.OperationLog;
|
||||||
|
import com.databasir.dao.tables.pojos.Project;
|
||||||
|
import com.databasir.dao.tables.pojos.User;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mapper(componentModel = "spring", uses = JsonConverter.class)
|
||||||
|
public interface OperationLogConverter {
|
||||||
|
|
||||||
|
@Mapping(target = "id", source = "pojo.id")
|
||||||
|
@Mapping(target = "createAt", source = "pojo.createAt")
|
||||||
|
OperationLogPageResponse to(OperationLog pojo,
|
||||||
|
Group involvedGroup,
|
||||||
|
User involvedUser,
|
||||||
|
Project involvedProject);
|
||||||
|
|
||||||
|
default OperationLogPageResponse to(OperationLog operationLog,
|
||||||
|
Map<Integer, Group> groupMapById,
|
||||||
|
Map<Integer, User> userMapById,
|
||||||
|
Map<Integer, Project> projectMapById) {
|
||||||
|
Group group = null;
|
||||||
|
if (operationLog.getInvolvedGroupId() != null) {
|
||||||
|
group = groupMapById.get(operationLog.getInvolvedGroupId());
|
||||||
|
}
|
||||||
|
User user = null;
|
||||||
|
if (operationLog.getInvolvedUserId() != null) {
|
||||||
|
user = userMapById.get(operationLog.getInvolvedUserId());
|
||||||
|
}
|
||||||
|
Project project = null;
|
||||||
|
if (operationLog.getInvolvedProjectId() != null) {
|
||||||
|
project = projectMapById.get(operationLog.getInvolvedProjectId());
|
||||||
|
}
|
||||||
|
return to(operationLog, group, user, project);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,42 +0,0 @@
|
||||||
package com.databasir.core.domain.log.converter;
|
|
||||||
|
|
||||||
import com.databasir.core.domain.log.data.OperationLogPageResponse;
|
|
||||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
|
||||||
import com.databasir.dao.tables.pojos.OperationLogPojo;
|
|
||||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.Mapping;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Mapper(componentModel = "spring", uses = JsonConverter.class)
|
|
||||||
public interface OperationLogPojoConverter {
|
|
||||||
|
|
||||||
@Mapping(target = "id", source = "pojo.id")
|
|
||||||
@Mapping(target = "createAt", source = "pojo.createAt")
|
|
||||||
OperationLogPageResponse to(OperationLogPojo pojo,
|
|
||||||
GroupPojo involvedGroup,
|
|
||||||
UserPojo involvedUser,
|
|
||||||
ProjectPojo involvedProject);
|
|
||||||
|
|
||||||
default OperationLogPageResponse to(OperationLogPojo operationLogPojo,
|
|
||||||
Map<Integer, GroupPojo> groupMapById,
|
|
||||||
Map<Integer, UserPojo> userMapById,
|
|
||||||
Map<Integer, ProjectPojo> projectMapById) {
|
|
||||||
GroupPojo group = null;
|
|
||||||
if (operationLogPojo.getInvolvedGroupId() != null) {
|
|
||||||
group = groupMapById.get(operationLogPojo.getInvolvedGroupId());
|
|
||||||
}
|
|
||||||
UserPojo user = null;
|
|
||||||
if (operationLogPojo.getInvolvedUserId() != null) {
|
|
||||||
user = userMapById.get(operationLogPojo.getInvolvedUserId());
|
|
||||||
}
|
|
||||||
ProjectPojo project = null;
|
|
||||||
if (operationLogPojo.getInvolvedProjectId() != null) {
|
|
||||||
project = projectMapById.get(operationLogPojo.getInvolvedProjectId());
|
|
||||||
}
|
|
||||||
return to(operationLogPojo, group, user, project);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,12 +2,12 @@ package com.databasir.core.domain.log.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.log.data.OperationLogRequest;
|
import com.databasir.core.domain.log.data.OperationLogRequest;
|
||||||
import com.databasir.core.infrastructure.converter.JsonConverter;
|
import com.databasir.core.infrastructure.converter.JsonConverter;
|
||||||
import com.databasir.dao.tables.pojos.OperationLogPojo;
|
import com.databasir.dao.tables.pojos.OperationLog;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring", uses = JsonConverter.class)
|
@Mapper(componentModel = "spring", uses = JsonConverter.class)
|
||||||
public interface OperationLogRequestConverter {
|
public interface OperationLogRequestConverter {
|
||||||
|
|
||||||
OperationLogPojo toPojo(OperationLogRequest request);
|
OperationLog toPojo(OperationLogRequest request);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.databasir.core.domain.log.service;
|
||||||
|
|
||||||
import com.databasir.common.JsonData;
|
import com.databasir.common.JsonData;
|
||||||
import com.databasir.core.domain.log.annotation.AuditLog;
|
import com.databasir.core.domain.log.annotation.AuditLog;
|
||||||
import com.databasir.core.domain.log.converter.OperationLogPojoConverter;
|
import com.databasir.core.domain.log.converter.OperationLogConverter;
|
||||||
import com.databasir.core.domain.log.converter.OperationLogRequestConverter;
|
import com.databasir.core.domain.log.converter.OperationLogRequestConverter;
|
||||||
import com.databasir.core.domain.log.data.OperationLogPageCondition;
|
import com.databasir.core.domain.log.data.OperationLogPageCondition;
|
||||||
import com.databasir.core.domain.log.data.OperationLogPageResponse;
|
import com.databasir.core.domain.log.data.OperationLogPageResponse;
|
||||||
|
@ -11,10 +11,10 @@ import com.databasir.dao.impl.GroupDao;
|
||||||
import com.databasir.dao.impl.OperationLogDao;
|
import com.databasir.dao.impl.OperationLogDao;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
import com.databasir.dao.tables.pojos.Group;
|
||||||
import com.databasir.dao.tables.pojos.OperationLogPojo;
|
import com.databasir.dao.tables.pojos.OperationLog;
|
||||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
import com.databasir.dao.tables.pojos.Project;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
@ -42,10 +42,10 @@ public class OperationLogService {
|
||||||
|
|
||||||
private final OperationLogRequestConverter operationLogRequestConverter;
|
private final OperationLogRequestConverter operationLogRequestConverter;
|
||||||
|
|
||||||
private final OperationLogPojoConverter operationLogPojoConverter;
|
private final OperationLogConverter operationLogConverter;
|
||||||
|
|
||||||
public Long save(OperationLogRequest request) {
|
public Long save(OperationLogRequest request) {
|
||||||
OperationLogPojo pojo = operationLogRequestConverter.toPojo(request);
|
OperationLog pojo = operationLogRequestConverter.toPojo(request);
|
||||||
return operationLogDao.insertAndReturnId(pojo);
|
return operationLogDao.insertAndReturnId(pojo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,14 +62,14 @@ public class OperationLogService {
|
||||||
.operatorUserId(-1)
|
.operatorUserId(-1)
|
||||||
.operationResponse(result)
|
.operationResponse(result)
|
||||||
.build();
|
.build();
|
||||||
OperationLogPojo pojo = operationLogRequestConverter.toPojo(log);
|
OperationLog pojo = operationLogRequestConverter.toPojo(log);
|
||||||
operationLogDao.insertAndReturnId(pojo);
|
operationLogDao.insertAndReturnId(pojo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("保存登录日志失败", e);
|
log.error("保存登录日志失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveLoginLog(UserPojo user, Boolean success, String msg) {
|
public void saveLoginLog(User user, Boolean success, String msg) {
|
||||||
try {
|
try {
|
||||||
JsonData result;
|
JsonData result;
|
||||||
if (success) {
|
if (success) {
|
||||||
|
@ -88,7 +88,7 @@ public class OperationLogService {
|
||||||
.operatorUserId(user.getId())
|
.operatorUserId(user.getId())
|
||||||
.operationResponse(result)
|
.operationResponse(result)
|
||||||
.build();
|
.build();
|
||||||
OperationLogPojo pojo = operationLogRequestConverter.toPojo(log);
|
OperationLog pojo = operationLogRequestConverter.toPojo(log);
|
||||||
operationLogDao.insertAndReturnId(pojo);
|
operationLogDao.insertAndReturnId(pojo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("保存登录日志失败", e);
|
log.error("保存登录日志失败", e);
|
||||||
|
@ -97,27 +97,27 @@ public class OperationLogService {
|
||||||
|
|
||||||
public Page<OperationLogPageResponse> list(Pageable page,
|
public Page<OperationLogPageResponse> list(Pageable page,
|
||||||
OperationLogPageCondition condition) {
|
OperationLogPageCondition condition) {
|
||||||
Page<OperationLogPojo> pojoData = operationLogDao.selectByPage(page, condition.toCondition());
|
Page<OperationLog> pojoData = operationLogDao.selectByPage(page, condition.toCondition());
|
||||||
List<Integer> groupIds = pojoData.filter(p -> p.getInvolvedGroupId() != null)
|
List<Integer> groupIds = pojoData.filter(p -> p.getInvolvedGroupId() != null)
|
||||||
.map(OperationLogPojo::getInvolvedGroupId)
|
.map(OperationLog::getInvolvedGroupId)
|
||||||
.toList();
|
.toList();
|
||||||
Map<Integer, GroupPojo> groupMapById = groupDao.selectAllInIds(groupIds)
|
Map<Integer, Group> groupMapById = groupDao.selectAllInIds(groupIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(GroupPojo::getId, Function.identity()));
|
.collect(Collectors.toMap(Group::getId, Function.identity()));
|
||||||
|
|
||||||
List<Integer> userIds = pojoData.filter(p -> p.getInvolvedUserId() != null)
|
List<Integer> userIds = pojoData.filter(p -> p.getInvolvedUserId() != null)
|
||||||
.map(OperationLogPojo::getInvolvedUserId)
|
.map(OperationLog::getInvolvedUserId)
|
||||||
.toList();
|
.toList();
|
||||||
Map<Integer, UserPojo> userMapById = userDao.selectInIds(userIds)
|
Map<Integer, User> userMapById = userDao.selectInIds(userIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(UserPojo::getId, Function.identity()));
|
.collect(Collectors.toMap(User::getId, Function.identity()));
|
||||||
|
|
||||||
List<Integer> projectIds = pojoData.filter(p -> p.getInvolvedProjectId() != null)
|
List<Integer> projectIds = pojoData.filter(p -> p.getInvolvedProjectId() != null)
|
||||||
.map(OperationLogPojo::getInvolvedProjectId)
|
.map(OperationLog::getInvolvedProjectId)
|
||||||
.toList();
|
.toList();
|
||||||
Map<Integer, ProjectPojo> projectMapById = projectDao.selectInIds(projectIds)
|
Map<Integer, Project> projectMapById = projectDao.selectInIds(projectIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(ProjectPojo::getId, Function.identity()));
|
.collect(Collectors.toMap(Project::getId, Function.identity()));
|
||||||
return pojoData.map(pojo -> operationLogPojoConverter.to(pojo, groupMapById, userMapById, projectMapById));
|
return pojoData.map(pojo -> operationLogConverter.to(pojo, groupMapById, userMapById, projectMapById));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ import com.databasir.core.infrastructure.jwt.JwtTokens;
|
||||||
import com.databasir.dao.impl.LoginDao;
|
import com.databasir.dao.impl.LoginDao;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.impl.UserRoleDao;
|
import com.databasir.dao.impl.UserRoleDao;
|
||||||
import com.databasir.dao.tables.pojos.LoginPojo;
|
import com.databasir.dao.tables.pojos.Login;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -39,7 +39,7 @@ public class LoginService {
|
||||||
private final JwtTokens jwtTokens;
|
private final JwtTokens jwtTokens;
|
||||||
|
|
||||||
public AccessTokenRefreshResponse refreshAccessTokens(AccessTokenRefreshRequest request) {
|
public AccessTokenRefreshResponse refreshAccessTokens(AccessTokenRefreshRequest request) {
|
||||||
LoginPojo login = loginDao.selectByRefreshToken(request.getRefreshToken())
|
Login login = loginDao.selectByRefreshToken(request.getRefreshToken())
|
||||||
.orElseThrow(DomainErrors.INVALID_REFRESH_TOKEN_OPERATION::exception);
|
.orElseThrow(DomainErrors.INVALID_REFRESH_TOKEN_OPERATION::exception);
|
||||||
// refresh-token 已过期
|
// refresh-token 已过期
|
||||||
if (login.getRefreshTokenExpireAt().isBefore(LocalDateTime.now())) {
|
if (login.getRefreshTokenExpireAt().isBefore(LocalDateTime.now())) {
|
||||||
|
@ -54,7 +54,7 @@ public class LoginService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// refresh-token 对应的用户已被删除
|
// refresh-token 对应的用户已被删除
|
||||||
UserPojo user = userDao.selectOptionalById(login.getUserId())
|
User user = userDao.selectOptionalById(login.getUserId())
|
||||||
.orElseThrow(() -> {
|
.orElseThrow(() -> {
|
||||||
log.warn("user not exists but refresh token exists for " + login.getRefreshToken());
|
log.warn("user not exists but refresh token exists for " + login.getRefreshToken());
|
||||||
return DomainErrors.INVALID_REFRESH_TOKEN_OPERATION.exception("invalid user");
|
return DomainErrors.INVALID_REFRESH_TOKEN_OPERATION.exception("invalid user");
|
||||||
|
@ -72,19 +72,19 @@ public class LoginService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginKeyResponse generate(Integer userId) {
|
public LoginKeyResponse generate(Integer userId) {
|
||||||
UserPojo user = userDao.selectById(userId);
|
User user = userDao.selectById(userId);
|
||||||
String accessToken = jwtTokens.accessToken(user.getEmail());
|
String accessToken = jwtTokens.accessToken(user.getEmail());
|
||||||
LocalDateTime accessTokenExpireAt = jwtTokens.expireAt(accessToken);
|
LocalDateTime accessTokenExpireAt = jwtTokens.expireAt(accessToken);
|
||||||
String refreshToken = UUID.randomUUID().toString().replace("-", "");
|
String refreshToken = UUID.randomUUID().toString().replace("-", "");
|
||||||
LocalDateTime refreshTokenExpireAt = LocalDateTime.now().plusDays(15);
|
LocalDateTime refreshTokenExpireAt = LocalDateTime.now().plusDays(15);
|
||||||
|
|
||||||
LoginPojo loginPojo = new LoginPojo();
|
Login login = new Login();
|
||||||
loginPojo.setAccessToken(accessToken);
|
login.setAccessToken(accessToken);
|
||||||
loginPojo.setAccessTokenExpireAt(accessTokenExpireAt);
|
login.setAccessTokenExpireAt(accessTokenExpireAt);
|
||||||
loginPojo.setRefreshToken(refreshToken);
|
login.setRefreshToken(refreshToken);
|
||||||
loginPojo.setRefreshTokenExpireAt(refreshTokenExpireAt);
|
login.setRefreshTokenExpireAt(refreshTokenExpireAt);
|
||||||
loginPojo.setUserId(userId);
|
login.setUserId(userId);
|
||||||
loginDao.insertOnDuplicateKeyUpdate(loginPojo);
|
loginDao.insertOnDuplicateKeyUpdate(login);
|
||||||
|
|
||||||
return LoginKeyResponse.builder()
|
return LoginKeyResponse.builder()
|
||||||
.userId(userId)
|
.userId(userId)
|
||||||
|
@ -98,7 +98,7 @@ public class LoginService {
|
||||||
public Optional<UserLoginResponse> getUserLoginData(Integer userId) {
|
public Optional<UserLoginResponse> getUserLoginData(Integer userId) {
|
||||||
return loginDao.selectByUserId(userId)
|
return loginDao.selectByUserId(userId)
|
||||||
.map(login -> {
|
.map(login -> {
|
||||||
UserPojo user = userDao.selectById(login.getUserId());
|
User user = userDao.selectById(login.getUserId());
|
||||||
UserLoginResponse data = new UserLoginResponse();
|
UserLoginResponse data = new UserLoginResponse();
|
||||||
data.setId(user.getId());
|
data.setId(user.getId());
|
||||||
data.setNickname(user.getNickname());
|
data.setNickname(user.getNickname());
|
||||||
|
@ -110,7 +110,7 @@ public class LoginService {
|
||||||
.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
data.setAccessTokenExpireAt(expireAt);
|
data.setAccessTokenExpireAt(expireAt);
|
||||||
data.setRefreshToken(login.getRefreshToken());
|
data.setRefreshToken(login.getRefreshToken());
|
||||||
List<UserRolePojo> rolePojoList =
|
List<UserRole> rolePojoList =
|
||||||
userRoleDao.selectByUserIds(Collections.singletonList(user.getId()));
|
userRoleDao.selectByUserIds(Collections.singletonList(user.getId()));
|
||||||
List<UserLoginResponse.RoleResponse> roles = rolePojoList
|
List<UserLoginResponse.RoleResponse> roles = rolePojoList
|
||||||
.stream()
|
.stream()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.databasir.core.domain.mock;
|
package com.databasir.core.domain.mock;
|
||||||
|
|
||||||
import com.databasir.core.domain.mock.converter.MockDataRulePojoConverter;
|
import com.databasir.core.domain.mock.converter.MockDataRuleConverter;
|
||||||
import com.databasir.core.domain.mock.converter.MockDataRuleResponseConverter;
|
import com.databasir.core.domain.mock.converter.MockDataRuleResponseConverter;
|
||||||
import com.databasir.core.domain.mock.data.ColumnMockRuleSaveRequest;
|
import com.databasir.core.domain.mock.data.ColumnMockRuleSaveRequest;
|
||||||
import com.databasir.core.domain.mock.data.MockDataGenerateCondition;
|
import com.databasir.core.domain.mock.data.MockDataGenerateCondition;
|
||||||
|
@ -12,10 +12,10 @@ import com.databasir.core.domain.mock.validator.MockDataValidator;
|
||||||
import com.databasir.dao.enums.MockDataType;
|
import com.databasir.dao.enums.MockDataType;
|
||||||
import com.databasir.dao.impl.MockDataRuleDao;
|
import com.databasir.dao.impl.MockDataRuleDao;
|
||||||
import com.databasir.dao.impl.TableColumnDocumentDao;
|
import com.databasir.dao.impl.TableColumnDocumentDao;
|
||||||
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
|
import com.databasir.dao.tables.pojos.DatabaseDocument;
|
||||||
import com.databasir.dao.tables.pojos.MockDataRulePojo;
|
import com.databasir.dao.tables.pojos.MockDataRule;
|
||||||
import com.databasir.dao.tables.pojos.TableColumnDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableColumnDocument;
|
||||||
import com.databasir.dao.tables.pojos.TableDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableDocument;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ public class MockDataService {
|
||||||
|
|
||||||
private final TableColumnDocumentDao tableColumnDocumentDao;
|
private final TableColumnDocumentDao tableColumnDocumentDao;
|
||||||
|
|
||||||
private final MockDataRulePojoConverter mockDataRulePojoConverter;
|
private final MockDataRuleConverter mockDataRuleConverter;
|
||||||
|
|
||||||
private final MockDataRuleResponseConverter mockDataRuleResponseConverter;
|
private final MockDataRuleResponseConverter mockDataRuleResponseConverter;
|
||||||
|
|
||||||
|
@ -43,10 +43,10 @@ public class MockDataService {
|
||||||
|
|
||||||
public String generateMockInsertSql(Integer projectId, MockDataGenerateCondition condition) {
|
public String generateMockInsertSql(Integer projectId, MockDataGenerateCondition condition) {
|
||||||
mockDataValidator.validProject(projectId);
|
mockDataValidator.validProject(projectId);
|
||||||
DatabaseDocumentPojo databaseDoc =
|
DatabaseDocument databaseDoc =
|
||||||
mockDataValidator.validAndGetDatabaseDocumentPojo(projectId, condition.getVersion());
|
mockDataValidator.validAndGetDatabaseDocument(projectId, condition.getVersion());
|
||||||
TableDocumentPojo tableDoc =
|
TableDocument tableDoc =
|
||||||
mockDataValidator.validAndGetTableDocumentPojo(databaseDoc.getId(), condition.getTableId());
|
mockDataValidator.validAndGetTableDocument(databaseDoc.getId(), condition.getTableId());
|
||||||
return mockDataGenerator.createInsertSql(projectId, databaseDoc.getId(), tableDoc.getName());
|
return mockDataGenerator.createInsertSql(projectId, databaseDoc.getId(), tableDoc.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +54,10 @@ public class MockDataService {
|
||||||
Integer tableId,
|
Integer tableId,
|
||||||
List<ColumnMockRuleSaveRequest> rules) {
|
List<ColumnMockRuleSaveRequest> rules) {
|
||||||
mockDataValidator.validProject(projectId);
|
mockDataValidator.validProject(projectId);
|
||||||
DatabaseDocumentPojo doc =
|
DatabaseDocument doc =
|
||||||
mockDataValidator.validAndGetDatabaseDocumentPojo(projectId, null);
|
mockDataValidator.validAndGetDatabaseDocument(projectId, null);
|
||||||
TableDocumentPojo tableDoc =
|
TableDocument tableDoc =
|
||||||
mockDataValidator.validAndGetTableDocumentPojo(doc.getId(), tableId);
|
mockDataValidator.validAndGetTableDocument(doc.getId(), tableId);
|
||||||
List<String> columnNames = rules.stream()
|
List<String> columnNames = rules.stream()
|
||||||
.map(ColumnMockRuleSaveRequest::getColumnName)
|
.map(ColumnMockRuleSaveRequest::getColumnName)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -67,21 +67,21 @@ public class MockDataService {
|
||||||
// verify
|
// verify
|
||||||
mockDataGenerator.createInsertSql(projectId, doc.getId(), tableDoc.getName());
|
mockDataGenerator.createInsertSql(projectId, doc.getId(), tableDoc.getName());
|
||||||
|
|
||||||
List<MockDataRulePojo> pojo = mockDataRulePojoConverter.from(projectId, rules);
|
List<MockDataRule> pojo = mockDataRuleConverter.from(projectId, rules);
|
||||||
mockDataRuleDao.batchSave(pojo);
|
mockDataRuleDao.batchSave(pojo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MockDataRuleResponse> listRules(Integer projectId, MockDataRuleListCondition condition) {
|
public List<MockDataRuleResponse> listRules(Integer projectId, MockDataRuleListCondition condition) {
|
||||||
mockDataValidator.validProject(projectId);
|
mockDataValidator.validProject(projectId);
|
||||||
DatabaseDocumentPojo databaseDoc =
|
DatabaseDocument databaseDoc =
|
||||||
mockDataValidator.validAndGetDatabaseDocumentPojo(projectId, condition.getVersion());
|
mockDataValidator.validAndGetDatabaseDocument(projectId, condition.getVersion());
|
||||||
TableDocumentPojo tableDoc =
|
TableDocument tableDoc =
|
||||||
mockDataValidator.validAndGetTableDocumentPojo(databaseDoc.getId(), condition.getTableId());
|
mockDataValidator.validAndGetTableDocument(databaseDoc.getId(), condition.getTableId());
|
||||||
List<TableColumnDocumentPojo> columns =
|
List<TableColumnDocument> columns =
|
||||||
tableColumnDocumentDao.selectByTableDocumentId(condition.getTableId());
|
tableColumnDocumentDao.selectByTableDocumentId(condition.getTableId());
|
||||||
var ruleMapByColumnName = mockDataRuleDao.selectByProjectIdAndTableName(projectId, tableDoc.getName())
|
var ruleMapByColumnName = mockDataRuleDao.selectByProjectIdAndTableName(projectId, tableDoc.getName())
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(MockDataRulePojo::getColumnName, Function.identity()));
|
.collect(Collectors.toMap(MockDataRule::getColumnName, Function.identity()));
|
||||||
return columns.stream()
|
return columns.stream()
|
||||||
.map(col -> {
|
.map(col -> {
|
||||||
if (ruleMapByColumnName.containsKey(col.getName())) {
|
if (ruleMapByColumnName.containsKey(col.getName())) {
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
package com.databasir.core.domain.mock.converter;
|
package com.databasir.core.domain.mock.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.mock.data.ColumnMockRuleSaveRequest;
|
import com.databasir.core.domain.mock.data.ColumnMockRuleSaveRequest;
|
||||||
import com.databasir.dao.tables.pojos.MockDataRulePojo;
|
import com.databasir.dao.tables.pojos.MockDataRule;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface MockDataRulePojoConverter {
|
public interface MockDataRuleConverter {
|
||||||
|
|
||||||
MockDataRulePojo from(Integer projectId, ColumnMockRuleSaveRequest request);
|
MockDataRule from(Integer projectId, ColumnMockRuleSaveRequest request);
|
||||||
|
|
||||||
default List<MockDataRulePojo> from(Integer projectId, List<ColumnMockRuleSaveRequest> request) {
|
default List<MockDataRule> from(Integer projectId, List<ColumnMockRuleSaveRequest> request) {
|
||||||
return request.stream()
|
return request.stream()
|
||||||
.map(rule -> from(projectId, rule))
|
.map(rule -> from(projectId, rule))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
|
@ -2,8 +2,8 @@ package com.databasir.core.domain.mock.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.mock.data.MockDataRuleResponse;
|
import com.databasir.core.domain.mock.data.MockDataRuleResponse;
|
||||||
import com.databasir.dao.enums.MockDataType;
|
import com.databasir.dao.enums.MockDataType;
|
||||||
import com.databasir.dao.tables.pojos.MockDataRulePojo;
|
import com.databasir.dao.tables.pojos.MockDataRule;
|
||||||
import com.databasir.dao.tables.pojos.TableColumnDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableColumnDocument;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ import org.mapstruct.Mapping;
|
||||||
public interface MockDataRuleResponseConverter {
|
public interface MockDataRuleResponseConverter {
|
||||||
|
|
||||||
@Mapping(target = "columnType", source = "column.type")
|
@Mapping(target = "columnType", source = "column.type")
|
||||||
MockDataRuleResponse from(MockDataRulePojo pojo, TableColumnDocumentPojo column);
|
MockDataRuleResponse from(MockDataRule pojo, TableColumnDocument column);
|
||||||
|
|
||||||
@Mapping(target = "columnName", source = "pojo.name")
|
@Mapping(target = "columnName", source = "pojo.name")
|
||||||
@Mapping(target = "columnType", source = "pojo.type")
|
@Mapping(target = "columnType", source = "pojo.type")
|
||||||
MockDataRuleResponse from(String tableName, MockDataType mockDataType, TableColumnDocumentPojo pojo);
|
MockDataRuleResponse from(String tableName, MockDataType mockDataType, TableColumnDocument pojo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.databasir.core.domain.mock.generator;
|
||||||
|
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.dao.exception.DataNotExistsException;
|
import com.databasir.dao.exception.DataNotExistsException;
|
||||||
import com.databasir.dao.tables.pojos.MockDataRulePojo;
|
import com.databasir.dao.tables.pojos.MockDataRule;
|
||||||
import com.databasir.dao.tables.pojos.TableColumnDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableColumnDocument;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@ -29,17 +29,17 @@ public class MockDataContext {
|
||||||
private Map<String, Set<String>> toReference = new LinkedHashMap<>();
|
private Map<String, Set<String>> toReference = new LinkedHashMap<>();
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private Map<String, Map<String, MockDataRulePojo>> ruleMap = new LinkedHashMap<>(16);
|
private Map<String, Map<String, MockDataRule>> ruleMap = new LinkedHashMap<>(16);
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private Map<String, Map<String, TableColumnDocumentPojo>> tableColumnMap = new LinkedHashMap<>(16);
|
private Map<String, Map<String, TableColumnDocument>> tableColumnMap = new LinkedHashMap<>(16);
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private Map<String, Set<String>> mockInProgress = new HashMap<>();
|
private Map<String, Set<String>> mockInProgress = new HashMap<>();
|
||||||
|
|
||||||
public void addTableMockRules(String tableName, List<MockDataRulePojo> rules) {
|
public void addTableMockRules(String tableName, List<MockDataRule> rules) {
|
||||||
var columnRuleMap = rules.stream()
|
var columnRuleMap = rules.stream()
|
||||||
.collect(Collectors.toMap(MockDataRulePojo::getColumnName, Function.identity()));
|
.collect(Collectors.toMap(MockDataRule::getColumnName, Function.identity()));
|
||||||
this.ruleMap.put(tableName, columnRuleMap);
|
this.ruleMap.put(tableName, columnRuleMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,16 +54,16 @@ public class MockDataContext {
|
||||||
return ruleMap.get(tableName).containsKey(columnName);
|
return ruleMap.get(tableName).containsKey(columnName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<MockDataRulePojo> getMockRule(String tableName, String columnName) {
|
public Optional<MockDataRule> getMockRule(String tableName, String columnName) {
|
||||||
if (!ruleMap.containsKey(tableName)) {
|
if (!ruleMap.containsKey(tableName)) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
return Optional.ofNullable(ruleMap.get(tableName).get(columnName));
|
return Optional.ofNullable(ruleMap.get(tableName).get(columnName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTableColumns(String tableName, List<TableColumnDocumentPojo> columns) {
|
public void addTableColumns(String tableName, List<TableColumnDocument> columns) {
|
||||||
Map<String, TableColumnDocumentPojo> columnMap = new LinkedHashMap<>();
|
Map<String, TableColumnDocument> columnMap = new LinkedHashMap<>();
|
||||||
for (TableColumnDocumentPojo column : columns) {
|
for (TableColumnDocument column : columns) {
|
||||||
columnMap.put(column.getName(), column);
|
columnMap.put(column.getName(), column);
|
||||||
}
|
}
|
||||||
this.tableColumnMap.put(tableName, columnMap);
|
this.tableColumnMap.put(tableName, columnMap);
|
||||||
|
@ -80,7 +80,7 @@ public class MockDataContext {
|
||||||
return tableColumnMap.get(tableName).containsKey(columnName);
|
return tableColumnMap.get(tableName).containsKey(columnName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TableColumnDocumentPojo getTableColumn(String tableName, String columnName) {
|
public TableColumnDocument getTableColumn(String tableName, String columnName) {
|
||||||
if (!tableColumnMap.containsKey(tableName)) {
|
if (!tableColumnMap.containsKey(tableName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.databasir.dao.impl.MockDataRuleDao;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.impl.TableColumnDocumentDao;
|
import com.databasir.dao.impl.TableColumnDocumentDao;
|
||||||
import com.databasir.dao.impl.TableDocumentDao;
|
import com.databasir.dao.impl.TableDocumentDao;
|
||||||
import com.databasir.dao.tables.pojos.MockDataRulePojo;
|
import com.databasir.dao.tables.pojos.MockDataRule;
|
||||||
import com.databasir.dao.tables.pojos.TableColumnDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableColumnDocument;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
@ -63,7 +63,7 @@ public class MockDataGenerator {
|
||||||
context.addTableMockRules(tableName, columnRules);
|
context.addTableMockRules(tableName, columnRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TableColumnDocumentPojo column : context.getTableColumnMap().get(tableName).values()) {
|
for (TableColumnDocument column : context.getTableColumnMap().get(tableName).values()) {
|
||||||
if (context.containsColumnMockData(tableName, column.getName())
|
if (context.containsColumnMockData(tableName, column.getName())
|
||||||
|| context.isMockInProgress(tableName, column.getName())) {
|
|| context.isMockInProgress(tableName, column.getName())) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -76,11 +76,11 @@ public class MockDataGenerator {
|
||||||
if (context.containsColumnMockData(tableName, columnName)) {
|
if (context.containsColumnMockData(tableName, columnName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TableColumnDocumentPojo column = context.getTableColumn(tableName, columnName);
|
TableColumnDocument column = context.getTableColumn(tableName, columnName);
|
||||||
Optional<MockDataRulePojo> ruleOption = context.getMockRule(tableName, columnName);
|
Optional<MockDataRule> ruleOption = context.getMockRule(tableName, columnName);
|
||||||
String rawData;
|
String rawData;
|
||||||
if (ruleOption.isPresent()) {
|
if (ruleOption.isPresent()) {
|
||||||
MockDataRulePojo rule = ruleOption.get();
|
MockDataRule rule = ruleOption.get();
|
||||||
if (rule.getMockDataType() == MockDataType.REF) {
|
if (rule.getMockDataType() == MockDataType.REF) {
|
||||||
context.addMockInProgress(tableName, columnName);
|
context.addMockInProgress(tableName, columnName);
|
||||||
context.saveReference(
|
context.saveReference(
|
||||||
|
@ -103,7 +103,7 @@ public class MockDataGenerator {
|
||||||
context.addColumnMockData(tableName, toData(rawData, column));
|
context.addColumnMockData(tableName, toData(rawData, column));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String createByFactory(TableColumnDocumentPojo column, MockDataRulePojo rule) {
|
private String createByFactory(TableColumnDocument column, MockDataRule rule) {
|
||||||
MockDataType mockType = rule == null ? MockDataType.AUTO : rule.getMockDataType();
|
MockDataType mockType = rule == null ? MockDataType.AUTO : rule.getMockDataType();
|
||||||
MockColumnRule colRule = MockColumnRule.builder()
|
MockColumnRule colRule = MockColumnRule.builder()
|
||||||
.dataType(column.getDataType())
|
.dataType(column.getDataType())
|
||||||
|
@ -119,7 +119,7 @@ public class MockDataGenerator {
|
||||||
.orElseThrow();
|
.orElseThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ColumnMockData toData(String data, TableColumnDocumentPojo column) {
|
private ColumnMockData toData(String data, TableColumnDocument column) {
|
||||||
return ColumnMockData.builder()
|
return ColumnMockData.builder()
|
||||||
.columnName(column.getName())
|
.columnName(column.getName())
|
||||||
.columnType(column.getType())
|
.columnType(column.getType())
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.databasir.core.domain.mock.script.SpelScriptEvaluator;
|
||||||
import com.databasir.dao.enums.MockDataType;
|
import com.databasir.dao.enums.MockDataType;
|
||||||
import com.databasir.dao.impl.TableColumnDocumentDao;
|
import com.databasir.dao.impl.TableColumnDocumentDao;
|
||||||
import com.databasir.dao.impl.TableDocumentDao;
|
import com.databasir.dao.impl.TableDocumentDao;
|
||||||
import com.databasir.dao.tables.pojos.TableColumnDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableColumnDocument;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class MockDataSaveValidator {
|
||||||
public void validTableColumn(Integer tableDocId, List<String> requestColumnNames) {
|
public void validTableColumn(Integer tableDocId, List<String> requestColumnNames) {
|
||||||
var existsColumnNames = tableColumnDocumentDao.selectByTableDocumentId(tableDocId)
|
var existsColumnNames = tableColumnDocumentDao.selectByTableDocumentId(tableDocId)
|
||||||
.stream()
|
.stream()
|
||||||
.map(TableColumnDocumentPojo::getName)
|
.map(TableColumnDocument::getName)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
for (String colName : requestColumnNames) {
|
for (String colName : requestColumnNames) {
|
||||||
if (!existsColumnNames.contains(colName)) {
|
if (!existsColumnNames.contains(colName)) {
|
||||||
|
|
|
@ -4,8 +4,8 @@ import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.dao.impl.DatabaseDocumentDao;
|
import com.databasir.dao.impl.DatabaseDocumentDao;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.impl.TableDocumentDao;
|
import com.databasir.dao.impl.TableDocumentDao;
|
||||||
import com.databasir.dao.tables.pojos.DatabaseDocumentPojo;
|
import com.databasir.dao.tables.pojos.DatabaseDocument;
|
||||||
import com.databasir.dao.tables.pojos.TableDocumentPojo;
|
import com.databasir.dao.tables.pojos.TableDocument;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ public class MockDataValidator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatabaseDocumentPojo validAndGetDatabaseDocumentPojo(Integer projectId, Long version) {
|
public DatabaseDocument validAndGetDatabaseDocument(Integer projectId, Long version) {
|
||||||
Optional<DatabaseDocumentPojo> databaseDoc;
|
Optional<DatabaseDocument> databaseDoc;
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
databaseDoc = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
databaseDoc = databaseDocumentDao.selectNotArchivedByProjectId(projectId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,8 +40,8 @@ public class MockDataValidator {
|
||||||
return databaseDoc.get();
|
return databaseDoc.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TableDocumentPojo validAndGetTableDocumentPojo(Integer databaseDocId, Integer tableId) {
|
public TableDocument validAndGetTableDocument(Integer databaseDocId, Integer tableId) {
|
||||||
Optional<TableDocumentPojo> tableOption =
|
Optional<TableDocument> tableOption =
|
||||||
tableDocumentDao.selectByDatabaseDocumentIdAndId(databaseDocId, tableId);
|
tableDocumentDao.selectByDatabaseDocumentIdAndId(databaseDocId, tableId);
|
||||||
if (tableOption.isEmpty()) {
|
if (tableOption.isEmpty()) {
|
||||||
throw DomainErrors.DATABASE_META_NOT_FOUND.exception("表数据不存在");
|
throw DomainErrors.DATABASE_META_NOT_FOUND.exception("表数据不存在");
|
||||||
|
|
|
@ -3,8 +3,8 @@ package com.databasir.core.domain.project.converter;
|
||||||
import com.databasir.core.domain.project.data.DataSourcePropertyValue;
|
import com.databasir.core.domain.project.data.DataSourcePropertyValue;
|
||||||
import com.databasir.core.domain.project.data.ProjectCreateRequest;
|
import com.databasir.core.domain.project.data.ProjectCreateRequest;
|
||||||
import com.databasir.core.domain.project.data.ProjectUpdateRequest;
|
import com.databasir.core.domain.project.data.ProjectUpdateRequest;
|
||||||
import com.databasir.dao.tables.pojos.DataSourcePojo;
|
import com.databasir.dao.tables.pojos.DataSource;
|
||||||
import com.databasir.dao.tables.pojos.DataSourcePropertyPojo;
|
import com.databasir.dao.tables.pojos.DataSourceProperty;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
@ -12,28 +12,28 @@ import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface DataSourcePojoConverter {
|
public interface DataSourceConverter {
|
||||||
|
|
||||||
@Mapping(target = "id", ignore = true)
|
@Mapping(target = "id", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
@Mapping(target = "updateAt", ignore = true)
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
@Mapping(target = "password", source = "password")
|
@Mapping(target = "password", source = "password")
|
||||||
DataSourcePojo of(ProjectCreateRequest.DataSourceCreateRequest request,
|
DataSource of(ProjectCreateRequest.DataSourceCreateRequest request,
|
||||||
String password,
|
String password,
|
||||||
Integer projectId);
|
Integer projectId);
|
||||||
|
|
||||||
@Mapping(target = "updateAt", ignore = true)
|
@Mapping(target = "updateAt", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
@Mapping(target = "password", source = "password")
|
@Mapping(target = "password", source = "password")
|
||||||
DataSourcePojo of(ProjectUpdateRequest.DataSourceUpdateRequest request,
|
DataSource of(ProjectUpdateRequest.DataSourceUpdateRequest request,
|
||||||
String password,
|
String password,
|
||||||
Integer projectId);
|
Integer projectId);
|
||||||
|
|
||||||
@Mapping(target = "id", ignore = true)
|
@Mapping(target = "id", ignore = true)
|
||||||
@Mapping(target = "createAt", ignore = true)
|
@Mapping(target = "createAt", ignore = true)
|
||||||
DataSourcePropertyPojo of(DataSourcePropertyValue propertyValues, Integer dataSourceId);
|
DataSourceProperty of(DataSourcePropertyValue propertyValues, Integer dataSourceId);
|
||||||
|
|
||||||
default List<DataSourcePropertyPojo> of(List<DataSourcePropertyValue> propertyValues,
|
default List<DataSourceProperty> of(List<DataSourcePropertyValue> propertyValues,
|
||||||
Integer dataSourceId) {
|
Integer dataSourceId) {
|
||||||
return propertyValues.stream().map(value -> of(value, dataSourceId)).collect(Collectors.toList());
|
return propertyValues.stream().map(value -> of(value, dataSourceId)).collect(Collectors.toList());
|
||||||
}
|
}
|
|
@ -3,8 +3,8 @@ 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.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.ProjectPojo;
|
import com.databasir.dao.tables.pojos.Project;
|
||||||
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo;
|
import com.databasir.dao.tables.pojos.ProjectSyncRule;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.ReportingPolicy;
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
@ -12,20 +12,20 @@ import org.mapstruct.ReportingPolicy;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = JsonConverter.class)
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = JsonConverter.class)
|
||||||
public interface ProjectPojoConverter {
|
public interface ProjectConverter {
|
||||||
|
|
||||||
ProjectPojo of(ProjectCreateRequest request);
|
Project of(ProjectCreateRequest request);
|
||||||
|
|
||||||
ProjectPojo of(ProjectUpdateRequest request);
|
Project of(ProjectUpdateRequest request);
|
||||||
|
|
||||||
@Mapping(target = "ignoreTableNameRegexArray", source = "request.ignoreTableNameRegexes")
|
@Mapping(target = "ignoreTableNameRegexArray", source = "request.ignoreTableNameRegexes")
|
||||||
@Mapping(target = "ignoreColumnNameRegexArray", source = "request.ignoreColumnNameRegexes")
|
@Mapping(target = "ignoreColumnNameRegexArray", source = "request.ignoreColumnNameRegexes")
|
||||||
ProjectSyncRulePojo of(ProjectCreateRequest.ProjectSyncRuleCreateRequest request,
|
ProjectSyncRule of(ProjectCreateRequest.ProjectSyncRuleCreateRequest request,
|
||||||
Integer projectId);
|
Integer projectId);
|
||||||
|
|
||||||
@Mapping(target = "ignoreTableNameRegexArray", source = "request.ignoreTableNameRegexes")
|
@Mapping(target = "ignoreTableNameRegexArray", source = "request.ignoreTableNameRegexes")
|
||||||
@Mapping(target = "ignoreColumnNameRegexArray", source = "request.ignoreColumnNameRegexes")
|
@Mapping(target = "ignoreColumnNameRegexArray", source = "request.ignoreColumnNameRegexes")
|
||||||
ProjectSyncRulePojo of(ProjectUpdateRequest.ProjectSyncRuleUpdateRequest request,
|
ProjectSyncRule of(ProjectUpdateRequest.ProjectSyncRuleUpdateRequest request,
|
||||||
Integer projectId);
|
Integer projectId);
|
||||||
|
|
||||||
default String optionToEmpty(Optional<String> optional) {
|
default String optionToEmpty(Optional<String> optional) {
|
|
@ -3,10 +3,10 @@ package com.databasir.core.domain.project.converter;
|
||||||
import com.databasir.core.domain.project.data.ProjectDetailResponse;
|
import com.databasir.core.domain.project.data.ProjectDetailResponse;
|
||||||
import com.databasir.core.domain.project.data.ProjectSimpleResponse;
|
import com.databasir.core.domain.project.data.ProjectSimpleResponse;
|
||||||
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.DataSource;
|
||||||
import com.databasir.dao.tables.pojos.DataSourcePropertyPojo;
|
import com.databasir.dao.tables.pojos.DataSourceProperty;
|
||||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
import com.databasir.dao.tables.pojos.Project;
|
||||||
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo;
|
import com.databasir.dao.tables.pojos.ProjectSyncRule;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.ReportingPolicy;
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
@ -18,21 +18,21 @@ public interface ProjectResponseConverter {
|
||||||
|
|
||||||
@Mapping(target = "id", source = "database.id")
|
@Mapping(target = "id", source = "database.id")
|
||||||
@Mapping(target = "createAt", source = "database.createAt")
|
@Mapping(target = "createAt", source = "database.createAt")
|
||||||
ProjectDetailResponse toResponse(ProjectPojo database,
|
ProjectDetailResponse toResponse(Project database,
|
||||||
ProjectDetailResponse.DataSourceResponse dataSource,
|
ProjectDetailResponse.DataSourceResponse dataSource,
|
||||||
ProjectDetailResponse.ProjectSyncRuleResponse projectSyncRule);
|
ProjectDetailResponse.ProjectSyncRuleResponse projectSyncRule);
|
||||||
|
|
||||||
ProjectDetailResponse.DataSourceResponse toResponse(DataSourcePojo dataSource,
|
ProjectDetailResponse.DataSourceResponse toResponse(DataSource dataSource,
|
||||||
List<DataSourcePropertyPojo> properties);
|
List<DataSourceProperty> properties);
|
||||||
|
|
||||||
@Mapping(target = "ignoreTableNameRegexes", source = "ignoreTableNameRegexArray")
|
@Mapping(target = "ignoreTableNameRegexes", source = "ignoreTableNameRegexArray")
|
||||||
@Mapping(target = "ignoreColumnNameRegexes", source = "ignoreColumnNameRegexArray")
|
@Mapping(target = "ignoreColumnNameRegexes", source = "ignoreColumnNameRegexArray")
|
||||||
ProjectDetailResponse.ProjectSyncRuleResponse toResponse(ProjectSyncRulePojo rule);
|
ProjectDetailResponse.ProjectSyncRuleResponse toResponse(ProjectSyncRule rule);
|
||||||
|
|
||||||
@Mapping(target = "id", source = "project.id")
|
@Mapping(target = "id", source = "project.id")
|
||||||
@Mapping(target = "createAt", source = "project.createAt")
|
@Mapping(target = "createAt", source = "project.createAt")
|
||||||
ProjectSimpleResponse toSimple(ProjectPojo project,
|
ProjectSimpleResponse toSimple(Project project,
|
||||||
DataSourcePojo dataSource,
|
DataSource dataSource,
|
||||||
ProjectSyncRulePojo syncRule,
|
ProjectSyncRule syncRule,
|
||||||
Boolean isFavorite);
|
Boolean isFavorite);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.domain.project.converter;
|
package com.databasir.core.domain.project.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.project.data.task.ProjectSimpleTaskResponse;
|
import com.databasir.core.domain.project.data.task.ProjectSimpleTaskResponse;
|
||||||
import com.databasir.dao.tables.pojos.ProjectSyncTaskPojo;
|
import com.databasir.dao.tables.pojos.ProjectSyncTask;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import java.util.List;
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface ProjectSimpleTaskResponseConverter {
|
public interface ProjectSimpleTaskResponseConverter {
|
||||||
|
|
||||||
List<ProjectSimpleTaskResponse> of(List<ProjectSyncTaskPojo> pojos);
|
List<ProjectSimpleTaskResponse> of(List<ProjectSyncTask> pojos);
|
||||||
|
|
||||||
@Mapping(target = "taskId", source = "id")
|
@Mapping(target = "taskId", source = "id")
|
||||||
ProjectSimpleTaskResponse of(ProjectSyncTaskPojo pojo);
|
ProjectSimpleTaskResponse of(ProjectSyncTask pojo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package com.databasir.core.domain.project.service;
|
||||||
|
|
||||||
import com.databasir.common.codec.Aes;
|
import com.databasir.common.codec.Aes;
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.project.converter.DataSourcePojoConverter;
|
import com.databasir.core.domain.project.converter.DataSourceConverter;
|
||||||
import com.databasir.core.domain.project.converter.ProjectPojoConverter;
|
import com.databasir.core.domain.project.converter.ProjectConverter;
|
||||||
import com.databasir.core.domain.project.converter.ProjectResponseConverter;
|
import com.databasir.core.domain.project.converter.ProjectResponseConverter;
|
||||||
import com.databasir.core.domain.project.converter.ProjectSimpleTaskResponseConverter;
|
import com.databasir.core.domain.project.converter.ProjectSimpleTaskResponseConverter;
|
||||||
import com.databasir.core.domain.project.data.*;
|
import com.databasir.core.domain.project.data.*;
|
||||||
|
@ -50,9 +50,9 @@ public class ProjectService {
|
||||||
|
|
||||||
private final ProjectSyncTaskDao projectSyncTaskDao;
|
private final ProjectSyncTaskDao projectSyncTaskDao;
|
||||||
|
|
||||||
private final DataSourcePojoConverter dataSourcePojoConverter;
|
private final DataSourceConverter dataSourceConverter;
|
||||||
|
|
||||||
private final ProjectPojoConverter projectPojoConverter;
|
private final ProjectConverter projectConverter;
|
||||||
|
|
||||||
private final ProjectResponseConverter projectResponseConverter;
|
private final ProjectResponseConverter projectResponseConverter;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class ProjectService {
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Integer create(ProjectCreateRequest request) {
|
public Integer create(ProjectCreateRequest request) {
|
||||||
ProjectPojo project = projectPojoConverter.of(request);
|
Project project = projectConverter.of(request);
|
||||||
Integer projectId = null;
|
Integer projectId = null;
|
||||||
try {
|
try {
|
||||||
projectId = projectDao.insertAndReturnId(project);
|
projectId = projectDao.insertAndReturnId(project);
|
||||||
|
@ -84,14 +84,14 @@ public class ProjectService {
|
||||||
}
|
}
|
||||||
|
|
||||||
String newPassword = encryptPassword(request.getDataSource().getPassword()).get();
|
String newPassword = encryptPassword(request.getDataSource().getPassword()).get();
|
||||||
DataSourcePojo dataSource = dataSourcePojoConverter.of(request.getDataSource(), newPassword, projectId);
|
DataSource dataSource = dataSourceConverter.of(request.getDataSource(), newPassword, projectId);
|
||||||
Integer dataSourceId = dataSourceDao.insertAndReturnId(dataSource);
|
Integer dataSourceId = dataSourceDao.insertAndReturnId(dataSource);
|
||||||
|
|
||||||
List<DataSourcePropertyValue> propertyValues = request.getDataSource().getProperties();
|
List<DataSourcePropertyValue> propertyValues = request.getDataSource().getProperties();
|
||||||
List<DataSourcePropertyPojo> properties = dataSourcePojoConverter.of(propertyValues, dataSourceId);
|
List<DataSourceProperty> properties = dataSourceConverter.of(propertyValues, dataSourceId);
|
||||||
dataSourcePropertyDao.batchInsert(properties);
|
dataSourcePropertyDao.batchInsert(properties);
|
||||||
|
|
||||||
ProjectSyncRulePojo syncRule = projectPojoConverter.of(request.getProjectSyncRule(), projectId);
|
ProjectSyncRule syncRule = projectConverter.of(request.getProjectSyncRule(), projectId);
|
||||||
projectSyncRuleDao.insertAndReturnId(syncRule);
|
projectSyncRuleDao.insertAndReturnId(syncRule);
|
||||||
|
|
||||||
var event = ProjectSaved.builder()
|
var event = ProjectSaved.builder()
|
||||||
|
@ -113,13 +113,13 @@ public class ProjectService {
|
||||||
if (projectDao.exists(groupId, projectId)) {
|
if (projectDao.exists(groupId, projectId)) {
|
||||||
// update dataSource
|
// update dataSource
|
||||||
String newPassword = encryptPassword(request.getDataSource().getPassword()).orElse(null);
|
String newPassword = encryptPassword(request.getDataSource().getPassword()).orElse(null);
|
||||||
DataSourcePojo dataSource = dataSourcePojoConverter.of(request.getDataSource(), newPassword, projectId);
|
DataSource dataSource = dataSourceConverter.of(request.getDataSource(), newPassword, projectId);
|
||||||
dataSourceDao.updateByProjectId(dataSource);
|
dataSourceDao.updateByProjectId(dataSource);
|
||||||
|
|
||||||
// update connection property
|
// update connection property
|
||||||
Integer dataSourceId = dataSourceDao.selectByProjectId(projectId).getId();
|
Integer dataSourceId = dataSourceDao.selectByProjectId(projectId).getId();
|
||||||
List<DataSourcePropertyValue> propertyValues = request.getDataSource().getProperties();
|
List<DataSourcePropertyValue> propertyValues = request.getDataSource().getProperties();
|
||||||
List<DataSourcePropertyPojo> properties = dataSourcePojoConverter.of(propertyValues, dataSourceId);
|
List<DataSourceProperty> properties = dataSourceConverter.of(propertyValues, dataSourceId);
|
||||||
if (properties.isEmpty()) {
|
if (properties.isEmpty()) {
|
||||||
dataSourcePropertyDao.deleteByDataSourceId(dataSourceId);
|
dataSourcePropertyDao.deleteByDataSourceId(dataSourceId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -128,12 +128,12 @@ public class ProjectService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update project sync rule
|
// update project sync rule
|
||||||
ProjectSyncRulePojo syncRule = projectPojoConverter.of(request.getProjectSyncRule(), projectId);
|
ProjectSyncRule syncRule = projectConverter.of(request.getProjectSyncRule(), projectId);
|
||||||
projectSyncRuleDao.deleteByProjectId(projectId);
|
projectSyncRuleDao.deleteByProjectId(projectId);
|
||||||
projectSyncRuleDao.insertAndReturnId(syncRule);
|
projectSyncRuleDao.insertAndReturnId(syncRule);
|
||||||
|
|
||||||
// update project info
|
// update project info
|
||||||
ProjectPojo project = projectPojoConverter.of(request);
|
Project project = projectConverter.of(request);
|
||||||
projectDao.updateById(project);
|
projectDao.updateById(project);
|
||||||
|
|
||||||
ProjectSaved event = ProjectSaved.builder()
|
ProjectSaved event = ProjectSaved.builder()
|
||||||
|
@ -155,7 +155,7 @@ public class ProjectService {
|
||||||
if (!StringUtils.hasText(password)) {
|
if (!StringUtils.hasText(password)) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
SysKeyPojo sysKey = sysKeyDao.selectTopOne();
|
SysKey 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()));
|
||||||
}
|
}
|
||||||
|
@ -168,24 +168,24 @@ public class ProjectService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<ProjectSimpleResponse> list(Integer userId, Pageable page, ProjectListCondition condition) {
|
public Page<ProjectSimpleResponse> list(Integer userId, Pageable page, ProjectListCondition condition) {
|
||||||
Page<ProjectPojo> pageData = projectDao.selectByCondition(page, condition.toCondition());
|
Page<Project> pageData = projectDao.selectByCondition(page, condition.toCondition());
|
||||||
List<Integer> projectIds = pageData.getContent()
|
List<Integer> projectIds = pageData.getContent()
|
||||||
.stream()
|
.stream()
|
||||||
.map(ProjectPojo::getId)
|
.map(Project::getId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
Map<Integer, DataSourcePojo> dataSourceMapByProjectId = dataSourceDao.selectInProjectIds(projectIds)
|
Map<Integer, DataSource> dataSourceMapByProjectId = dataSourceDao.selectInProjectIds(projectIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(DataSourcePojo::getProjectId, Function.identity()));
|
.collect(Collectors.toMap(DataSource::getProjectId, Function.identity()));
|
||||||
Map<Integer, ProjectSyncRulePojo> syncRuleMapByProjectId = projectSyncRuleDao.selectInProjectIds(projectIds)
|
Map<Integer, ProjectSyncRule> syncRuleMapByProjectId = projectSyncRuleDao.selectInProjectIds(projectIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(ProjectSyncRulePojo::getProjectId, Function.identity()));
|
.collect(Collectors.toMap(ProjectSyncRule::getProjectId, Function.identity()));
|
||||||
Set<Integer> favoriteProjectIds = userFavoriteProjectDao.selectByUserIdAndProjectIds(userId, projectIds)
|
Set<Integer> favoriteProjectIds = userFavoriteProjectDao.selectByUserIdAndProjectIds(userId, projectIds)
|
||||||
.stream()
|
.stream()
|
||||||
.map(UserFavoriteProjectPojo::getProjectId)
|
.map(UserFavoriteProject::getProjectId)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
return pageData.map(project -> {
|
return pageData.map(project -> {
|
||||||
DataSourcePojo dataSource = dataSourceMapByProjectId.get(project.getId());
|
DataSource dataSource = dataSourceMapByProjectId.get(project.getId());
|
||||||
ProjectSyncRulePojo syncRule = syncRuleMapByProjectId.get(project.getId());
|
ProjectSyncRule syncRule = syncRuleMapByProjectId.get(project.getId());
|
||||||
Boolean isFavorite = favoriteProjectIds.contains(project.getId());
|
Boolean isFavorite = favoriteProjectIds.contains(project.getId());
|
||||||
return projectResponseConverter.toSimple(project, dataSource, syncRule, isFavorite);
|
return projectResponseConverter.toSimple(project, dataSource, syncRule, isFavorite);
|
||||||
});
|
});
|
||||||
|
@ -194,8 +194,8 @@ public class ProjectService {
|
||||||
public void testConnection(ProjectTestConnectionRequest request) {
|
public void testConnection(ProjectTestConnectionRequest request) {
|
||||||
String password;
|
String password;
|
||||||
if (request.getProjectId() != null && !StringUtils.hasText(request.getPassword())) {
|
if (request.getProjectId() != null && !StringUtils.hasText(request.getPassword())) {
|
||||||
DataSourcePojo dataSource = dataSourceDao.selectByProjectId(request.getProjectId());
|
DataSource dataSource = dataSourceDao.selectByProjectId(request.getProjectId());
|
||||||
SysKeyPojo sysKey = sysKeyDao.selectTopOne();
|
SysKey sysKey = sysKeyDao.selectTopOne();
|
||||||
password = Aes.decryptFromBase64Data(dataSource.getPassword(), sysKey.getAesKey());
|
password = Aes.decryptFromBase64Data(dataSource.getPassword(), sysKey.getAesKey());
|
||||||
} else if (StringUtils.hasText(request.getPassword())) {
|
} else if (StringUtils.hasText(request.getPassword())) {
|
||||||
password = request.getPassword();
|
password = request.getPassword();
|
||||||
|
@ -224,7 +224,7 @@ public class ProjectService {
|
||||||
log.warn("create sync task failed, it's already exists, projectId={}", projectId);
|
log.warn("create sync task failed, it's already exists, projectId={}", projectId);
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
ProjectSyncTaskPojo projectSyncTask = new ProjectSyncTaskPojo();
|
ProjectSyncTask projectSyncTask = new ProjectSyncTask();
|
||||||
projectSyncTask.setProjectId(projectId);
|
projectSyncTask.setProjectId(projectId);
|
||||||
projectSyncTask.setStatus(ProjectSyncTaskStatus.NEW);
|
projectSyncTask.setStatus(ProjectSyncTaskStatus.NEW);
|
||||||
projectSyncTask.setUserId(userId);
|
projectSyncTask.setUserId(userId);
|
||||||
|
|
|
@ -5,9 +5,9 @@ import com.databasir.core.domain.search.data.SearchResponse;
|
||||||
import com.databasir.dao.impl.DocumentFullTextDao;
|
import com.databasir.dao.impl.DocumentFullTextDao;
|
||||||
import com.databasir.dao.impl.GroupDao;
|
import com.databasir.dao.impl.GroupDao;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
import com.databasir.dao.tables.pojos.DocumentFullText;
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
import com.databasir.dao.tables.pojos.Group;
|
||||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
import com.databasir.dao.tables.pojos.Project;
|
||||||
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;
|
||||||
|
@ -31,8 +31,8 @@ public class SearchService {
|
||||||
private final ProjectDao projectDao;
|
private final ProjectDao projectDao;
|
||||||
|
|
||||||
public SearchResponse search(Pageable pageable, String query) {
|
public SearchResponse search(Pageable pageable, String query) {
|
||||||
Page<DocumentFullTextPojo> columnPageData = documentFullTextDao.selectColumnPage(pageable, query);
|
Page<DocumentFullText> columnPageData = documentFullTextDao.selectColumnPage(pageable, query);
|
||||||
Page<DocumentFullTextPojo> tablePageData = documentFullTextDao.selectTablePage(pageable, query);
|
Page<DocumentFullText> tablePageData = documentFullTextDao.selectTablePage(pageable, query);
|
||||||
|
|
||||||
// table 和 column 的项目名、组名等信息需要从关联表取
|
// table 和 column 的项目名、组名等信息需要从关联表取
|
||||||
Set<Integer> projectIds = new HashSet<>();
|
Set<Integer> projectIds = new HashSet<>();
|
||||||
|
@ -40,11 +40,11 @@ public class SearchService {
|
||||||
.stream().map(o -> o.getProjectId()).collect(Collectors.toList()));
|
.stream().map(o -> o.getProjectId()).collect(Collectors.toList()));
|
||||||
projectIds.addAll(tablePageData.getContent()
|
projectIds.addAll(tablePageData.getContent()
|
||||||
.stream().map(o -> o.getProjectId()).collect(Collectors.toList()));
|
.stream().map(o -> o.getProjectId()).collect(Collectors.toList()));
|
||||||
Map<Integer, ProjectPojo> projectMapById = projectDao.selectInIds(projectIds)
|
Map<Integer, Project> projectMapById = projectDao.selectInIds(projectIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(o -> o.getId(), o -> o));
|
.collect(Collectors.toMap(o -> o.getId(), o -> o));
|
||||||
|
|
||||||
Page<DocumentFullTextPojo> projectPageData = documentFullTextDao.selectProjectPage(pageable, query);
|
Page<DocumentFullText> projectPageData = documentFullTextDao.selectProjectPage(pageable, query);
|
||||||
Set<Integer> groupIds = new HashSet<>();
|
Set<Integer> groupIds = new HashSet<>();
|
||||||
groupIds.addAll(columnPageData.getContent()
|
groupIds.addAll(columnPageData.getContent()
|
||||||
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
||||||
|
@ -52,7 +52,7 @@ public class SearchService {
|
||||||
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
||||||
groupIds.addAll(projectPageData.getContent()
|
groupIds.addAll(projectPageData.getContent()
|
||||||
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
.stream().map(o -> o.getGroupId()).collect(Collectors.toList()));
|
||||||
Map<Integer, GroupPojo> groupMapById = groupDao.selectInIds(groupIds)
|
Map<Integer, Group> groupMapById = groupDao.selectInIds(groupIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(o -> o.getId(), o -> o));
|
.collect(Collectors.toMap(o -> o.getId(), o -> o));
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.databasir.core.domain.search.converter;
|
package com.databasir.core.domain.search.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.search.data.SearchResponse;
|
import com.databasir.core.domain.search.data.SearchResponse;
|
||||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
import com.databasir.dao.tables.pojos.DocumentFullText;
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
import com.databasir.dao.tables.pojos.Group;
|
||||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
import com.databasir.dao.tables.pojos.Project;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
@ -12,16 +12,16 @@ import java.util.Map;
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface SearchResponseConverter {
|
public interface SearchResponseConverter {
|
||||||
|
|
||||||
default SearchResponse.Item toItem(DocumentFullTextPojo pojo,
|
default SearchResponse.Item toItem(DocumentFullText pojo,
|
||||||
Map<Integer, ProjectPojo> projectMapById,
|
Map<Integer, Project> projectMapById,
|
||||||
Map<Integer, GroupPojo> groupMapById) {
|
Map<Integer, Group> groupMapById) {
|
||||||
ProjectPojo project = projectMapById.get(pojo.getProjectId());
|
Project project = projectMapById.get(pojo.getProjectId());
|
||||||
GroupPojo group = groupMapById.get(pojo.getGroupId());
|
Group group = groupMapById.get(pojo.getGroupId());
|
||||||
return toItem(pojo, group.getName(), group.getDescription(), project.getName(), project.getDescription());
|
return toItem(pojo, group.getName(), group.getDescription(), project.getName(), project.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
default SearchResponse.Item toItem(DocumentFullTextPojo pojo,
|
default SearchResponse.Item toItem(DocumentFullText pojo,
|
||||||
Map<Integer, GroupPojo> groupMapById) {
|
Map<Integer, Group> groupMapById) {
|
||||||
var group = groupMapById.get(pojo.getGroupId());
|
var group = groupMapById.get(pojo.getGroupId());
|
||||||
return toItem(pojo,
|
return toItem(pojo,
|
||||||
group.getName(),
|
group.getName(),
|
||||||
|
@ -34,11 +34,11 @@ public interface SearchResponseConverter {
|
||||||
@Mapping(target = "groupDescription", source = "groupDescription")
|
@Mapping(target = "groupDescription", source = "groupDescription")
|
||||||
@Mapping(target = "projectName", source = "projectName")
|
@Mapping(target = "projectName", source = "projectName")
|
||||||
@Mapping(target = "projectDescription", source = "projectDescription")
|
@Mapping(target = "projectDescription", source = "projectDescription")
|
||||||
SearchResponse.Item toItem(DocumentFullTextPojo item,
|
SearchResponse.Item toItem(DocumentFullText item,
|
||||||
String groupName,
|
String groupName,
|
||||||
String groupDescription,
|
String groupDescription,
|
||||||
String projectName,
|
String projectName,
|
||||||
String projectDescription);
|
String projectDescription);
|
||||||
|
|
||||||
SearchResponse.Item toItem(DocumentFullTextPojo pojo);
|
SearchResponse.Item toItem(DocumentFullText pojo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.system.data.SystemEmailResponse;
|
import com.databasir.core.domain.system.data.SystemEmailResponse;
|
||||||
import com.databasir.core.domain.system.data.SystemEmailUpdateRequest;
|
import com.databasir.core.domain.system.data.SystemEmailUpdateRequest;
|
||||||
import com.databasir.dao.impl.SysMailDao;
|
import com.databasir.dao.impl.SysMailDao;
|
||||||
import com.databasir.dao.tables.pojos.SysMailPojo;
|
import com.databasir.dao.tables.pojos.SysMail;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
@ -41,26 +41,26 @@ public class SystemService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEmailSetting(SystemEmailUpdateRequest request) {
|
public void updateEmailSetting(SystemEmailUpdateRequest request) {
|
||||||
SysMailPojo sysMailPojo = new SysMailPojo();
|
SysMail sysMail = new SysMail();
|
||||||
sysMailPojo.setSmtpHost(request.getSmtpHost());
|
sysMail.setSmtpHost(request.getSmtpHost());
|
||||||
sysMailPojo.setSmtpPort(request.getSmtpPort());
|
sysMail.setSmtpPort(request.getSmtpPort());
|
||||||
sysMailPojo.setUsername(request.getUsername());
|
sysMail.setUsername(request.getUsername());
|
||||||
sysMailPojo.setUseSsl(request.getUseSSL());
|
sysMail.setUseSsl(request.getUseSSL());
|
||||||
|
|
||||||
Optional<Integer> idOpt = sysMailDao.selectOptionTopOne().map(SysMailPojo::getId);
|
Optional<Integer> idOpt = sysMailDao.selectOptionTopOne().map(SysMail::getId);
|
||||||
idOpt.ifPresent(sysMailPojo::setId);
|
idOpt.ifPresent(sysMail::setId);
|
||||||
if (request.getPassword() != null) {
|
if (request.getPassword() != null) {
|
||||||
// TODO encrypt password ?
|
// TODO encrypt password ?
|
||||||
sysMailPojo.setPassword(request.getPassword());
|
sysMail.setPassword(request.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idOpt.isPresent()) {
|
if (idOpt.isPresent()) {
|
||||||
if (!StringUtils.hasText(request.getPassword())) {
|
if (!StringUtils.hasText(request.getPassword())) {
|
||||||
throw DomainErrors.CONNECT_DATABASE_FAILED.exception();
|
throw DomainErrors.CONNECT_DATABASE_FAILED.exception();
|
||||||
}
|
}
|
||||||
sysMailDao.updateById(sysMailPojo);
|
sysMailDao.updateById(sysMail);
|
||||||
} else {
|
} else {
|
||||||
sysMailDao.insertAndReturnId(sysMailPojo);
|
sysMailDao.insertAndReturnId(sysMail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ public interface FavoriteProjectPageResponseConverter {
|
||||||
@Mapping(target = "groupId", source = "group.id")
|
@Mapping(target = "groupId", source = "group.id")
|
||||||
@Mapping(target = "groupName", source = "group.name")
|
@Mapping(target = "groupName", source = "group.name")
|
||||||
@Mapping(target = "createAt", source = "favoriteProject.createAt")
|
@Mapping(target = "createAt", source = "favoriteProject.createAt")
|
||||||
FavoriteProjectPageResponse to(UserFavoriteProjectPojo favoriteProject,
|
FavoriteProjectPageResponse to(UserFavoriteProject favoriteProject,
|
||||||
ProjectPojo project,
|
Project project,
|
||||||
DataSourcePojo dataSource,
|
DataSource dataSource,
|
||||||
ProjectSyncRulePojo projectSyncRule,
|
ProjectSyncRule projectSyncRule,
|
||||||
GroupPojo group);
|
Group group);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package com.databasir.core.domain.user.converter;
|
package com.databasir.core.domain.user.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.user.data.UserCreateRequest;
|
import com.databasir.core.domain.user.data.UserCreateRequest;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface UserPojoConverter {
|
public interface UserConverter {
|
||||||
|
|
||||||
@Mapping(target = "password", source = "hashedPassword")
|
@Mapping(target = "password", source = "hashedPassword")
|
||||||
UserPojo of(UserCreateRequest request, String hashedPassword);
|
User of(UserCreateRequest request, String hashedPassword);
|
||||||
}
|
}
|
|
@ -2,8 +2,8 @@ package com.databasir.core.domain.user.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.user.data.UserDetailResponse;
|
import com.databasir.core.domain.user.data.UserDetailResponse;
|
||||||
import com.databasir.core.domain.user.data.UserPageResponse;
|
import com.databasir.core.domain.user.data.UserPageResponse;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,8 +13,8 @@ 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(User user,
|
||||||
List<UserRolePojo> userRoles,
|
List<UserRole> userRoles,
|
||||||
Map<Integer, String> groupNameMapById) {
|
Map<Integer, String> groupNameMapById) {
|
||||||
List<UserDetailResponse.UserRoleDetailResponse> roles = userRoles.stream()
|
List<UserDetailResponse.UserRoleDetailResponse> roles = userRoles.stream()
|
||||||
.map(pojo -> userRoleDetailResponse(pojo, groupNameMapById.get(pojo.getGroupId())))
|
.map(pojo -> userRoleDetailResponse(pojo, groupNameMapById.get(pojo.getGroupId())))
|
||||||
|
@ -22,10 +22,10 @@ public interface UserResponseConverter {
|
||||||
return detailResponse(user, roles);
|
return detailResponse(user, roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
UserDetailResponse detailResponse(UserPojo pojo, List<UserDetailResponse.UserRoleDetailResponse> roles);
|
UserDetailResponse detailResponse(User pojo, List<UserDetailResponse.UserRoleDetailResponse> roles);
|
||||||
|
|
||||||
UserDetailResponse.UserRoleDetailResponse userRoleDetailResponse(UserRolePojo pojo, String groupName);
|
UserDetailResponse.UserRoleDetailResponse userRoleDetailResponse(UserRole pojo, String groupName);
|
||||||
|
|
||||||
UserPageResponse pageResponse(UserPojo pojo, Boolean isSysOwner, List<Integer> inGroupIds);
|
UserPageResponse pageResponse(User pojo, Boolean isSysOwner, List<Integer> inGroupIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.databasir.core.domain.user.event.converter;
|
||||||
|
|
||||||
import com.databasir.core.domain.user.event.UserCreated;
|
import com.databasir.core.domain.user.event.UserCreated;
|
||||||
import com.databasir.core.domain.user.event.UserPasswordRenewed;
|
import com.databasir.core.domain.user.event.UserPasswordRenewed;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@ import java.time.LocalDateTime;
|
||||||
@Mapper(componentModel = "spring")
|
@Mapper(componentModel = "spring")
|
||||||
public interface UserEventConverter {
|
public interface UserEventConverter {
|
||||||
|
|
||||||
UserPasswordRenewed userPasswordRenewed(UserPojo pojo,
|
UserPasswordRenewed userPasswordRenewed(User pojo,
|
||||||
Integer renewByUserId,
|
Integer renewByUserId,
|
||||||
LocalDateTime renewTime,
|
LocalDateTime renewTime,
|
||||||
String newPassword);
|
String newPassword);
|
||||||
|
|
||||||
@Mapping(target = "userId", source = "userId")
|
@Mapping(target = "userId", source = "userId")
|
||||||
UserCreated userCreated(UserPojo pojo, String source, String rawPassword, Integer userId);
|
UserCreated userCreated(User pojo, String source, String rawPassword, Integer userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,29 +36,29 @@ public class UserProjectService {
|
||||||
FavoriteProjectPageCondition condition) {
|
FavoriteProjectPageCondition condition) {
|
||||||
var data = userFavoriteProjectDao.selectByCondition(pageable, condition.toCondition(userId));
|
var data = userFavoriteProjectDao.selectByCondition(pageable, condition.toCondition(userId));
|
||||||
// project data
|
// project data
|
||||||
var projectIdList = data.map(UserFavoriteProjectPojo::getProjectId).toList();
|
var projectIdList = data.map(UserFavoriteProject::getProjectId).toList();
|
||||||
var projectPojos = projectDao.selectInIds(projectIdList);
|
var projects = projectDao.selectInIds(projectIdList);
|
||||||
var projectMapById = projectPojos.stream()
|
var projectMapById = projects.stream()
|
||||||
.collect(Collectors.toMap(ProjectPojo::getId, Function.identity()));
|
.collect(Collectors.toMap(Project::getId, Function.identity()));
|
||||||
// dataSource data
|
// dataSource data
|
||||||
var dataSourceMapByProjectId = dataSourceDao.selectInProjectIds(projectIdList)
|
var dataSourceMapByProjectId = dataSourceDao.selectInProjectIds(projectIdList)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(DataSourcePojo::getProjectId, Function.identity()));
|
.collect(Collectors.toMap(DataSource::getProjectId, Function.identity()));
|
||||||
// project sync rule data
|
// project sync rule data
|
||||||
var projectSyncRuleMapByProjectId = projectSyncRuleDao.selectInProjectIds(projectIdList)
|
var projectSyncRuleMapByProjectId = projectSyncRuleDao.selectInProjectIds(projectIdList)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(ProjectSyncRulePojo::getProjectId, Function.identity()));
|
.collect(Collectors.toMap(ProjectSyncRule::getProjectId, Function.identity()));
|
||||||
// group data
|
// group data
|
||||||
var groupIdList = projectPojos.stream().map(ProjectPojo::getGroupId).collect(Collectors.toList());
|
var groupIdList = projects.stream().map(Project::getGroupId).collect(Collectors.toList());
|
||||||
var groupMapById = groupDao.selectInIds(groupIdList)
|
var groupMapById = groupDao.selectInIds(groupIdList)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(GroupPojo::getId, Function.identity()));
|
.collect(Collectors.toMap(Group::getId, Function.identity()));
|
||||||
// response data
|
// response data
|
||||||
return data.map(favorite -> {
|
return data.map(favorite -> {
|
||||||
ProjectPojo project = projectMapById.get(favorite.getProjectId());
|
Project project = projectMapById.get(favorite.getProjectId());
|
||||||
DataSourcePojo dataSource = dataSourceMapByProjectId.get(favorite.getProjectId());
|
DataSource dataSource = dataSourceMapByProjectId.get(favorite.getProjectId());
|
||||||
ProjectSyncRulePojo projectSyncRule = projectSyncRuleMapByProjectId.get(favorite.getProjectId());
|
ProjectSyncRule projectSyncRule = projectSyncRuleMapByProjectId.get(favorite.getProjectId());
|
||||||
GroupPojo group = null;
|
Group group = null;
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
group = groupMapById.get(project.getGroupId());
|
group = groupMapById.get(project.getGroupId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.domain.user.service;
|
package com.databasir.core.domain.user.service;
|
||||||
|
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.domain.user.converter.UserPojoConverter;
|
import com.databasir.core.domain.user.converter.UserConverter;
|
||||||
import com.databasir.core.domain.user.converter.UserResponseConverter;
|
import com.databasir.core.domain.user.converter.UserResponseConverter;
|
||||||
import com.databasir.core.domain.user.data.*;
|
import com.databasir.core.domain.user.data.*;
|
||||||
import com.databasir.core.domain.user.event.UserCreated;
|
import com.databasir.core.domain.user.event.UserCreated;
|
||||||
|
@ -12,9 +12,9 @@ import com.databasir.dao.impl.GroupDao;
|
||||||
import com.databasir.dao.impl.LoginDao;
|
import com.databasir.dao.impl.LoginDao;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.impl.UserRoleDao;
|
import com.databasir.dao.impl.UserRoleDao;
|
||||||
import com.databasir.dao.tables.pojos.GroupPojo;
|
import com.databasir.dao.tables.pojos.Group;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.dao.DuplicateKeyException;
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
@ -41,7 +41,7 @@ public class UserService {
|
||||||
|
|
||||||
private final LoginDao loginDao;
|
private final LoginDao loginDao;
|
||||||
|
|
||||||
private final UserPojoConverter userPojoConverter;
|
private final UserConverter userConverter;
|
||||||
|
|
||||||
private final UserResponseConverter userResponseConverter;
|
private final UserResponseConverter userResponseConverter;
|
||||||
|
|
||||||
|
@ -53,19 +53,19 @@ public class UserService {
|
||||||
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) {
|
||||||
Page<UserPojo> users = userDao.selectByPage(pageable, condition.toCondition());
|
Page<User> users = userDao.selectByPage(pageable, condition.toCondition());
|
||||||
List<Integer> userIds = users.getContent()
|
List<Integer> userIds = users.getContent()
|
||||||
.stream()
|
.stream()
|
||||||
.map(UserPojo::getId)
|
.map(User::getId)
|
||||||
.collect(toList());
|
.collect(toList());
|
||||||
List<UserRolePojo> userRoles = userRoleDao.selectByUserIds(userIds);
|
List<UserRole> userRoles = userRoleDao.selectByUserIds(userIds);
|
||||||
Map<Integer, List<Integer>> groupIdMapByUserId = userRoles
|
Map<Integer, List<Integer>> groupIdMapByUserId = userRoles
|
||||||
.stream()
|
.stream()
|
||||||
.filter(ur -> ur.getGroupId() != null)
|
.filter(ur -> ur.getGroupId() != null)
|
||||||
.collect(groupingBy(UserRolePojo::getUserId, mapping(UserRolePojo::getGroupId, toList())));
|
.collect(groupingBy(UserRole::getUserId, mapping(UserRole::getGroupId, toList())));
|
||||||
Map<Integer, List<UserRolePojo>> sysOwnerGroupByUserId = userRoles.stream()
|
Map<Integer, List<UserRole>> sysOwnerGroupByUserId = userRoles.stream()
|
||||||
.filter(ur -> ur.getRole().equals(SYS_OWNER))
|
.filter(ur -> ur.getRole().equals(SYS_OWNER))
|
||||||
.collect(groupingBy(UserRolePojo::getUserId));
|
.collect(groupingBy(UserRole::getUserId));
|
||||||
return users.map(user ->
|
return users.map(user ->
|
||||||
userResponseConverter.pageResponse(user, sysOwnerGroupByUserId.containsKey(user.getId()),
|
userResponseConverter.pageResponse(user, sysOwnerGroupByUserId.containsKey(user.getId()),
|
||||||
groupIdMapByUserId.get(user.getId())));
|
groupIdMapByUserId.get(user.getId())));
|
||||||
|
@ -77,7 +77,7 @@ public class UserService {
|
||||||
throw DomainErrors.USERNAME_OR_EMAIL_DUPLICATE.exception();
|
throw DomainErrors.USERNAME_OR_EMAIL_DUPLICATE.exception();
|
||||||
});
|
});
|
||||||
String hashedPassword = bCryptPasswordEncoder.encode(userCreateRequest.getPassword());
|
String hashedPassword = bCryptPasswordEncoder.encode(userCreateRequest.getPassword());
|
||||||
UserPojo pojo = userPojoConverter.of(userCreateRequest, hashedPassword);
|
User pojo = userConverter.of(userCreateRequest, hashedPassword);
|
||||||
try {
|
try {
|
||||||
Integer id = userDao.insertAndReturnId(pojo);
|
Integer id = userDao.insertAndReturnId(pojo);
|
||||||
// publish event
|
// publish event
|
||||||
|
@ -90,36 +90,36 @@ public class UserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserDetailResponse get(Integer userId) {
|
public UserDetailResponse get(Integer userId) {
|
||||||
UserPojo pojo = userDao.selectById(userId);
|
User pojo = userDao.selectById(userId);
|
||||||
List<UserRolePojo> roles = userRoleDao.selectByUserIds(Collections.singletonList(userId));
|
List<UserRole> roles = userRoleDao.selectByUserIds(Collections.singletonList(userId));
|
||||||
List<Integer> groupIds = roles.stream()
|
List<Integer> groupIds = roles.stream()
|
||||||
.map(UserRolePojo::getGroupId)
|
.map(UserRole::getGroupId)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.collect(toList());
|
.collect(toList());
|
||||||
Map<Integer, String> groupNameMapById = groupDao.selectInIds(groupIds)
|
Map<Integer, String> groupNameMapById = groupDao.selectInIds(groupIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(toMap(GroupPojo::getId, GroupPojo::getName));
|
.collect(toMap(Group::getId, Group::getName));
|
||||||
return userResponseConverter.detailResponse(pojo, roles, groupNameMapById);
|
return userResponseConverter.detailResponse(pojo, roles, groupNameMapById);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<UserDetailResponse> get(String email) {
|
public Optional<UserDetailResponse> get(String email) {
|
||||||
return userDao.selectByEmail(email)
|
return userDao.selectByEmail(email)
|
||||||
.map(user -> {
|
.map(user -> {
|
||||||
List<UserRolePojo> roles = userRoleDao.selectByUserIds(Collections.singletonList(user.getId()));
|
List<UserRole> roles = userRoleDao.selectByUserIds(Collections.singletonList(user.getId()));
|
||||||
List<Integer> groupIds = roles.stream()
|
List<Integer> groupIds = roles.stream()
|
||||||
.map(UserRolePojo::getGroupId)
|
.map(UserRole::getGroupId)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.collect(toList());
|
.collect(toList());
|
||||||
Map<Integer, String> groupNameMapById = groupDao.selectInIds(groupIds)
|
Map<Integer, String> groupNameMapById = groupDao.selectInIds(groupIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(toMap(GroupPojo::getId, GroupPojo::getName));
|
.collect(toMap(Group::getId, Group::getName));
|
||||||
return userResponseConverter.detailResponse(user, roles, groupNameMapById);
|
return userResponseConverter.detailResponse(user, roles, groupNameMapById);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public String renewPassword(Integer renewByUserId, Integer userId) {
|
public String renewPassword(Integer renewByUserId, Integer userId) {
|
||||||
UserPojo pojo = userDao.selectById(userId);
|
User pojo = userDao.selectById(userId);
|
||||||
String randomPassword = UUID.randomUUID().toString()
|
String randomPassword = UUID.randomUUID().toString()
|
||||||
.replace("-", "")
|
.replace("-", "")
|
||||||
.substring(0, 8);
|
.substring(0, 8);
|
||||||
|
@ -151,7 +151,7 @@ public class UserService {
|
||||||
|
|
||||||
public void addSysOwnerTo(Integer userId) {
|
public void addSysOwnerTo(Integer userId) {
|
||||||
if (!userRoleDao.hasRole(userId, SYS_OWNER)) {
|
if (!userRoleDao.hasRole(userId, SYS_OWNER)) {
|
||||||
UserRolePojo role = new UserRolePojo();
|
UserRole role = new UserRole();
|
||||||
role.setUserId(userId);
|
role.setUserId(userId);
|
||||||
role.setRole(SYS_OWNER);
|
role.setRole(SYS_OWNER);
|
||||||
userRoleDao.insertAndReturnId(role);
|
userRoleDao.insertAndReturnId(role);
|
||||||
|
@ -162,8 +162,8 @@ public class UserService {
|
||||||
if (!Objects.equals(request.getNewPassword(), request.getConfirmNewPassword())) {
|
if (!Objects.equals(request.getNewPassword(), request.getConfirmNewPassword())) {
|
||||||
throw DomainErrors.UPDATE_PASSWORD_CONFIRM_FAILED.exception();
|
throw DomainErrors.UPDATE_PASSWORD_CONFIRM_FAILED.exception();
|
||||||
}
|
}
|
||||||
UserPojo userPojo = userDao.selectById(userId);
|
User user = userDao.selectById(userId);
|
||||||
if (!bCryptPasswordEncoder.matches(request.getOriginPassword(), userPojo.getPassword())) {
|
if (!bCryptPasswordEncoder.matches(request.getOriginPassword(), user.getPassword())) {
|
||||||
throw DomainErrors.ORIGIN_PASSWORD_NOT_CORRECT.exception();
|
throw DomainErrors.ORIGIN_PASSWORD_NOT_CORRECT.exception();
|
||||||
}
|
}
|
||||||
String newHashedPassword = bCryptPasswordEncoder.encode(request.getNewPassword());
|
String newHashedPassword = bCryptPasswordEncoder.encode(request.getNewPassword());
|
||||||
|
@ -172,9 +172,9 @@ public class UserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateNickname(Integer userId, UserNicknameUpdateRequest request) {
|
public void updateNickname(Integer userId, UserNicknameUpdateRequest request) {
|
||||||
UserPojo userPojo = userDao.selectById(userId);
|
User user = userDao.selectById(userId);
|
||||||
userPojo.setNickname(request.getNickname());
|
user.setNickname(request.getNickname());
|
||||||
userDao.updateById(userPojo);
|
userDao.updateById(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.alibaba.excel.util.StringUtils;
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.core.infrastructure.driver.DriverResources;
|
import com.databasir.core.infrastructure.driver.DriverResources;
|
||||||
import com.databasir.dao.impl.DatabaseTypeDao;
|
import com.databasir.dao.impl.DatabaseTypeDao;
|
||||||
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
|
import com.databasir.dao.tables.pojos.DatabaseType;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
|
@ -39,7 +39,7 @@ public class CustomDatabaseConnectionFactory implements DatabaseConnectionFactor
|
||||||
@Override
|
@Override
|
||||||
public Connection getConnection(Context context) throws SQLException {
|
public Connection getConnection(Context context) throws SQLException {
|
||||||
String databaseType = context.getDatabaseType();
|
String databaseType = context.getDatabaseType();
|
||||||
DatabaseTypePojo type = databaseTypeDao.selectByDatabaseType(databaseType);
|
DatabaseType type = databaseTypeDao.selectByDatabaseType(databaseType);
|
||||||
|
|
||||||
File driverFile = loadDriver(type);
|
File driverFile = loadDriver(type);
|
||||||
URLClassLoader loader = null;
|
URLClassLoader loader = null;
|
||||||
|
@ -85,7 +85,7 @@ public class CustomDatabaseConnectionFactory implements DatabaseConnectionFactor
|
||||||
return driver.connect(jdbcUrl, info);
|
return driver.connect(jdbcUrl, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private File loadDriver(DatabaseTypePojo type) {
|
private File loadDriver(DatabaseType type) {
|
||||||
if (StringUtils.isNotBlank(type.getJdbcDriverFilePath())) {
|
if (StringUtils.isNotBlank(type.getJdbcDriverFilePath())) {
|
||||||
return driverResources.loadFromLocal(type.getJdbcDriverFilePath()).getDriverFile();
|
return driverResources.loadFromLocal(type.getJdbcDriverFilePath()).getDriverFile();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ package com.databasir.core.infrastructure.connection;
|
||||||
import com.databasir.common.codec.Aes;
|
import com.databasir.common.codec.Aes;
|
||||||
import com.databasir.core.domain.DomainErrors;
|
import com.databasir.core.domain.DomainErrors;
|
||||||
import com.databasir.dao.impl.SysKeyDao;
|
import com.databasir.dao.impl.SysKeyDao;
|
||||||
import com.databasir.dao.tables.pojos.DataSourcePojo;
|
import com.databasir.dao.tables.pojos.DataSource;
|
||||||
import com.databasir.dao.tables.pojos.DataSourcePropertyPojo;
|
import com.databasir.dao.tables.pojos.DataSourceProperty;
|
||||||
import com.databasir.dao.tables.pojos.SysKeyPojo;
|
import com.databasir.dao.tables.pojos.SysKey;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@ public class DatabaseConnectionService {
|
||||||
|
|
||||||
private final SysKeyDao sysKeyDao;
|
private final SysKeyDao sysKeyDao;
|
||||||
|
|
||||||
public Connection create(DataSourcePojo dataSource,
|
public Connection create(DataSource dataSource,
|
||||||
List<DataSourcePropertyPojo> dataSourceProperties) {
|
List<DataSourceProperty> dataSourceProperties) {
|
||||||
SysKeyPojo sysKey = sysKeyDao.selectTopOne();
|
SysKey sysKey = sysKeyDao.selectTopOne();
|
||||||
String username = dataSource.getUsername();
|
String username = dataSource.getUsername();
|
||||||
String password = Aes.decryptFromBase64Data(dataSource.getPassword(), sysKey.getAesKey());
|
String password = Aes.decryptFromBase64Data(dataSource.getPassword(), sysKey.getAesKey());
|
||||||
String url = dataSource.getUrl();
|
String url = dataSource.getUrl();
|
||||||
|
|
|
@ -2,19 +2,19 @@ package com.databasir.core.infrastructure.event.subscriber;
|
||||||
|
|
||||||
import com.databasir.core.diff.data.DiffType;
|
import com.databasir.core.diff.data.DiffType;
|
||||||
import com.databasir.core.diff.data.RootDiff;
|
import com.databasir.core.diff.data.RootDiff;
|
||||||
|
import com.databasir.core.domain.document.converter.DocumentFullTextConverter;
|
||||||
import com.databasir.core.domain.document.event.DocumentUpdated;
|
import com.databasir.core.domain.document.event.DocumentUpdated;
|
||||||
import com.databasir.core.infrastructure.mail.MailSender;
|
import com.databasir.core.infrastructure.mail.MailSender;
|
||||||
import com.databasir.core.infrastructure.mail.MailTemplateProcessor;
|
import com.databasir.core.infrastructure.mail.MailTemplateProcessor;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.*;
|
||||||
import com.databasir.dao.impl.SysMailDao;
|
import com.databasir.dao.tables.pojos.*;
|
||||||
import com.databasir.dao.impl.UserDao;
|
|
||||||
import com.databasir.dao.tables.pojos.ProjectPojo;
|
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jooq.tools.StringUtils;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -25,11 +25,24 @@ import java.util.stream.Collectors;
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Async("mailThreadPoolTaskExecutor")
|
|
||||||
public class DocumentEventSubscriber {
|
public class DocumentEventSubscriber {
|
||||||
|
|
||||||
private final ProjectDao projectDao;
|
private final ProjectDao projectDao;
|
||||||
|
|
||||||
|
private final GroupDao groupDao;
|
||||||
|
|
||||||
|
private final DatabaseDocumentDao databaseDocumentDao;
|
||||||
|
|
||||||
|
private final TableDocumentDao tableDocumentDao;
|
||||||
|
|
||||||
|
private final TableColumnDocumentDao tableColumnDocumentDao;
|
||||||
|
|
||||||
|
private final DocumentDescriptionDao documentDescriptionDao;
|
||||||
|
|
||||||
|
private final DocumentFullTextDao documentFullTextDao;
|
||||||
|
|
||||||
|
private final DocumentFullTextConverter documentFullTextConverter;
|
||||||
|
|
||||||
private final MailSender mailSender;
|
private final MailSender mailSender;
|
||||||
|
|
||||||
private final UserDao userDao;
|
private final UserDao userDao;
|
||||||
|
@ -38,18 +51,21 @@ public class DocumentEventSubscriber {
|
||||||
|
|
||||||
private final MailTemplateProcessor mailTemplateProcessor;
|
private final MailTemplateProcessor mailTemplateProcessor;
|
||||||
|
|
||||||
|
private final TransactionTemplate transactionTemplate;
|
||||||
|
|
||||||
@EventListener(classes = DocumentUpdated.class)
|
@EventListener(classes = DocumentUpdated.class)
|
||||||
public void onDocumentUpdated(DocumentUpdated created) {
|
@Async("mailThreadPoolTaskExecutor")
|
||||||
|
public void sendMailOnUpdated(DocumentUpdated event) {
|
||||||
sysMailDao.selectOptionTopOne().ifPresent(mail -> {
|
sysMailDao.selectOptionTopOne().ifPresent(mail -> {
|
||||||
ProjectPojo project = projectDao.selectById(created.getProjectId());
|
Project project = projectDao.selectById(event.getProjectId());
|
||||||
List<String> to = userDao.selectEnabledGroupMembers(project.getGroupId())
|
List<String> to = userDao.selectEnabledGroupMembers(project.getGroupId())
|
||||||
.stream()
|
.stream()
|
||||||
.map(UserPojo::getEmail)
|
.map(User::getEmail)
|
||||||
.filter(userEmail -> userEmail.contains("@"))
|
.filter(userEmail -> userEmail.contains("@"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!to.isEmpty()) {
|
if (!to.isEmpty()) {
|
||||||
String subject = project.getName() + " 文档有新的内容变更";
|
String subject = project.getName() + " 文档有新的内容变更";
|
||||||
List<Map<String, String>> diffs = created.getDiff()
|
List<Map<String, String>> diffs = event.getDiff()
|
||||||
.map(this::diffs)
|
.map(this::diffs)
|
||||||
.orElseGet(Collections::emptyList);
|
.orElseGet(Collections::emptyList);
|
||||||
Map<String, Object> context = new HashMap<>();
|
Map<String, Object> context = new HashMap<>();
|
||||||
|
@ -61,6 +77,11 @@ public class DocumentEventSubscriber {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventListener(classes = DocumentUpdated.class)
|
||||||
|
public void updateFullTextOnUpdated(DocumentUpdated event) {
|
||||||
|
updateFullTextIndex(event);
|
||||||
|
}
|
||||||
|
|
||||||
private List<Map<String, String>> diffs(RootDiff diff) {
|
private List<Map<String, String>> diffs(RootDiff diff) {
|
||||||
if (diff.getDiffType() == DiffType.NONE) {
|
if (diff.getDiffType() == DiffType.NONE) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -81,4 +102,46 @@ public class DocumentEventSubscriber {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateFullTextIndex(DocumentUpdated event) {
|
||||||
|
Integer projectId = event.getProjectId();
|
||||||
|
Project project = projectDao.selectById(projectId);
|
||||||
|
Group group = groupDao.selectById(project.getGroupId());
|
||||||
|
// save full text
|
||||||
|
var descriptionMapByJoinName = documentDescriptionDao.selectByProjectId(projectId)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
d -> {
|
||||||
|
if (d.getColumnName() == null) {
|
||||||
|
return d.getTableName();
|
||||||
|
}
|
||||||
|
return String.join(".",
|
||||||
|
d.getTableName(),
|
||||||
|
StringUtils.defaultIfBlank(d.getColumnName(), ""));
|
||||||
|
},
|
||||||
|
DocumentDescription::getContent,
|
||||||
|
(a, b) -> a));
|
||||||
|
DatabaseDocument database = databaseDocumentDao.selectById(event.getDatabaseDocumentId());
|
||||||
|
List<TableDocument> tables = tableDocumentDao.selectByDatabaseDocumentId(event.getDatabaseDocumentId());
|
||||||
|
|
||||||
|
// begin transaction
|
||||||
|
transactionTemplate.executeWithoutResult(status -> {
|
||||||
|
// delete all project.table full text
|
||||||
|
int deletedRows = documentFullTextDao.deleteTableFullText(event.getProjectId());
|
||||||
|
// recreate
|
||||||
|
for (TableDocument table : tables) {
|
||||||
|
List<TableColumnDocument> columns = tableColumnDocumentDao.selectByTableDocumentId(table.getId());
|
||||||
|
List<DocumentFullText> fullTextPojoList = columns.stream()
|
||||||
|
.map(column -> {
|
||||||
|
String tableName = table.getName();
|
||||||
|
String tableDescription = descriptionMapByJoinName.get(tableName);
|
||||||
|
String columnDescription = descriptionMapByJoinName.get(tableName + "." + column.getName());
|
||||||
|
return documentFullTextConverter.toPojo(group, project, database, table, column,
|
||||||
|
tableDescription, columnDescription);
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
documentFullTextDao.batchInsert(fullTextPojoList);
|
||||||
|
}
|
||||||
|
log.info("refresh project({}) tables fultext success, deleted {} items", projectId, deletedRows);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.databasir.core.domain.group.event.GroupDeleted;
|
||||||
import com.databasir.core.domain.group.event.GroupUpdated;
|
import com.databasir.core.domain.group.event.GroupUpdated;
|
||||||
import com.databasir.dao.Tables;
|
import com.databasir.dao.Tables;
|
||||||
import com.databasir.dao.impl.DocumentFullTextDao;
|
import com.databasir.dao.impl.DocumentFullTextDao;
|
||||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
import com.databasir.dao.tables.pojos.DocumentFullText;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
|
@ -24,7 +24,7 @@ public class GroupEventSubscriber {
|
||||||
public void refreshFullTextWhenUpdated(GroupUpdated event) {
|
public void refreshFullTextWhenUpdated(GroupUpdated event) {
|
||||||
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.GROUP_ID.eq(event.getGroupId())
|
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.GROUP_ID.eq(event.getGroupId())
|
||||||
.and(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.isNull()))) {
|
.and(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.isNull()))) {
|
||||||
DocumentFullTextPojo pojo = new DocumentFullTextPojo();
|
DocumentFullText pojo = new DocumentFullText();
|
||||||
pojo.setGroupId(event.getGroupId());
|
pojo.setGroupId(event.getGroupId());
|
||||||
pojo.setGroupName(event.getGroupName());
|
pojo.setGroupName(event.getGroupName());
|
||||||
pojo.setGroupDescription(event.getGroupDescription());
|
pojo.setGroupDescription(event.getGroupDescription());
|
||||||
|
@ -48,7 +48,7 @@ public class GroupEventSubscriber {
|
||||||
public void addFullTextWhenCreated(GroupCreated event) {
|
public void addFullTextWhenCreated(GroupCreated event) {
|
||||||
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.GROUP_ID.eq(event.getGroupId())
|
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.GROUP_ID.eq(event.getGroupId())
|
||||||
.and(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.isNull()))) {
|
.and(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.isNull()))) {
|
||||||
DocumentFullTextPojo pojo = new DocumentFullTextPojo();
|
DocumentFullText pojo = new DocumentFullText();
|
||||||
pojo.setGroupId(event.getGroupId());
|
pojo.setGroupId(event.getGroupId());
|
||||||
pojo.setGroupName(event.getGroupName());
|
pojo.setGroupName(event.getGroupName());
|
||||||
pojo.setGroupDescription(event.getGroupDescription());
|
pojo.setGroupDescription(event.getGroupDescription());
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.databasir.core.domain.project.event.ProjectDeleted;
|
||||||
import com.databasir.core.domain.project.event.ProjectSaved;
|
import com.databasir.core.domain.project.event.ProjectSaved;
|
||||||
import com.databasir.dao.Tables;
|
import com.databasir.dao.Tables;
|
||||||
import com.databasir.dao.impl.DocumentFullTextDao;
|
import com.databasir.dao.impl.DocumentFullTextDao;
|
||||||
import com.databasir.dao.tables.pojos.DocumentFullTextPojo;
|
import com.databasir.dao.tables.pojos.DocumentFullText;
|
||||||
import com.databasir.dao.value.FullTextProjectInfoUpdatePojo;
|
import com.databasir.dao.value.FullTextProjectInfoUpdatePojo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -26,7 +26,7 @@ public class ProjectEventSubscriber {
|
||||||
public void refreshFullTextWhenUpdated(ProjectSaved event) {
|
public void refreshFullTextWhenUpdated(ProjectSaved event) {
|
||||||
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.eq(event.getProjectId())
|
if (!documentFullTextDao.exists(Tables.DOCUMENT_FULL_TEXT.PROJECT_ID.eq(event.getProjectId())
|
||||||
.and(Tables.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.isNull()))) {
|
.and(Tables.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID.isNull()))) {
|
||||||
DocumentFullTextPojo pojo = new DocumentFullTextPojo();
|
DocumentFullText pojo = new DocumentFullText();
|
||||||
pojo.setGroupId(event.getGroupId());
|
pojo.setGroupId(event.getGroupId());
|
||||||
pojo.setProjectId(event.getProjectId());
|
pojo.setProjectId(event.getProjectId());
|
||||||
pojo.setProjectName(event.getProjectName());
|
pojo.setProjectName(event.getProjectName());
|
||||||
|
|
|
@ -8,10 +8,10 @@ import com.databasir.dao.impl.DocumentTemplatePropertyDao;
|
||||||
import com.databasir.dao.impl.SysKeyDao;
|
import com.databasir.dao.impl.SysKeyDao;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.impl.UserRoleDao;
|
import com.databasir.dao.impl.UserRoleDao;
|
||||||
import com.databasir.dao.tables.pojos.DocumentTemplatePropertyPojo;
|
import com.databasir.dao.tables.pojos.DocumentTemplateProperty;
|
||||||
import com.databasir.dao.tables.pojos.SysKeyPojo;
|
import com.databasir.dao.tables.pojos.SysKey;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
@ -55,10 +55,10 @@ public class SystemStartedEventSubscriber {
|
||||||
List<String> ignoreFields = List.of("createAt", "discussionCount", "id",
|
List<String> ignoreFields = List.of("createAt", "discussionCount", "id",
|
||||||
"columns", "indexes", "triggers", "foreignKeys", "diffType", "original", "keySeq");
|
"columns", "indexes", "triggers", "foreignKeys", "diffType", "original", "keySeq");
|
||||||
Map<String, String> fieldChineseMap = fieldChineseMap();
|
Map<String, String> fieldChineseMap = fieldChineseMap();
|
||||||
BiFunction<Field, DocumentTemplatePropertyType, DocumentTemplatePropertyPojo> mapping = (field, type) -> {
|
BiFunction<Field, DocumentTemplatePropertyType, DocumentTemplateProperty> mapping = (field, type) -> {
|
||||||
String key = field.getName();
|
String key = field.getName();
|
||||||
String def = field.getName();
|
String def = field.getName();
|
||||||
DocumentTemplatePropertyPojo pojo = new DocumentTemplatePropertyPojo();
|
DocumentTemplateProperty pojo = new DocumentTemplateProperty();
|
||||||
pojo.setType(type);
|
pojo.setType(type);
|
||||||
pojo.setKey(key);
|
pojo.setKey(key);
|
||||||
pojo.setDefaultValue(fieldChineseMap.getOrDefault(key, def));
|
pojo.setDefaultValue(fieldChineseMap.getOrDefault(key, def));
|
||||||
|
@ -66,40 +66,40 @@ public class SystemStartedEventSubscriber {
|
||||||
};
|
};
|
||||||
// table field name;
|
// table field name;
|
||||||
Field[] fields = TableDocumentResponse.class.getDeclaredFields();
|
Field[] fields = TableDocumentResponse.class.getDeclaredFields();
|
||||||
List<DocumentTemplatePropertyPojo> tableProperties = Arrays.stream(fields)
|
List<DocumentTemplateProperty> tableProperties = Arrays.stream(fields)
|
||||||
.filter(field -> !ignoreFields.contains(field.getName()))
|
.filter(field -> !ignoreFields.contains(field.getName()))
|
||||||
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.TABLE_FIELD_NAME))
|
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.TABLE_FIELD_NAME))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// column field name;
|
// column field name;
|
||||||
Field[] columnFields = TableDocumentResponse.ColumnDocumentResponse.class.getDeclaredFields();
|
Field[] columnFields = TableDocumentResponse.ColumnDocumentResponse.class.getDeclaredFields();
|
||||||
List<DocumentTemplatePropertyPojo> columnProperties = Arrays.stream(columnFields)
|
List<DocumentTemplateProperty> columnProperties = Arrays.stream(columnFields)
|
||||||
.filter(f -> !ignoreFields.contains(f.getName()))
|
.filter(f -> !ignoreFields.contains(f.getName()))
|
||||||
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.COLUMN_FIELD_NAME))
|
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.COLUMN_FIELD_NAME))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// index field name;
|
// index field name;
|
||||||
Field[] indexFields = TableDocumentResponse.IndexDocumentResponse.class.getDeclaredFields();
|
Field[] indexFields = TableDocumentResponse.IndexDocumentResponse.class.getDeclaredFields();
|
||||||
List<DocumentTemplatePropertyPojo> indexProperties = Arrays.stream(indexFields)
|
List<DocumentTemplateProperty> indexProperties = Arrays.stream(indexFields)
|
||||||
.filter(f -> !ignoreFields.contains(f.getName()))
|
.filter(f -> !ignoreFields.contains(f.getName()))
|
||||||
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.INDEX_FIELD_NAME))
|
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.INDEX_FIELD_NAME))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// foreign key field name;
|
// foreign key field name;
|
||||||
Field[] fkFields = TableDocumentResponse.ForeignKeyDocumentResponse.class.getDeclaredFields();
|
Field[] fkFields = TableDocumentResponse.ForeignKeyDocumentResponse.class.getDeclaredFields();
|
||||||
List<DocumentTemplatePropertyPojo> fkProperties = Arrays.stream(fkFields)
|
List<DocumentTemplateProperty> fkProperties = Arrays.stream(fkFields)
|
||||||
.filter(f -> !ignoreFields.contains(f.getName()))
|
.filter(f -> !ignoreFields.contains(f.getName()))
|
||||||
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.FOREIGN_KEY_FIELD_NAME))
|
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.FOREIGN_KEY_FIELD_NAME))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// trigger field name;
|
// trigger field name;
|
||||||
Field[] triggerFields = TableDocumentResponse.TriggerDocumentResponse.class.getDeclaredFields();
|
Field[] triggerFields = TableDocumentResponse.TriggerDocumentResponse.class.getDeclaredFields();
|
||||||
List<DocumentTemplatePropertyPojo> triggerProperties = Arrays.stream(triggerFields)
|
List<DocumentTemplateProperty> triggerProperties = Arrays.stream(triggerFields)
|
||||||
.filter(f -> !ignoreFields.contains(f.getName()))
|
.filter(f -> !ignoreFields.contains(f.getName()))
|
||||||
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.TRIGGER_FIELD_NAME))
|
.map(field -> mapping.apply(field, DocumentTemplatePropertyType.TRIGGER_FIELD_NAME))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<DocumentTemplatePropertyPojo> properties = new ArrayList<>();
|
List<DocumentTemplateProperty> properties = new ArrayList<>();
|
||||||
properties.addAll(tableProperties);
|
properties.addAll(tableProperties);
|
||||||
properties.addAll(columnProperties);
|
properties.addAll(columnProperties);
|
||||||
properties.addAll(indexProperties);
|
properties.addAll(indexProperties);
|
||||||
|
@ -145,7 +145,7 @@ public class SystemStartedEventSubscriber {
|
||||||
private void initSysOwnerIfNecessary() {
|
private void initSysOwnerIfNecessary() {
|
||||||
sysKeyDao.selectOptionTopOne()
|
sysKeyDao.selectOptionTopOne()
|
||||||
.orElseGet(() -> {
|
.orElseGet(() -> {
|
||||||
SysKeyPojo pojo = new SysKeyPojo();
|
SysKey pojo = new SysKey();
|
||||||
pojo.setAesKey(Aes.randomBase64Key());
|
pojo.setAesKey(Aes.randomBase64Key());
|
||||||
Rsa.RsaBase64Key key = Rsa.generateBase64Key();
|
Rsa.RsaBase64Key key = Rsa.generateBase64Key();
|
||||||
pojo.setRsaPublicKey(key.getPublicBase64Key());
|
pojo.setRsaPublicKey(key.getPublicBase64Key());
|
||||||
|
@ -156,16 +156,16 @@ public class SystemStartedEventSubscriber {
|
||||||
|
|
||||||
String email = "N/A";
|
String email = "N/A";
|
||||||
String username = "databasir";
|
String username = "databasir";
|
||||||
Optional<UserPojo> userOpt = userDao.selectByEmailOrUsername(username);
|
Optional<User> userOpt = userDao.selectByEmailOrUsername(username);
|
||||||
if (!userOpt.isPresent()) {
|
if (!userOpt.isPresent()) {
|
||||||
UserPojo admin = new UserPojo();
|
User admin = new User();
|
||||||
admin.setEmail(email);
|
admin.setEmail(email);
|
||||||
admin.setUsername(username);
|
admin.setUsername(username);
|
||||||
admin.setPassword(bCryptPasswordEncoder.encode(username));
|
admin.setPassword(bCryptPasswordEncoder.encode(username));
|
||||||
admin.setEnabled(true);
|
admin.setEnabled(true);
|
||||||
admin.setNickname("Databasir Admin");
|
admin.setNickname("Databasir Admin");
|
||||||
Integer userId = userDao.insertAndReturnId(admin);
|
Integer userId = userDao.insertAndReturnId(admin);
|
||||||
UserRolePojo role = new UserRolePojo();
|
UserRole role = new UserRole();
|
||||||
role.setUserId(userId);
|
role.setUserId(userId);
|
||||||
role.setRole(SYS_OWNER);
|
role.setRole(SYS_OWNER);
|
||||||
userRoleDao.insertAndReturnId(role);
|
userRoleDao.insertAndReturnId(role);
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.databasir.core.infrastructure.mail.MailSender;
|
||||||
import com.databasir.core.infrastructure.mail.MailTemplateProcessor;
|
import com.databasir.core.infrastructure.mail.MailTemplateProcessor;
|
||||||
import com.databasir.dao.impl.SysMailDao;
|
import com.databasir.dao.impl.SysMailDao;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
|
@ -33,7 +33,7 @@ public class UserEventSubscriber {
|
||||||
|
|
||||||
@EventListener(classes = UserPasswordRenewed.class)
|
@EventListener(classes = UserPasswordRenewed.class)
|
||||||
public void onPasswordRenewed(UserPasswordRenewed event) {
|
public void onPasswordRenewed(UserPasswordRenewed event) {
|
||||||
UserPojo operator = userDao.selectById(event.getRenewByUserId());
|
User operator = userDao.selectById(event.getRenewByUserId());
|
||||||
sysMailDao.selectOptionTopOne()
|
sysMailDao.selectOptionTopOne()
|
||||||
.ifPresent(mailPojo -> {
|
.ifPresent(mailPojo -> {
|
||||||
String renewBy = operator.getNickname();
|
String renewBy = operator.getNickname();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.databasir.core.infrastructure.mail;
|
package com.databasir.core.infrastructure.mail;
|
||||||
|
|
||||||
import com.databasir.common.SystemException;
|
import com.databasir.common.SystemException;
|
||||||
import com.databasir.dao.tables.pojos.SysMailPojo;
|
import com.databasir.dao.tables.pojos.SysMail;
|
||||||
import org.springframework.mail.javamail.JavaMailSender;
|
import org.springframework.mail.javamail.JavaMailSender;
|
||||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||||
|
@ -16,14 +16,14 @@ import java.util.Collections;
|
||||||
@Component
|
@Component
|
||||||
public class MailSender {
|
public class MailSender {
|
||||||
|
|
||||||
public void sendHtml(SysMailPojo mail,
|
public void sendHtml(SysMail mail,
|
||||||
String to,
|
String to,
|
||||||
String subject,
|
String subject,
|
||||||
String content) {
|
String content) {
|
||||||
this.batchSendHtml(mail, Collections.singleton(to), subject, content);
|
this.batchSendHtml(mail, Collections.singleton(to), subject, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void batchSendHtml(SysMailPojo mail,
|
public void batchSendHtml(SysMail mail,
|
||||||
Collection<String> to,
|
Collection<String> to,
|
||||||
String subject,
|
String subject,
|
||||||
String content) {
|
String content) {
|
||||||
|
@ -41,7 +41,7 @@ public class MailSender {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private JavaMailSender initJavaMailSender(SysMailPojo properties) {
|
private JavaMailSender initJavaMailSender(SysMail properties) {
|
||||||
JavaMailSenderImpl sender = new JavaMailSenderImpl();
|
JavaMailSenderImpl sender = new JavaMailSenderImpl();
|
||||||
sender.setHost(properties.getSmtpHost());
|
sender.setHost(properties.getSmtpHost());
|
||||||
if (properties.getSmtpPort() != null) {
|
if (properties.getSmtpPort() != null) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.databasir.core.domain.database.data.DatabaseTypeUpdateRequest;
|
||||||
import com.databasir.core.infrastructure.driver.DriverResources;
|
import com.databasir.core.infrastructure.driver.DriverResources;
|
||||||
import com.databasir.core.infrastructure.driver.DriverResult;
|
import com.databasir.core.infrastructure.driver.DriverResult;
|
||||||
import com.databasir.dao.impl.DatabaseTypeDao;
|
import com.databasir.dao.impl.DatabaseTypeDao;
|
||||||
import com.databasir.dao.tables.pojos.DatabaseTypePojo;
|
import com.databasir.dao.tables.pojos.DatabaseType;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
@ -87,7 +87,7 @@ class DatabaseTypeServiceTest extends BaseTest {
|
||||||
request.setUrlPattern("{{jdbc.protocol}}//{{db.url}}/{{db.schema}}");
|
request.setUrlPattern("{{jdbc.protocol}}//{{db.url}}/{{db.schema}}");
|
||||||
databaseTypeService.update(request);
|
databaseTypeService.update(request);
|
||||||
|
|
||||||
DatabaseTypePojo pojo = databaseTypeDao.selectByDatabaseType("new-type");
|
DatabaseType pojo = databaseTypeDao.selectByDatabaseType("new-type");
|
||||||
Assertions.assertNotNull(pojo);
|
Assertions.assertNotNull(pojo);
|
||||||
Assertions.assertEquals("integration test", pojo.getDescription());
|
Assertions.assertEquals("integration test", pojo.getDescription());
|
||||||
Assertions.assertEquals("jdbc:postgresql", pojo.getJdbcProtocol());
|
Assertions.assertEquals("jdbc:postgresql", pojo.getJdbcProtocol());
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.databasir.core.domain.description.service;
|
||||||
import com.databasir.core.BaseTest;
|
import com.databasir.core.BaseTest;
|
||||||
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest;
|
import com.databasir.core.domain.description.data.DocumentDescriptionSaveRequest;
|
||||||
import com.databasir.dao.impl.DocumentDescriptionDao;
|
import com.databasir.dao.impl.DocumentDescriptionDao;
|
||||||
import com.databasir.dao.tables.pojos.DocumentDescriptionPojo;
|
import com.databasir.dao.tables.pojos.DocumentDescription;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -42,7 +42,7 @@ class DocumentDescriptionServiceTest extends BaseTest {
|
||||||
documentDescriptionService.save(groupId, projectId, userId, updateRequest);
|
documentDescriptionService.save(groupId, projectId, userId, updateRequest);
|
||||||
var tableData = documentDescriptionDao.selectTableDescriptionByProjectId(projectId);
|
var tableData = documentDescriptionDao.selectTableDescriptionByProjectId(projectId);
|
||||||
Assertions.assertEquals(0, tableData.size());
|
Assertions.assertEquals(0, tableData.size());
|
||||||
List<DocumentDescriptionPojo> descriptionData = documentDescriptionDao.selectByProjectId(projectId);
|
List<DocumentDescription> descriptionData = documentDescriptionDao.selectByProjectId(projectId);
|
||||||
Assertions.assertEquals(1, descriptionData.size());
|
Assertions.assertEquals(1, descriptionData.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,8 +12,8 @@ import com.databasir.dao.impl.GroupDao;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.impl.ProjectSyncRuleDao;
|
import com.databasir.dao.impl.ProjectSyncRuleDao;
|
||||||
import com.databasir.dao.impl.UserRoleDao;
|
import com.databasir.dao.impl.UserRoleDao;
|
||||||
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo;
|
import com.databasir.dao.tables.pojos.ProjectSyncRule;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.jdbc.Sql;
|
import org.springframework.test.context.jdbc.Sql;
|
||||||
|
@ -53,7 +53,7 @@ class GroupServiceTest extends BaseTest {
|
||||||
Integer groupId = groupService.create(request);
|
Integer groupId = groupService.create(request);
|
||||||
assertNotNull(groupId);
|
assertNotNull(groupId);
|
||||||
|
|
||||||
List<UserRolePojo> roles = userRoleDao.selectByUserIds(List.of(1, 2, 3))
|
List<UserRole> roles = userRoleDao.selectByUserIds(List.of(1, 2, 3))
|
||||||
.stream()
|
.stream()
|
||||||
.filter(r -> Objects.equals(r.getGroupId(), groupId) && r.getRole().equals("GROUP_OWNER"))
|
.filter(r -> Objects.equals(r.getGroupId(), groupId) && r.getRole().equals("GROUP_OWNER"))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
@ -71,11 +71,11 @@ class GroupServiceTest extends BaseTest {
|
||||||
request.setGroupOwnerUserIds(List.of(1000, 1001));
|
request.setGroupOwnerUserIds(List.of(1000, 1001));
|
||||||
groupService.update(request);
|
groupService.update(request);
|
||||||
|
|
||||||
List<UserRolePojo> members = userRoleDao.selectList(Tables.USER_ROLE.GROUP_ID.eq(groupId));
|
List<UserRole> members = userRoleDao.selectList(Tables.USER_ROLE.GROUP_ID.eq(groupId));
|
||||||
assertEquals(3, members.size());
|
assertEquals(3, members.size());
|
||||||
List<Integer> ownerUserIds = members.stream()
|
List<Integer> ownerUserIds = members.stream()
|
||||||
.filter(r -> r.getRole().equals("GROUP_OWNER"))
|
.filter(r -> r.getRole().equals("GROUP_OWNER"))
|
||||||
.map(UserRolePojo::getUserId)
|
.map(UserRole::getUserId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
assertEquals(2, ownerUserIds.size());
|
assertEquals(2, ownerUserIds.size());
|
||||||
assertTrue(ownerUserIds.contains(1000));
|
assertTrue(ownerUserIds.contains(1000));
|
||||||
|
@ -95,11 +95,11 @@ class GroupServiceTest extends BaseTest {
|
||||||
assertEquals(0, projectIds.size());
|
assertEquals(0, projectIds.size());
|
||||||
|
|
||||||
// should clear group members
|
// should clear group members
|
||||||
List<UserRolePojo> members = userRoleDao.selectList(Tables.USER_ROLE.GROUP_ID.eq(groupId));
|
List<UserRole> members = userRoleDao.selectList(Tables.USER_ROLE.GROUP_ID.eq(groupId));
|
||||||
assertEquals(0, members.size());
|
assertEquals(0, members.size());
|
||||||
|
|
||||||
// should clear project sync schedule
|
// should clear project sync schedule
|
||||||
List<ProjectSyncRulePojo> syncRule = projectSyncRuleDao.selectInProjectIds(undeleteProjectIds);
|
List<ProjectSyncRule> syncRule = projectSyncRuleDao.selectInProjectIds(undeleteProjectIds);
|
||||||
assertTrue(syncRule.stream().allMatch(r -> !r.getIsAutoSync()));
|
assertTrue(syncRule.stream().allMatch(r -> !r.getIsAutoSync()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ class GroupServiceTest extends BaseTest {
|
||||||
|
|
||||||
groupService.changeMemberRole(groupId, userId, RoleConstants.GROUP_OWNER);
|
groupService.changeMemberRole(groupId, userId, RoleConstants.GROUP_OWNER);
|
||||||
assertTrue(userRoleDao.hasRole(userId, groupId, RoleConstants.GROUP_OWNER));
|
assertTrue(userRoleDao.hasRole(userId, groupId, RoleConstants.GROUP_OWNER));
|
||||||
List<UserRolePojo> roles = userRoleDao.selectByUserIds(List.of(userId));
|
List<UserRole> roles = userRoleDao.selectByUserIds(List.of(userId));
|
||||||
assertEquals(1, roles.size());
|
assertEquals(1, roles.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ import com.databasir.core.domain.login.data.AccessTokenRefreshRequest;
|
||||||
import com.databasir.core.domain.login.data.AccessTokenRefreshResponse;
|
import com.databasir.core.domain.login.data.AccessTokenRefreshResponse;
|
||||||
import com.databasir.core.domain.login.data.LoginKeyResponse;
|
import com.databasir.core.domain.login.data.LoginKeyResponse;
|
||||||
import com.databasir.dao.impl.LoginDao;
|
import com.databasir.dao.impl.LoginDao;
|
||||||
import com.databasir.dao.tables.pojos.LoginPojo;
|
import com.databasir.dao.tables.pojos.Login;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -74,7 +74,7 @@ class LoginServiceTest extends BaseTest {
|
||||||
int userId = -1000;
|
int userId = -1000;
|
||||||
LoginKeyResponse token = loginService.generate(userId);
|
LoginKeyResponse token = loginService.generate(userId);
|
||||||
Assertions.assertNotNull(token);
|
Assertions.assertNotNull(token);
|
||||||
Optional<LoginPojo> loginOpt = loginDao.selectByUserId(userId);
|
Optional<Login> loginOpt = loginDao.selectByUserId(userId);
|
||||||
Assertions.assertTrue(loginOpt.isPresent());
|
Assertions.assertTrue(loginOpt.isPresent());
|
||||||
Assertions.assertEquals(token.getAccessToken(), loginOpt.get().getAccessToken());
|
Assertions.assertEquals(token.getAccessToken(), loginOpt.get().getAccessToken());
|
||||||
Assertions.assertEquals(token.getRefreshToken(), loginOpt.get().getRefreshToken());
|
Assertions.assertEquals(token.getRefreshToken(), loginOpt.get().getRefreshToken());
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.databasir.core.domain.project.data.ProjectUpdateRequest.ProjectSyncRu
|
||||||
import com.databasir.core.infrastructure.connection.DatabaseTypes;
|
import com.databasir.core.infrastructure.connection.DatabaseTypes;
|
||||||
import com.databasir.dao.impl.ProjectDao;
|
import com.databasir.dao.impl.ProjectDao;
|
||||||
import com.databasir.dao.impl.ProjectSyncRuleDao;
|
import com.databasir.dao.impl.ProjectSyncRuleDao;
|
||||||
import com.databasir.dao.tables.pojos.ProjectSyncRulePojo;
|
import com.databasir.dao.tables.pojos.ProjectSyncRule;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -105,7 +105,7 @@ class ProjectServiceTest extends BaseTest {
|
||||||
int projectId = -1000;
|
int projectId = -1000;
|
||||||
projectService.delete(projectId);
|
projectService.delete(projectId);
|
||||||
Assertions.assertFalse(projectDao.existsById(projectId));
|
Assertions.assertFalse(projectDao.existsById(projectId));
|
||||||
ProjectSyncRulePojo syncRule = projectSyncRuleDao.selectByProjectId(projectId);
|
ProjectSyncRule syncRule = projectSyncRuleDao.selectByProjectId(projectId);
|
||||||
Assertions.assertNotNull(syncRule);
|
Assertions.assertNotNull(syncRule);
|
||||||
Assertions.assertNotNull(syncRule.getAutoSyncCron());
|
Assertions.assertNotNull(syncRule.getAutoSyncCron());
|
||||||
Assertions.assertFalse(syncRule.getIsAutoSync());
|
Assertions.assertFalse(syncRule.getIsAutoSync());
|
||||||
|
|
|
@ -9,9 +9,9 @@ import com.databasir.core.infrastructure.event.subscriber.UserEventSubscriber;
|
||||||
import com.databasir.dao.impl.LoginDao;
|
import com.databasir.dao.impl.LoginDao;
|
||||||
import com.databasir.dao.impl.UserDao;
|
import com.databasir.dao.impl.UserDao;
|
||||||
import com.databasir.dao.impl.UserRoleDao;
|
import com.databasir.dao.impl.UserRoleDao;
|
||||||
import com.databasir.dao.tables.pojos.LoginPojo;
|
import com.databasir.dao.tables.pojos.Login;
|
||||||
import com.databasir.dao.tables.pojos.UserPojo;
|
import com.databasir.dao.tables.pojos.User;
|
||||||
import com.databasir.dao.tables.pojos.UserRolePojo;
|
import com.databasir.dao.tables.pojos.UserRole;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||||
|
@ -78,12 +78,12 @@ class UserServiceTest extends BaseTest {
|
||||||
void switchEnableStatusToFalse() {
|
void switchEnableStatusToFalse() {
|
||||||
Integer userId = -999;
|
Integer userId = -999;
|
||||||
userService.switchEnableStatus(userId, false);
|
userService.switchEnableStatus(userId, false);
|
||||||
UserPojo user = userDao.selectById(userId);
|
User user = userDao.selectById(userId);
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
assertFalse(user.getEnabled());
|
assertFalse(user.getEnabled());
|
||||||
|
|
||||||
Optional<LoginPojo> loginPojoOpt = loginDao.selectByUserId(userId);
|
Optional<Login> login = loginDao.selectByUserId(userId);
|
||||||
assertTrue(loginPojoOpt.isEmpty());
|
assertTrue(login.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -91,7 +91,7 @@ class UserServiceTest extends BaseTest {
|
||||||
void removeSysOwnerFrom() {
|
void removeSysOwnerFrom() {
|
||||||
Integer userId = -998;
|
Integer userId = -998;
|
||||||
userService.removeSysOwnerFrom(userId);
|
userService.removeSysOwnerFrom(userId);
|
||||||
List<UserRolePojo> roles = userRoleDao.selectByUserIds(Collections.singletonList(userId))
|
List<UserRole> roles = userRoleDao.selectByUserIds(Collections.singletonList(userId))
|
||||||
.stream().filter(role -> role.getRole().equals(SYS_OWNER))
|
.stream().filter(role -> role.getRole().equals(SYS_OWNER))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
assertEquals(0, roles.size());
|
assertEquals(0, roles.size());
|
||||||
|
@ -102,7 +102,7 @@ class UserServiceTest extends BaseTest {
|
||||||
void addSysOwnerTo() {
|
void addSysOwnerTo() {
|
||||||
Integer userId = -999;
|
Integer userId = -999;
|
||||||
userService.addSysOwnerTo(userId);
|
userService.addSysOwnerTo(userId);
|
||||||
List<UserRolePojo> roles = userRoleDao.selectByUserIds(Collections.singletonList(userId))
|
List<UserRole> roles = userRoleDao.selectByUserIds(Collections.singletonList(userId))
|
||||||
.stream().filter(role -> role.getRole().equals(SYS_OWNER))
|
.stream().filter(role -> role.getRole().equals(SYS_OWNER))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
@ -120,8 +120,8 @@ class UserServiceTest extends BaseTest {
|
||||||
Integer userId = -999;
|
Integer userId = -999;
|
||||||
userService.updatePassword(userId, request);
|
userService.updatePassword(userId, request);
|
||||||
// should delete login info
|
// should delete login info
|
||||||
Optional<LoginPojo> loginPojoOpt = loginDao.selectByUserId(userId);
|
Optional<Login> login = loginDao.selectByUserId(userId);
|
||||||
assertTrue(loginPojoOpt.isEmpty());
|
assertTrue(login.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -133,7 +133,7 @@ class UserServiceTest extends BaseTest {
|
||||||
request.setNickname(nickname);
|
request.setNickname(nickname);
|
||||||
userService.updateNickname(userId, request);
|
userService.updateNickname(userId, request);
|
||||||
|
|
||||||
UserPojo user = userDao.selectById(userId);
|
User user = userDao.selectById(userId);
|
||||||
assertNotNull(user);
|
assertNotNull(user);
|
||||||
assertEquals(nickname, user.getNickname());
|
assertEquals(nickname, user.getNickname());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,32 +4,32 @@
|
||||||
package com.databasir.dao;
|
package com.databasir.dao;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.dao.tables.DataSource;
|
import com.databasir.dao.tables.DataSourcePropertyTable;
|
||||||
import com.databasir.dao.tables.DataSourceProperty;
|
import com.databasir.dao.tables.DataSourceTable;
|
||||||
import com.databasir.dao.tables.DatabaseDocument;
|
import com.databasir.dao.tables.DatabaseDocumentTable;
|
||||||
import com.databasir.dao.tables.DatabaseType;
|
import com.databasir.dao.tables.DatabaseTypeTable;
|
||||||
import com.databasir.dao.tables.DocumentDescription;
|
import com.databasir.dao.tables.DocumentDescriptionTable;
|
||||||
import com.databasir.dao.tables.DocumentDiscussion;
|
import com.databasir.dao.tables.DocumentDiscussionTable;
|
||||||
import com.databasir.dao.tables.DocumentFullText;
|
import com.databasir.dao.tables.DocumentFullTextTable;
|
||||||
import com.databasir.dao.tables.DocumentTemplateProperty;
|
import com.databasir.dao.tables.DocumentTemplatePropertyTable;
|
||||||
import com.databasir.dao.tables.Group;
|
import com.databasir.dao.tables.GroupTable;
|
||||||
import com.databasir.dao.tables.Login;
|
import com.databasir.dao.tables.LoginTable;
|
||||||
import com.databasir.dao.tables.MockDataRule;
|
import com.databasir.dao.tables.MockDataRuleTable;
|
||||||
import com.databasir.dao.tables.OauthApp;
|
import com.databasir.dao.tables.OauthAppTable;
|
||||||
import com.databasir.dao.tables.OperationLog;
|
import com.databasir.dao.tables.OperationLogTable;
|
||||||
import com.databasir.dao.tables.Project;
|
import com.databasir.dao.tables.ProjectSyncRuleTable;
|
||||||
import com.databasir.dao.tables.ProjectSyncRule;
|
import com.databasir.dao.tables.ProjectSyncTaskTable;
|
||||||
import com.databasir.dao.tables.ProjectSyncTask;
|
import com.databasir.dao.tables.ProjectTable;
|
||||||
import com.databasir.dao.tables.SysKey;
|
import com.databasir.dao.tables.SysKeyTable;
|
||||||
import com.databasir.dao.tables.SysMail;
|
import com.databasir.dao.tables.SysMailTable;
|
||||||
import com.databasir.dao.tables.TableColumnDocument;
|
import com.databasir.dao.tables.TableColumnDocumentTable;
|
||||||
import com.databasir.dao.tables.TableDocument;
|
import com.databasir.dao.tables.TableDocumentTable;
|
||||||
import com.databasir.dao.tables.TableForeignKeyDocument;
|
import com.databasir.dao.tables.TableForeignKeyDocumentTable;
|
||||||
import com.databasir.dao.tables.TableIndexDocument;
|
import com.databasir.dao.tables.TableIndexDocumentTable;
|
||||||
import com.databasir.dao.tables.TableTriggerDocument;
|
import com.databasir.dao.tables.TableTriggerDocumentTable;
|
||||||
import com.databasir.dao.tables.User;
|
import com.databasir.dao.tables.UserFavoriteProjectTable;
|
||||||
import com.databasir.dao.tables.UserFavoriteProject;
|
import com.databasir.dao.tables.UserRoleTable;
|
||||||
import com.databasir.dao.tables.UserRole;
|
import com.databasir.dao.tables.UserTable;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -55,132 +55,132 @@ public class Databasir extends SchemaImpl {
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.data_source</code>.
|
* The table <code>databasir.data_source</code>.
|
||||||
*/
|
*/
|
||||||
public final DataSource DATA_SOURCE = DataSource.DATA_SOURCE;
|
public final DataSourceTable DATA_SOURCE = DataSourceTable.DATA_SOURCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.data_source_property</code>.
|
* The table <code>databasir.data_source_property</code>.
|
||||||
*/
|
*/
|
||||||
public final DataSourceProperty DATA_SOURCE_PROPERTY = DataSourceProperty.DATA_SOURCE_PROPERTY;
|
public final DataSourcePropertyTable DATA_SOURCE_PROPERTY = DataSourcePropertyTable.DATA_SOURCE_PROPERTY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.database_document</code>.
|
* The table <code>databasir.database_document</code>.
|
||||||
*/
|
*/
|
||||||
public final DatabaseDocument DATABASE_DOCUMENT = DatabaseDocument.DATABASE_DOCUMENT;
|
public final DatabaseDocumentTable DATABASE_DOCUMENT = DatabaseDocumentTable.DATABASE_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* customer database types
|
* customer database types
|
||||||
*/
|
*/
|
||||||
public final DatabaseType DATABASE_TYPE = DatabaseType.DATABASE_TYPE;
|
public final DatabaseTypeTable DATABASE_TYPE = DatabaseTypeTable.DATABASE_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* custom document description
|
* custom document description
|
||||||
*/
|
*/
|
||||||
public final DocumentDescription DOCUMENT_DESCRIPTION = DocumentDescription.DOCUMENT_DESCRIPTION;
|
public final DocumentDescriptionTable DOCUMENT_DESCRIPTION = DocumentDescriptionTable.DOCUMENT_DESCRIPTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.document_discussion</code>.
|
* The table <code>databasir.document_discussion</code>.
|
||||||
*/
|
*/
|
||||||
public final DocumentDiscussion DOCUMENT_DISCUSSION = DocumentDiscussion.DOCUMENT_DISCUSSION;
|
public final DocumentDiscussionTable DOCUMENT_DISCUSSION = DocumentDiscussionTable.DOCUMENT_DISCUSSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.document_full_text</code>.
|
* The table <code>databasir.document_full_text</code>.
|
||||||
*/
|
*/
|
||||||
public final DocumentFullText DOCUMENT_FULL_TEXT = DocumentFullText.DOCUMENT_FULL_TEXT;
|
public final DocumentFullTextTable DOCUMENT_FULL_TEXT = DocumentFullTextTable.DOCUMENT_FULL_TEXT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* template property
|
* template property
|
||||||
*/
|
*/
|
||||||
public final DocumentTemplateProperty DOCUMENT_TEMPLATE_PROPERTY = DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY;
|
public final DocumentTemplatePropertyTable DOCUMENT_TEMPLATE_PROPERTY = DocumentTemplatePropertyTable.DOCUMENT_TEMPLATE_PROPERTY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.group</code>.
|
* The table <code>databasir.group</code>.
|
||||||
*/
|
*/
|
||||||
public final Group GROUP = Group.GROUP;
|
public final GroupTable GROUP = GroupTable.GROUP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.login</code>.
|
* The table <code>databasir.login</code>.
|
||||||
*/
|
*/
|
||||||
public final Login LOGIN = Login.LOGIN;
|
public final LoginTable LOGIN = LoginTable.LOGIN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.mock_data_rule</code>.
|
* The table <code>databasir.mock_data_rule</code>.
|
||||||
*/
|
*/
|
||||||
public final MockDataRule MOCK_DATA_RULE = MockDataRule.MOCK_DATA_RULE;
|
public final MockDataRuleTable MOCK_DATA_RULE = MockDataRuleTable.MOCK_DATA_RULE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oauth app info
|
* oauth app info
|
||||||
*/
|
*/
|
||||||
public final OauthApp OAUTH_APP = OauthApp.OAUTH_APP;
|
public final OauthAppTable OAUTH_APP = OauthAppTable.OAUTH_APP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.operation_log</code>.
|
* The table <code>databasir.operation_log</code>.
|
||||||
*/
|
*/
|
||||||
public final OperationLog OPERATION_LOG = OperationLog.OPERATION_LOG;
|
public final OperationLogTable OPERATION_LOG = OperationLogTable.OPERATION_LOG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.project</code>.
|
* The table <code>databasir.project</code>.
|
||||||
*/
|
*/
|
||||||
public final Project PROJECT = Project.PROJECT;
|
public final ProjectTable PROJECT = ProjectTable.PROJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.project_sync_rule</code>.
|
* The table <code>databasir.project_sync_rule</code>.
|
||||||
*/
|
*/
|
||||||
public final ProjectSyncRule PROJECT_SYNC_RULE = ProjectSyncRule.PROJECT_SYNC_RULE;
|
public final ProjectSyncRuleTable PROJECT_SYNC_RULE = ProjectSyncRuleTable.PROJECT_SYNC_RULE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.project_sync_task</code>.
|
* The table <code>databasir.project_sync_task</code>.
|
||||||
*/
|
*/
|
||||||
public final ProjectSyncTask PROJECT_SYNC_TASK = ProjectSyncTask.PROJECT_SYNC_TASK;
|
public final ProjectSyncTaskTable PROJECT_SYNC_TASK = ProjectSyncTaskTable.PROJECT_SYNC_TASK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.sys_key</code>.
|
* The table <code>databasir.sys_key</code>.
|
||||||
*/
|
*/
|
||||||
public final SysKey SYS_KEY = SysKey.SYS_KEY;
|
public final SysKeyTable SYS_KEY = SysKeyTable.SYS_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.sys_mail</code>.
|
* The table <code>databasir.sys_mail</code>.
|
||||||
*/
|
*/
|
||||||
public final SysMail SYS_MAIL = SysMail.SYS_MAIL;
|
public final SysMailTable SYS_MAIL = SysMailTable.SYS_MAIL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_column_document</code>.
|
* The table <code>databasir.table_column_document</code>.
|
||||||
*/
|
*/
|
||||||
public final TableColumnDocument TABLE_COLUMN_DOCUMENT = TableColumnDocument.TABLE_COLUMN_DOCUMENT;
|
public final TableColumnDocumentTable TABLE_COLUMN_DOCUMENT = TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_document</code>.
|
* The table <code>databasir.table_document</code>.
|
||||||
*/
|
*/
|
||||||
public final TableDocument TABLE_DOCUMENT = TableDocument.TABLE_DOCUMENT;
|
public final TableDocumentTable TABLE_DOCUMENT = TableDocumentTable.TABLE_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_foreign_key_document</code>.
|
* The table <code>databasir.table_foreign_key_document</code>.
|
||||||
*/
|
*/
|
||||||
public final TableForeignKeyDocument TABLE_FOREIGN_KEY_DOCUMENT = TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT;
|
public final TableForeignKeyDocumentTable TABLE_FOREIGN_KEY_DOCUMENT = TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_index_document</code>.
|
* The table <code>databasir.table_index_document</code>.
|
||||||
*/
|
*/
|
||||||
public final TableIndexDocument TABLE_INDEX_DOCUMENT = TableIndexDocument.TABLE_INDEX_DOCUMENT;
|
public final TableIndexDocumentTable TABLE_INDEX_DOCUMENT = TableIndexDocumentTable.TABLE_INDEX_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_trigger_document</code>.
|
* The table <code>databasir.table_trigger_document</code>.
|
||||||
*/
|
*/
|
||||||
public final TableTriggerDocument TABLE_TRIGGER_DOCUMENT = TableTriggerDocument.TABLE_TRIGGER_DOCUMENT;
|
public final TableTriggerDocumentTable TABLE_TRIGGER_DOCUMENT = TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.user</code>.
|
* The table <code>databasir.user</code>.
|
||||||
*/
|
*/
|
||||||
public final User USER = User.USER;
|
public final UserTable USER = UserTable.USER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.user_favorite_project</code>.
|
* The table <code>databasir.user_favorite_project</code>.
|
||||||
*/
|
*/
|
||||||
public final UserFavoriteProject USER_FAVORITE_PROJECT = UserFavoriteProject.USER_FAVORITE_PROJECT;
|
public final UserFavoriteProjectTable USER_FAVORITE_PROJECT = UserFavoriteProjectTable.USER_FAVORITE_PROJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.user_role</code>.
|
* The table <code>databasir.user_role</code>.
|
||||||
*/
|
*/
|
||||||
public final UserRole USER_ROLE = UserRole.USER_ROLE;
|
public final UserRoleTable USER_ROLE = UserRoleTable.USER_ROLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No further instances allowed
|
* No further instances allowed
|
||||||
|
@ -198,32 +198,32 @@ public class Databasir extends SchemaImpl {
|
||||||
@Override
|
@Override
|
||||||
public final List<Table<?>> getTables() {
|
public final List<Table<?>> getTables() {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
DataSource.DATA_SOURCE,
|
DataSourceTable.DATA_SOURCE,
|
||||||
DataSourceProperty.DATA_SOURCE_PROPERTY,
|
DataSourcePropertyTable.DATA_SOURCE_PROPERTY,
|
||||||
DatabaseDocument.DATABASE_DOCUMENT,
|
DatabaseDocumentTable.DATABASE_DOCUMENT,
|
||||||
DatabaseType.DATABASE_TYPE,
|
DatabaseTypeTable.DATABASE_TYPE,
|
||||||
DocumentDescription.DOCUMENT_DESCRIPTION,
|
DocumentDescriptionTable.DOCUMENT_DESCRIPTION,
|
||||||
DocumentDiscussion.DOCUMENT_DISCUSSION,
|
DocumentDiscussionTable.DOCUMENT_DISCUSSION,
|
||||||
DocumentFullText.DOCUMENT_FULL_TEXT,
|
DocumentFullTextTable.DOCUMENT_FULL_TEXT,
|
||||||
DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY,
|
DocumentTemplatePropertyTable.DOCUMENT_TEMPLATE_PROPERTY,
|
||||||
Group.GROUP,
|
GroupTable.GROUP,
|
||||||
Login.LOGIN,
|
LoginTable.LOGIN,
|
||||||
MockDataRule.MOCK_DATA_RULE,
|
MockDataRuleTable.MOCK_DATA_RULE,
|
||||||
OauthApp.OAUTH_APP,
|
OauthAppTable.OAUTH_APP,
|
||||||
OperationLog.OPERATION_LOG,
|
OperationLogTable.OPERATION_LOG,
|
||||||
Project.PROJECT,
|
ProjectTable.PROJECT,
|
||||||
ProjectSyncRule.PROJECT_SYNC_RULE,
|
ProjectSyncRuleTable.PROJECT_SYNC_RULE,
|
||||||
ProjectSyncTask.PROJECT_SYNC_TASK,
|
ProjectSyncTaskTable.PROJECT_SYNC_TASK,
|
||||||
SysKey.SYS_KEY,
|
SysKeyTable.SYS_KEY,
|
||||||
SysMail.SYS_MAIL,
|
SysMailTable.SYS_MAIL,
|
||||||
TableColumnDocument.TABLE_COLUMN_DOCUMENT,
|
TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT,
|
||||||
TableDocument.TABLE_DOCUMENT,
|
TableDocumentTable.TABLE_DOCUMENT,
|
||||||
TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT,
|
TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT,
|
||||||
TableIndexDocument.TABLE_INDEX_DOCUMENT,
|
TableIndexDocumentTable.TABLE_INDEX_DOCUMENT,
|
||||||
TableTriggerDocument.TABLE_TRIGGER_DOCUMENT,
|
TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT,
|
||||||
User.USER,
|
UserTable.USER,
|
||||||
UserFavoriteProject.USER_FAVORITE_PROJECT,
|
UserFavoriteProjectTable.USER_FAVORITE_PROJECT,
|
||||||
UserRole.USER_ROLE
|
UserRoleTable.USER_ROLE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
package com.databasir.dao;
|
package com.databasir.dao;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.dao.tables.DataSourceProperty;
|
import com.databasir.dao.tables.DataSourcePropertyTable;
|
||||||
import com.databasir.dao.tables.DocumentDiscussion;
|
import com.databasir.dao.tables.DocumentDiscussionTable;
|
||||||
import com.databasir.dao.tables.DocumentFullText;
|
import com.databasir.dao.tables.DocumentFullTextTable;
|
||||||
import com.databasir.dao.tables.ProjectSyncTask;
|
import com.databasir.dao.tables.ProjectSyncTaskTable;
|
||||||
import com.databasir.dao.tables.TableColumnDocument;
|
import com.databasir.dao.tables.TableColumnDocumentTable;
|
||||||
import com.databasir.dao.tables.TableDocument;
|
import com.databasir.dao.tables.TableDocumentTable;
|
||||||
import com.databasir.dao.tables.TableForeignKeyDocument;
|
import com.databasir.dao.tables.TableForeignKeyDocumentTable;
|
||||||
import com.databasir.dao.tables.TableIndexDocument;
|
import com.databasir.dao.tables.TableIndexDocumentTable;
|
||||||
import com.databasir.dao.tables.TableTriggerDocument;
|
import com.databasir.dao.tables.TableTriggerDocumentTable;
|
||||||
|
|
||||||
import org.jooq.Index;
|
import org.jooq.Index;
|
||||||
import org.jooq.OrderField;
|
import org.jooq.OrderField;
|
||||||
|
@ -30,24 +30,24 @@ public class Indexes {
|
||||||
// INDEX definitions
|
// INDEX definitions
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
public static final Index DOCUMENT_FULL_TEXT_FIDX_COLUMN = Internal.createIndex(DSL.name("FIDX_COLUMN"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.COL_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.COL_COMMENT, DocumentFullText.DOCUMENT_FULL_TEXT.COL_DESCRIPTION, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
|
public static final Index DOCUMENT_FULL_TEXT_FIDX_COLUMN = Internal.createIndex(DSL.name("FIDX_COLUMN"), DocumentFullTextTable.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullTextTable.DOCUMENT_FULL_TEXT.COL_NAME, DocumentFullTextTable.DOCUMENT_FULL_TEXT.COL_COMMENT, DocumentFullTextTable.DOCUMENT_FULL_TEXT.COL_DESCRIPTION, DocumentFullTextTable.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
|
||||||
public static final Index DOCUMENT_FULL_TEXT_FIDX_GROUP = Internal.createIndex(DSL.name("FIDX_GROUP"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION }, false);
|
public static final Index DOCUMENT_FULL_TEXT_FIDX_GROUP = Internal.createIndex(DSL.name("FIDX_GROUP"), DocumentFullTextTable.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullTextTable.DOCUMENT_FULL_TEXT.GROUP_NAME, DocumentFullTextTable.DOCUMENT_FULL_TEXT.GROUP_DESCRIPTION }, false);
|
||||||
public static final Index DOCUMENT_FULL_TEXT_FIDX_PROJECT = Internal.createIndex(DSL.name("FIDX_PROJECT"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION, DocumentFullText.DOCUMENT_FULL_TEXT.SCHEMA_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_TYPE }, false);
|
public static final Index DOCUMENT_FULL_TEXT_FIDX_PROJECT = Internal.createIndex(DSL.name("FIDX_PROJECT"), DocumentFullTextTable.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullTextTable.DOCUMENT_FULL_TEXT.PROJECT_NAME, DocumentFullTextTable.DOCUMENT_FULL_TEXT.PROJECT_DESCRIPTION, DocumentFullTextTable.DOCUMENT_FULL_TEXT.SCHEMA_NAME, DocumentFullTextTable.DOCUMENT_FULL_TEXT.DATABASE_NAME, DocumentFullTextTable.DOCUMENT_FULL_TEXT.DATABASE_TYPE }, false);
|
||||||
public static final Index DOCUMENT_FULL_TEXT_FIDX_TABLE = Internal.createIndex(DSL.name("FIDX_TABLE"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_NAME, DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_COMMENT, DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_DESCRIPTION, DocumentFullText.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
|
public static final Index DOCUMENT_FULL_TEXT_FIDX_TABLE = Internal.createIndex(DSL.name("FIDX_TABLE"), DocumentFullTextTable.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullTextTable.DOCUMENT_FULL_TEXT.TABLE_NAME, DocumentFullTextTable.DOCUMENT_FULL_TEXT.TABLE_COMMENT, DocumentFullTextTable.DOCUMENT_FULL_TEXT.TABLE_DESCRIPTION, DocumentFullTextTable.DOCUMENT_FULL_TEXT.DATABASE_PRODUCT_NAME }, false);
|
||||||
public static final Index DATA_SOURCE_PROPERTY_IDX_DATA_SOURCE_ID = Internal.createIndex(DSL.name("idx_data_source_id"), DataSourceProperty.DATA_SOURCE_PROPERTY, new OrderField[] { DataSourceProperty.DATA_SOURCE_PROPERTY.DATA_SOURCE_ID }, false);
|
public static final Index DATA_SOURCE_PROPERTY_IDX_DATA_SOURCE_ID = Internal.createIndex(DSL.name("idx_data_source_id"), DataSourcePropertyTable.DATA_SOURCE_PROPERTY, new OrderField[] { DataSourcePropertyTable.DATA_SOURCE_PROPERTY.DATA_SOURCE_ID }, false);
|
||||||
public static final Index TABLE_COLUMN_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableColumnDocument.TABLE_COLUMN_DOCUMENT, new OrderField[] { TableColumnDocument.TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
public static final Index TABLE_COLUMN_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT, new OrderField[] { TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
||||||
public static final Index TABLE_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableDocument.TABLE_DOCUMENT, new OrderField[] { TableDocument.TABLE_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
public static final Index TABLE_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableDocumentTable.TABLE_DOCUMENT, new OrderField[] { TableDocumentTable.TABLE_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
||||||
public static final Index TABLE_FOREIGN_KEY_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT, new OrderField[] { TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
public static final Index TABLE_FOREIGN_KEY_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT, new OrderField[] { TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
||||||
public static final Index TABLE_INDEX_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableIndexDocument.TABLE_INDEX_DOCUMENT, new OrderField[] { TableIndexDocument.TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
public static final Index TABLE_INDEX_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableIndexDocumentTable.TABLE_INDEX_DOCUMENT, new OrderField[] { TableIndexDocumentTable.TABLE_INDEX_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
||||||
public static final Index TABLE_TRIGGER_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableTriggerDocument.TABLE_TRIGGER_DOCUMENT, new OrderField[] { TableTriggerDocument.TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
public static final Index TABLE_TRIGGER_DOCUMENT_IDX_DATABASE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_database_document_id"), TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT, new OrderField[] { TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT.DATABASE_DOCUMENT_ID }, false);
|
||||||
public static final Index DOCUMENT_FULL_TEXT_IDX_GROUP_ID = Internal.createIndex(DSL.name("IDX_GROUP_ID"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.GROUP_ID }, false);
|
public static final Index DOCUMENT_FULL_TEXT_IDX_GROUP_ID = Internal.createIndex(DSL.name("IDX_GROUP_ID"), DocumentFullTextTable.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullTextTable.DOCUMENT_FULL_TEXT.GROUP_ID }, false);
|
||||||
public static final Index DOCUMENT_DISCUSSION_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DocumentDiscussion.DOCUMENT_DISCUSSION, new OrderField[] { DocumentDiscussion.DOCUMENT_DISCUSSION.PROJECT_ID }, false);
|
public static final Index DOCUMENT_DISCUSSION_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), DocumentDiscussionTable.DOCUMENT_DISCUSSION, new OrderField[] { DocumentDiscussionTable.DOCUMENT_DISCUSSION.PROJECT_ID }, false);
|
||||||
public static final Index DOCUMENT_FULL_TEXT_IDX_PROJECT_ID = Internal.createIndex(DSL.name("IDX_PROJECT_ID"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.PROJECT_ID }, false);
|
public static final Index DOCUMENT_FULL_TEXT_IDX_PROJECT_ID = Internal.createIndex(DSL.name("IDX_PROJECT_ID"), DocumentFullTextTable.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullTextTable.DOCUMENT_FULL_TEXT.PROJECT_ID }, false);
|
||||||
public static final Index PROJECT_SYNC_TASK_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), ProjectSyncTask.PROJECT_SYNC_TASK, new OrderField[] { ProjectSyncTask.PROJECT_SYNC_TASK.PROJECT_ID }, false);
|
public static final Index PROJECT_SYNC_TASK_IDX_PROJECT_ID = Internal.createIndex(DSL.name("idx_project_id"), ProjectSyncTaskTable.PROJECT_SYNC_TASK, new OrderField[] { ProjectSyncTaskTable.PROJECT_SYNC_TASK.PROJECT_ID }, false);
|
||||||
public static final Index DOCUMENT_FULL_TEXT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("IDX_TABLE_DOCUMENT_ID"), DocumentFullText.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullText.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID }, false);
|
public static final Index DOCUMENT_FULL_TEXT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("IDX_TABLE_DOCUMENT_ID"), DocumentFullTextTable.DOCUMENT_FULL_TEXT, new OrderField[] { DocumentFullTextTable.DOCUMENT_FULL_TEXT.TABLE_DOCUMENT_ID }, false);
|
||||||
public static final Index TABLE_COLUMN_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableColumnDocument.TABLE_COLUMN_DOCUMENT, new OrderField[] { TableColumnDocument.TABLE_COLUMN_DOCUMENT.TABLE_DOCUMENT_ID }, false);
|
public static final Index TABLE_COLUMN_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT, new OrderField[] { TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT.TABLE_DOCUMENT_ID }, false);
|
||||||
public static final Index TABLE_FOREIGN_KEY_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT, new OrderField[] { TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT.TABLE_DOCUMENT_ID }, false);
|
public static final Index TABLE_FOREIGN_KEY_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT, new OrderField[] { TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT.TABLE_DOCUMENT_ID }, false);
|
||||||
public static final Index TABLE_INDEX_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableIndexDocument.TABLE_INDEX_DOCUMENT, new OrderField[] { TableIndexDocument.TABLE_INDEX_DOCUMENT.TABLE_DOCUMENT_ID }, false);
|
public static final Index TABLE_INDEX_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableIndexDocumentTable.TABLE_INDEX_DOCUMENT, new OrderField[] { TableIndexDocumentTable.TABLE_INDEX_DOCUMENT.TABLE_DOCUMENT_ID }, false);
|
||||||
public static final Index TABLE_TRIGGER_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableTriggerDocument.TABLE_TRIGGER_DOCUMENT, new OrderField[] { TableTriggerDocument.TABLE_TRIGGER_DOCUMENT.TABLE_DOCUMENT_ID }, false);
|
public static final Index TABLE_TRIGGER_DOCUMENT_IDX_TABLE_DOCUMENT_ID = Internal.createIndex(DSL.name("idx_table_document_id"), TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT, new OrderField[] { TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT.TABLE_DOCUMENT_ID }, false);
|
||||||
public static final Index PROJECT_SYNC_TASK_IDX_USER_ID = Internal.createIndex(DSL.name("idx_user_id"), ProjectSyncTask.PROJECT_SYNC_TASK, new OrderField[] { ProjectSyncTask.PROJECT_SYNC_TASK.USER_ID }, false);
|
public static final Index PROJECT_SYNC_TASK_IDX_USER_ID = Internal.createIndex(DSL.name("idx_user_id"), ProjectSyncTaskTable.PROJECT_SYNC_TASK, new OrderField[] { ProjectSyncTaskTable.PROJECT_SYNC_TASK.USER_ID }, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,32 +4,32 @@
|
||||||
package com.databasir.dao;
|
package com.databasir.dao;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.dao.tables.DataSource;
|
import com.databasir.dao.tables.DataSourcePropertyTable;
|
||||||
import com.databasir.dao.tables.DataSourceProperty;
|
import com.databasir.dao.tables.DataSourceTable;
|
||||||
import com.databasir.dao.tables.DatabaseDocument;
|
import com.databasir.dao.tables.DatabaseDocumentTable;
|
||||||
import com.databasir.dao.tables.DatabaseType;
|
import com.databasir.dao.tables.DatabaseTypeTable;
|
||||||
import com.databasir.dao.tables.DocumentDescription;
|
import com.databasir.dao.tables.DocumentDescriptionTable;
|
||||||
import com.databasir.dao.tables.DocumentDiscussion;
|
import com.databasir.dao.tables.DocumentDiscussionTable;
|
||||||
import com.databasir.dao.tables.DocumentFullText;
|
import com.databasir.dao.tables.DocumentFullTextTable;
|
||||||
import com.databasir.dao.tables.DocumentTemplateProperty;
|
import com.databasir.dao.tables.DocumentTemplatePropertyTable;
|
||||||
import com.databasir.dao.tables.Group;
|
import com.databasir.dao.tables.GroupTable;
|
||||||
import com.databasir.dao.tables.Login;
|
import com.databasir.dao.tables.LoginTable;
|
||||||
import com.databasir.dao.tables.MockDataRule;
|
import com.databasir.dao.tables.MockDataRuleTable;
|
||||||
import com.databasir.dao.tables.OauthApp;
|
import com.databasir.dao.tables.OauthAppTable;
|
||||||
import com.databasir.dao.tables.OperationLog;
|
import com.databasir.dao.tables.OperationLogTable;
|
||||||
import com.databasir.dao.tables.Project;
|
import com.databasir.dao.tables.ProjectSyncRuleTable;
|
||||||
import com.databasir.dao.tables.ProjectSyncRule;
|
import com.databasir.dao.tables.ProjectSyncTaskTable;
|
||||||
import com.databasir.dao.tables.ProjectSyncTask;
|
import com.databasir.dao.tables.ProjectTable;
|
||||||
import com.databasir.dao.tables.SysKey;
|
import com.databasir.dao.tables.SysKeyTable;
|
||||||
import com.databasir.dao.tables.SysMail;
|
import com.databasir.dao.tables.SysMailTable;
|
||||||
import com.databasir.dao.tables.TableColumnDocument;
|
import com.databasir.dao.tables.TableColumnDocumentTable;
|
||||||
import com.databasir.dao.tables.TableDocument;
|
import com.databasir.dao.tables.TableDocumentTable;
|
||||||
import com.databasir.dao.tables.TableForeignKeyDocument;
|
import com.databasir.dao.tables.TableForeignKeyDocumentTable;
|
||||||
import com.databasir.dao.tables.TableIndexDocument;
|
import com.databasir.dao.tables.TableIndexDocumentTable;
|
||||||
import com.databasir.dao.tables.TableTriggerDocument;
|
import com.databasir.dao.tables.TableTriggerDocumentTable;
|
||||||
import com.databasir.dao.tables.User;
|
import com.databasir.dao.tables.UserFavoriteProjectTable;
|
||||||
import com.databasir.dao.tables.UserFavoriteProject;
|
import com.databasir.dao.tables.UserRoleTable;
|
||||||
import com.databasir.dao.tables.UserRole;
|
import com.databasir.dao.tables.UserTable;
|
||||||
import com.databasir.dao.tables.records.DataSourcePropertyRecord;
|
import com.databasir.dao.tables.records.DataSourcePropertyRecord;
|
||||||
import com.databasir.dao.tables.records.DataSourceRecord;
|
import com.databasir.dao.tables.records.DataSourceRecord;
|
||||||
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
import com.databasir.dao.tables.records.DatabaseDocumentRecord;
|
||||||
|
@ -74,44 +74,44 @@ public class Keys {
|
||||||
// UNIQUE and PRIMARY KEY definitions
|
// UNIQUE and PRIMARY KEY definitions
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
public static final UniqueKey<DataSourceRecord> KEY_DATA_SOURCE_PRIMARY = Internal.createUniqueKey(DataSource.DATA_SOURCE, DSL.name("KEY_data_source_PRIMARY"), new TableField[] { DataSource.DATA_SOURCE.ID }, true);
|
public static final UniqueKey<DataSourceRecord> KEY_DATA_SOURCE_PRIMARY = Internal.createUniqueKey(DataSourceTable.DATA_SOURCE, DSL.name("KEY_data_source_PRIMARY"), new TableField[] { DataSourceTable.DATA_SOURCE.ID }, true);
|
||||||
public static final UniqueKey<DataSourceRecord> KEY_DATA_SOURCE_UK_PROJECT_ID = Internal.createUniqueKey(DataSource.DATA_SOURCE, DSL.name("KEY_data_source_uk_project_id"), new TableField[] { DataSource.DATA_SOURCE.PROJECT_ID }, true);
|
public static final UniqueKey<DataSourceRecord> KEY_DATA_SOURCE_UK_PROJECT_ID = Internal.createUniqueKey(DataSourceTable.DATA_SOURCE, DSL.name("KEY_data_source_uk_project_id"), new TableField[] { DataSourceTable.DATA_SOURCE.PROJECT_ID }, true);
|
||||||
public static final UniqueKey<DataSourcePropertyRecord> KEY_DATA_SOURCE_PROPERTY_PRIMARY = Internal.createUniqueKey(DataSourceProperty.DATA_SOURCE_PROPERTY, DSL.name("KEY_data_source_property_PRIMARY"), new TableField[] { DataSourceProperty.DATA_SOURCE_PROPERTY.ID }, true);
|
public static final UniqueKey<DataSourcePropertyRecord> KEY_DATA_SOURCE_PROPERTY_PRIMARY = Internal.createUniqueKey(DataSourcePropertyTable.DATA_SOURCE_PROPERTY, DSL.name("KEY_data_source_property_PRIMARY"), new TableField[] { DataSourcePropertyTable.DATA_SOURCE_PROPERTY.ID }, true);
|
||||||
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_PRIMARY = Internal.createUniqueKey(DatabaseDocument.DATABASE_DOCUMENT, DSL.name("KEY_database_document_PRIMARY"), new TableField[] { DatabaseDocument.DATABASE_DOCUMENT.ID }, true);
|
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_PRIMARY = Internal.createUniqueKey(DatabaseDocumentTable.DATABASE_DOCUMENT, DSL.name("KEY_database_document_PRIMARY"), new TableField[] { DatabaseDocumentTable.DATABASE_DOCUMENT.ID }, true);
|
||||||
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_UK_PROJECT_ID_VERSION_IS_ARCHIVE = Internal.createUniqueKey(DatabaseDocument.DATABASE_DOCUMENT, DSL.name("KEY_database_document_uk_project_id_version_is_archive"), new TableField[] { DatabaseDocument.DATABASE_DOCUMENT.PROJECT_ID, DatabaseDocument.DATABASE_DOCUMENT.VERSION, DatabaseDocument.DATABASE_DOCUMENT.IS_ARCHIVE }, true);
|
public static final UniqueKey<DatabaseDocumentRecord> KEY_DATABASE_DOCUMENT_UK_PROJECT_ID_VERSION_IS_ARCHIVE = Internal.createUniqueKey(DatabaseDocumentTable.DATABASE_DOCUMENT, DSL.name("KEY_database_document_uk_project_id_version_is_archive"), new TableField[] { DatabaseDocumentTable.DATABASE_DOCUMENT.PROJECT_ID, DatabaseDocumentTable.DATABASE_DOCUMENT.VERSION, DatabaseDocumentTable.DATABASE_DOCUMENT.IS_ARCHIVE }, true);
|
||||||
public static final UniqueKey<DatabaseTypeRecord> KEY_DATABASE_TYPE_PRIMARY = Internal.createUniqueKey(DatabaseType.DATABASE_TYPE, DSL.name("KEY_database_type_PRIMARY"), new TableField[] { DatabaseType.DATABASE_TYPE.ID }, true);
|
public static final UniqueKey<DatabaseTypeRecord> KEY_DATABASE_TYPE_PRIMARY = Internal.createUniqueKey(DatabaseTypeTable.DATABASE_TYPE, DSL.name("KEY_database_type_PRIMARY"), new TableField[] { DatabaseTypeTable.DATABASE_TYPE.ID }, true);
|
||||||
public static final UniqueKey<DatabaseTypeRecord> KEY_DATABASE_TYPE_UK_DATABASE_TYPE_DELETED_DELETED_TOKEN = Internal.createUniqueKey(DatabaseType.DATABASE_TYPE, DSL.name("KEY_database_type_uk_database_type_deleted_deleted_token"), new TableField[] { DatabaseType.DATABASE_TYPE.DATABASE_TYPE_, DatabaseType.DATABASE_TYPE.DELETED, DatabaseType.DATABASE_TYPE.DELETED_TOKEN }, true);
|
public static final UniqueKey<DatabaseTypeRecord> KEY_DATABASE_TYPE_UK_DATABASE_TYPE_DELETED_DELETED_TOKEN = Internal.createUniqueKey(DatabaseTypeTable.DATABASE_TYPE, DSL.name("KEY_database_type_uk_database_type_deleted_deleted_token"), new TableField[] { DatabaseTypeTable.DATABASE_TYPE.DATABASE_TYPE_, DatabaseTypeTable.DATABASE_TYPE.DELETED, DatabaseTypeTable.DATABASE_TYPE.DELETED_TOKEN }, true);
|
||||||
public static final UniqueKey<DocumentDescriptionRecord> KEY_DOCUMENT_DESCRIPTION_PRIMARY = Internal.createUniqueKey(DocumentDescription.DOCUMENT_DESCRIPTION, DSL.name("KEY_document_description_PRIMARY"), new TableField[] { DocumentDescription.DOCUMENT_DESCRIPTION.ID }, true);
|
public static final UniqueKey<DocumentDescriptionRecord> KEY_DOCUMENT_DESCRIPTION_PRIMARY = Internal.createUniqueKey(DocumentDescriptionTable.DOCUMENT_DESCRIPTION, DSL.name("KEY_document_description_PRIMARY"), new TableField[] { DocumentDescriptionTable.DOCUMENT_DESCRIPTION.ID }, true);
|
||||||
public static final UniqueKey<DocumentDescriptionRecord> KEY_DOCUMENT_DESCRIPTION_UK_PROJECT_ID_TABLE_NAME_COLUMN_NAME = Internal.createUniqueKey(DocumentDescription.DOCUMENT_DESCRIPTION, DSL.name("KEY_document_description_uk_project_id_table_name_column_name"), new TableField[] { DocumentDescription.DOCUMENT_DESCRIPTION.PROJECT_ID, DocumentDescription.DOCUMENT_DESCRIPTION.TABLE_NAME, DocumentDescription.DOCUMENT_DESCRIPTION.COLUMN_NAME }, true);
|
public static final UniqueKey<DocumentDescriptionRecord> KEY_DOCUMENT_DESCRIPTION_UK_PROJECT_ID_TABLE_NAME_COLUMN_NAME = Internal.createUniqueKey(DocumentDescriptionTable.DOCUMENT_DESCRIPTION, DSL.name("KEY_document_description_uk_project_id_table_name_column_name"), new TableField[] { DocumentDescriptionTable.DOCUMENT_DESCRIPTION.PROJECT_ID, DocumentDescriptionTable.DOCUMENT_DESCRIPTION.TABLE_NAME, DocumentDescriptionTable.DOCUMENT_DESCRIPTION.COLUMN_NAME }, true);
|
||||||
public static final UniqueKey<DocumentDiscussionRecord> KEY_DOCUMENT_DISCUSSION_PRIMARY = Internal.createUniqueKey(DocumentDiscussion.DOCUMENT_DISCUSSION, DSL.name("KEY_document_discussion_PRIMARY"), new TableField[] { DocumentDiscussion.DOCUMENT_DISCUSSION.ID }, true);
|
public static final UniqueKey<DocumentDiscussionRecord> KEY_DOCUMENT_DISCUSSION_PRIMARY = Internal.createUniqueKey(DocumentDiscussionTable.DOCUMENT_DISCUSSION, DSL.name("KEY_document_discussion_PRIMARY"), new TableField[] { DocumentDiscussionTable.DOCUMENT_DISCUSSION.ID }, true);
|
||||||
public static final UniqueKey<DocumentFullTextRecord> KEY_DOCUMENT_FULL_TEXT_PRIMARY = Internal.createUniqueKey(DocumentFullText.DOCUMENT_FULL_TEXT, DSL.name("KEY_document_full_text_PRIMARY"), new TableField[] { DocumentFullText.DOCUMENT_FULL_TEXT.ID }, true);
|
public static final UniqueKey<DocumentFullTextRecord> KEY_DOCUMENT_FULL_TEXT_PRIMARY = Internal.createUniqueKey(DocumentFullTextTable.DOCUMENT_FULL_TEXT, DSL.name("KEY_document_full_text_PRIMARY"), new TableField[] { DocumentFullTextTable.DOCUMENT_FULL_TEXT.ID }, true);
|
||||||
public static final UniqueKey<DocumentTemplatePropertyRecord> KEY_DOCUMENT_TEMPLATE_PROPERTY_PRIMARY = Internal.createUniqueKey(DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY, DSL.name("KEY_document_template_property_PRIMARY"), new TableField[] { DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY.ID }, true);
|
public static final UniqueKey<DocumentTemplatePropertyRecord> KEY_DOCUMENT_TEMPLATE_PROPERTY_PRIMARY = Internal.createUniqueKey(DocumentTemplatePropertyTable.DOCUMENT_TEMPLATE_PROPERTY, DSL.name("KEY_document_template_property_PRIMARY"), new TableField[] { DocumentTemplatePropertyTable.DOCUMENT_TEMPLATE_PROPERTY.ID }, true);
|
||||||
public static final UniqueKey<DocumentTemplatePropertyRecord> KEY_DOCUMENT_TEMPLATE_PROPERTY_UK_TYPE_KEY = Internal.createUniqueKey(DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY, DSL.name("KEY_document_template_property_uk_type_key"), new TableField[] { DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY.TYPE, DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY.KEY }, true);
|
public static final UniqueKey<DocumentTemplatePropertyRecord> KEY_DOCUMENT_TEMPLATE_PROPERTY_UK_TYPE_KEY = Internal.createUniqueKey(DocumentTemplatePropertyTable.DOCUMENT_TEMPLATE_PROPERTY, DSL.name("KEY_document_template_property_uk_type_key"), new TableField[] { DocumentTemplatePropertyTable.DOCUMENT_TEMPLATE_PROPERTY.TYPE, DocumentTemplatePropertyTable.DOCUMENT_TEMPLATE_PROPERTY.KEY }, true);
|
||||||
public static final UniqueKey<GroupRecord> KEY_GROUP_PRIMARY = Internal.createUniqueKey(Group.GROUP, DSL.name("KEY_group_PRIMARY"), new TableField[] { Group.GROUP.ID }, true);
|
public static final UniqueKey<GroupRecord> KEY_GROUP_PRIMARY = Internal.createUniqueKey(GroupTable.GROUP, DSL.name("KEY_group_PRIMARY"), new TableField[] { GroupTable.GROUP.ID }, true);
|
||||||
public static final UniqueKey<LoginRecord> KEY_LOGIN_PRIMARY = Internal.createUniqueKey(Login.LOGIN, DSL.name("KEY_login_PRIMARY"), new TableField[] { Login.LOGIN.ID }, true);
|
public static final UniqueKey<LoginRecord> KEY_LOGIN_PRIMARY = Internal.createUniqueKey(LoginTable.LOGIN, DSL.name("KEY_login_PRIMARY"), new TableField[] { LoginTable.LOGIN.ID }, true);
|
||||||
public static final UniqueKey<LoginRecord> KEY_LOGIN_UK_USER_ID = Internal.createUniqueKey(Login.LOGIN, DSL.name("KEY_login_uk_user_id"), new TableField[] { Login.LOGIN.USER_ID }, true);
|
public static final UniqueKey<LoginRecord> KEY_LOGIN_UK_USER_ID = Internal.createUniqueKey(LoginTable.LOGIN, DSL.name("KEY_login_uk_user_id"), new TableField[] { LoginTable.LOGIN.USER_ID }, true);
|
||||||
public static final UniqueKey<MockDataRuleRecord> KEY_MOCK_DATA_RULE_PRIMARY = Internal.createUniqueKey(MockDataRule.MOCK_DATA_RULE, DSL.name("KEY_mock_data_rule_PRIMARY"), new TableField[] { MockDataRule.MOCK_DATA_RULE.ID }, true);
|
public static final UniqueKey<MockDataRuleRecord> KEY_MOCK_DATA_RULE_PRIMARY = Internal.createUniqueKey(MockDataRuleTable.MOCK_DATA_RULE, DSL.name("KEY_mock_data_rule_PRIMARY"), new TableField[] { MockDataRuleTable.MOCK_DATA_RULE.ID }, true);
|
||||||
public static final UniqueKey<MockDataRuleRecord> KEY_MOCK_DATA_RULE_UK_PROJECT_ID_TABLE_NAME_COLUMN_NAME = Internal.createUniqueKey(MockDataRule.MOCK_DATA_RULE, DSL.name("KEY_mock_data_rule_uk_project_id_table_name_column_name"), new TableField[] { MockDataRule.MOCK_DATA_RULE.PROJECT_ID, MockDataRule.MOCK_DATA_RULE.TABLE_NAME, MockDataRule.MOCK_DATA_RULE.COLUMN_NAME }, true);
|
public static final UniqueKey<MockDataRuleRecord> KEY_MOCK_DATA_RULE_UK_PROJECT_ID_TABLE_NAME_COLUMN_NAME = Internal.createUniqueKey(MockDataRuleTable.MOCK_DATA_RULE, DSL.name("KEY_mock_data_rule_uk_project_id_table_name_column_name"), new TableField[] { MockDataRuleTable.MOCK_DATA_RULE.PROJECT_ID, MockDataRuleTable.MOCK_DATA_RULE.TABLE_NAME, MockDataRuleTable.MOCK_DATA_RULE.COLUMN_NAME }, true);
|
||||||
public static final UniqueKey<OauthAppRecord> KEY_OAUTH_APP_PRIMARY = Internal.createUniqueKey(OauthApp.OAUTH_APP, DSL.name("KEY_oauth_app_PRIMARY"), new TableField[] { OauthApp.OAUTH_APP.ID }, true);
|
public static final UniqueKey<OauthAppRecord> KEY_OAUTH_APP_PRIMARY = Internal.createUniqueKey(OauthAppTable.OAUTH_APP, DSL.name("KEY_oauth_app_PRIMARY"), new TableField[] { OauthAppTable.OAUTH_APP.ID }, true);
|
||||||
public static final UniqueKey<OauthAppRecord> KEY_OAUTH_APP_UK_REGISTRATION_ID = Internal.createUniqueKey(OauthApp.OAUTH_APP, DSL.name("KEY_oauth_app_uk_registration_id"), new TableField[] { OauthApp.OAUTH_APP.REGISTRATION_ID }, true);
|
public static final UniqueKey<OauthAppRecord> KEY_OAUTH_APP_UK_REGISTRATION_ID = Internal.createUniqueKey(OauthAppTable.OAUTH_APP, DSL.name("KEY_oauth_app_uk_registration_id"), new TableField[] { OauthAppTable.OAUTH_APP.REGISTRATION_ID }, true);
|
||||||
public static final UniqueKey<OperationLogRecord> KEY_OPERATION_LOG_PRIMARY = Internal.createUniqueKey(OperationLog.OPERATION_LOG, DSL.name("KEY_operation_log_PRIMARY"), new TableField[] { OperationLog.OPERATION_LOG.ID }, true);
|
public static final UniqueKey<OperationLogRecord> KEY_OPERATION_LOG_PRIMARY = Internal.createUniqueKey(OperationLogTable.OPERATION_LOG, DSL.name("KEY_operation_log_PRIMARY"), new TableField[] { OperationLogTable.OPERATION_LOG.ID }, true);
|
||||||
public static final UniqueKey<ProjectRecord> KEY_PROJECT_PRIMARY = Internal.createUniqueKey(Project.PROJECT, DSL.name("KEY_project_PRIMARY"), new TableField[] { Project.PROJECT.ID }, true);
|
public static final UniqueKey<ProjectRecord> KEY_PROJECT_PRIMARY = Internal.createUniqueKey(ProjectTable.PROJECT, DSL.name("KEY_project_PRIMARY"), new TableField[] { ProjectTable.PROJECT.ID }, true);
|
||||||
public static final UniqueKey<ProjectRecord> KEY_PROJECT_UK_GROUP_ID_NAME_DELETED_TOKEN = Internal.createUniqueKey(Project.PROJECT, DSL.name("KEY_project_uk_group_id_name_deleted_token"), new TableField[] { Project.PROJECT.GROUP_ID, Project.PROJECT.NAME, Project.PROJECT.DELETED_TOKEN }, true);
|
public static final UniqueKey<ProjectRecord> KEY_PROJECT_UK_GROUP_ID_NAME_DELETED_TOKEN = Internal.createUniqueKey(ProjectTable.PROJECT, DSL.name("KEY_project_uk_group_id_name_deleted_token"), new TableField[] { ProjectTable.PROJECT.GROUP_ID, ProjectTable.PROJECT.NAME, ProjectTable.PROJECT.DELETED_TOKEN }, true);
|
||||||
public static final UniqueKey<ProjectSyncRuleRecord> KEY_PROJECT_SYNC_RULE_PRIMARY = Internal.createUniqueKey(ProjectSyncRule.PROJECT_SYNC_RULE, DSL.name("KEY_project_sync_rule_PRIMARY"), new TableField[] { ProjectSyncRule.PROJECT_SYNC_RULE.ID }, true);
|
public static final UniqueKey<ProjectSyncRuleRecord> KEY_PROJECT_SYNC_RULE_PRIMARY = Internal.createUniqueKey(ProjectSyncRuleTable.PROJECT_SYNC_RULE, DSL.name("KEY_project_sync_rule_PRIMARY"), new TableField[] { ProjectSyncRuleTable.PROJECT_SYNC_RULE.ID }, true);
|
||||||
public static final UniqueKey<ProjectSyncRuleRecord> KEY_PROJECT_SYNC_RULE_UK_PROJECT_ID = Internal.createUniqueKey(ProjectSyncRule.PROJECT_SYNC_RULE, DSL.name("KEY_project_sync_rule_uk_project_id"), new TableField[] { ProjectSyncRule.PROJECT_SYNC_RULE.PROJECT_ID }, true);
|
public static final UniqueKey<ProjectSyncRuleRecord> KEY_PROJECT_SYNC_RULE_UK_PROJECT_ID = Internal.createUniqueKey(ProjectSyncRuleTable.PROJECT_SYNC_RULE, DSL.name("KEY_project_sync_rule_uk_project_id"), new TableField[] { ProjectSyncRuleTable.PROJECT_SYNC_RULE.PROJECT_ID }, true);
|
||||||
public static final UniqueKey<ProjectSyncTaskRecord> KEY_PROJECT_SYNC_TASK_PRIMARY = Internal.createUniqueKey(ProjectSyncTask.PROJECT_SYNC_TASK, DSL.name("KEY_project_sync_task_PRIMARY"), new TableField[] { ProjectSyncTask.PROJECT_SYNC_TASK.ID }, true);
|
public static final UniqueKey<ProjectSyncTaskRecord> KEY_PROJECT_SYNC_TASK_PRIMARY = Internal.createUniqueKey(ProjectSyncTaskTable.PROJECT_SYNC_TASK, DSL.name("KEY_project_sync_task_PRIMARY"), new TableField[] { ProjectSyncTaskTable.PROJECT_SYNC_TASK.ID }, true);
|
||||||
public static final UniqueKey<SysKeyRecord> KEY_SYS_KEY_PRIMARY = Internal.createUniqueKey(SysKey.SYS_KEY, DSL.name("KEY_sys_key_PRIMARY"), new TableField[] { SysKey.SYS_KEY.ID }, true);
|
public static final UniqueKey<SysKeyRecord> KEY_SYS_KEY_PRIMARY = Internal.createUniqueKey(SysKeyTable.SYS_KEY, DSL.name("KEY_sys_key_PRIMARY"), new TableField[] { SysKeyTable.SYS_KEY.ID }, true);
|
||||||
public static final UniqueKey<SysMailRecord> KEY_SYS_MAIL_PRIMARY = Internal.createUniqueKey(SysMail.SYS_MAIL, DSL.name("KEY_sys_mail_PRIMARY"), new TableField[] { SysMail.SYS_MAIL.ID }, true);
|
public static final UniqueKey<SysMailRecord> KEY_SYS_MAIL_PRIMARY = Internal.createUniqueKey(SysMailTable.SYS_MAIL, DSL.name("KEY_sys_mail_PRIMARY"), new TableField[] { SysMailTable.SYS_MAIL.ID }, true);
|
||||||
public static final UniqueKey<TableColumnDocumentRecord> KEY_TABLE_COLUMN_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableColumnDocument.TABLE_COLUMN_DOCUMENT, DSL.name("KEY_table_column_document_PRIMARY"), new TableField[] { TableColumnDocument.TABLE_COLUMN_DOCUMENT.ID }, true);
|
public static final UniqueKey<TableColumnDocumentRecord> KEY_TABLE_COLUMN_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT, DSL.name("KEY_table_column_document_PRIMARY"), new TableField[] { TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT.ID }, true);
|
||||||
public static final UniqueKey<TableDocumentRecord> KEY_TABLE_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableDocument.TABLE_DOCUMENT, DSL.name("KEY_table_document_PRIMARY"), new TableField[] { TableDocument.TABLE_DOCUMENT.ID }, true);
|
public static final UniqueKey<TableDocumentRecord> KEY_TABLE_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableDocumentTable.TABLE_DOCUMENT, DSL.name("KEY_table_document_PRIMARY"), new TableField[] { TableDocumentTable.TABLE_DOCUMENT.ID }, true);
|
||||||
public static final UniqueKey<TableForeignKeyDocumentRecord> KEY_TABLE_FOREIGN_KEY_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT, DSL.name("KEY_table_foreign_key_document_PRIMARY"), new TableField[] { TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT.ID }, true);
|
public static final UniqueKey<TableForeignKeyDocumentRecord> KEY_TABLE_FOREIGN_KEY_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT, DSL.name("KEY_table_foreign_key_document_PRIMARY"), new TableField[] { TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT.ID }, true);
|
||||||
public static final UniqueKey<TableIndexDocumentRecord> KEY_TABLE_INDEX_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableIndexDocument.TABLE_INDEX_DOCUMENT, DSL.name("KEY_table_index_document_PRIMARY"), new TableField[] { TableIndexDocument.TABLE_INDEX_DOCUMENT.ID }, true);
|
public static final UniqueKey<TableIndexDocumentRecord> KEY_TABLE_INDEX_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableIndexDocumentTable.TABLE_INDEX_DOCUMENT, DSL.name("KEY_table_index_document_PRIMARY"), new TableField[] { TableIndexDocumentTable.TABLE_INDEX_DOCUMENT.ID }, true);
|
||||||
public static final UniqueKey<TableTriggerDocumentRecord> KEY_TABLE_TRIGGER_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableTriggerDocument.TABLE_TRIGGER_DOCUMENT, DSL.name("KEY_table_trigger_document_PRIMARY"), new TableField[] { TableTriggerDocument.TABLE_TRIGGER_DOCUMENT.ID }, true);
|
public static final UniqueKey<TableTriggerDocumentRecord> KEY_TABLE_TRIGGER_DOCUMENT_PRIMARY = Internal.createUniqueKey(TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT, DSL.name("KEY_table_trigger_document_PRIMARY"), new TableField[] { TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT.ID }, true);
|
||||||
public static final UniqueKey<UserRecord> KEY_USER_PRIMARY = Internal.createUniqueKey(User.USER, DSL.name("KEY_user_PRIMARY"), new TableField[] { User.USER.ID }, true);
|
public static final UniqueKey<UserRecord> KEY_USER_PRIMARY = Internal.createUniqueKey(UserTable.USER, DSL.name("KEY_user_PRIMARY"), new TableField[] { UserTable.USER.ID }, true);
|
||||||
public static final UniqueKey<UserRecord> KEY_USER_UK_EMAIL = Internal.createUniqueKey(User.USER, DSL.name("KEY_user_uk_email"), new TableField[] { User.USER.EMAIL, User.USER.DELETED_TOKEN }, true);
|
public static final UniqueKey<UserRecord> KEY_USER_UK_EMAIL = Internal.createUniqueKey(UserTable.USER, DSL.name("KEY_user_uk_email"), new TableField[] { UserTable.USER.EMAIL, UserTable.USER.DELETED_TOKEN }, true);
|
||||||
public static final UniqueKey<UserRecord> KEY_USER_UK_USERNAME = Internal.createUniqueKey(User.USER, DSL.name("KEY_user_uk_username"), new TableField[] { User.USER.USERNAME, User.USER.DELETED_TOKEN }, true);
|
public static final UniqueKey<UserRecord> KEY_USER_UK_USERNAME = Internal.createUniqueKey(UserTable.USER, DSL.name("KEY_user_uk_username"), new TableField[] { UserTable.USER.USERNAME, UserTable.USER.DELETED_TOKEN }, true);
|
||||||
public static final UniqueKey<UserFavoriteProjectRecord> KEY_USER_FAVORITE_PROJECT_PRIMARY = Internal.createUniqueKey(UserFavoriteProject.USER_FAVORITE_PROJECT, DSL.name("KEY_user_favorite_project_PRIMARY"), new TableField[] { UserFavoriteProject.USER_FAVORITE_PROJECT.ID }, true);
|
public static final UniqueKey<UserFavoriteProjectRecord> KEY_USER_FAVORITE_PROJECT_PRIMARY = Internal.createUniqueKey(UserFavoriteProjectTable.USER_FAVORITE_PROJECT, DSL.name("KEY_user_favorite_project_PRIMARY"), new TableField[] { UserFavoriteProjectTable.USER_FAVORITE_PROJECT.ID }, true);
|
||||||
public static final UniqueKey<UserFavoriteProjectRecord> KEY_USER_FAVORITE_PROJECT_UK_USER_ID_PROJECT_ID = Internal.createUniqueKey(UserFavoriteProject.USER_FAVORITE_PROJECT, DSL.name("KEY_user_favorite_project_uk_user_id_project_id"), new TableField[] { UserFavoriteProject.USER_FAVORITE_PROJECT.USER_ID, UserFavoriteProject.USER_FAVORITE_PROJECT.PROJECT_ID }, true);
|
public static final UniqueKey<UserFavoriteProjectRecord> KEY_USER_FAVORITE_PROJECT_UK_USER_ID_PROJECT_ID = Internal.createUniqueKey(UserFavoriteProjectTable.USER_FAVORITE_PROJECT, DSL.name("KEY_user_favorite_project_uk_user_id_project_id"), new TableField[] { UserFavoriteProjectTable.USER_FAVORITE_PROJECT.USER_ID, UserFavoriteProjectTable.USER_FAVORITE_PROJECT.PROJECT_ID }, true);
|
||||||
public static final UniqueKey<UserRoleRecord> KEY_USER_ROLE_PRIMARY = Internal.createUniqueKey(UserRole.USER_ROLE, DSL.name("KEY_user_role_PRIMARY"), new TableField[] { UserRole.USER_ROLE.ID }, true);
|
public static final UniqueKey<UserRoleRecord> KEY_USER_ROLE_PRIMARY = Internal.createUniqueKey(UserRoleTable.USER_ROLE, DSL.name("KEY_user_role_PRIMARY"), new TableField[] { UserRoleTable.USER_ROLE.ID }, true);
|
||||||
public static final UniqueKey<UserRoleRecord> KEY_USER_ROLE_UK_USER_ID_GROUP_ID_ROLE = Internal.createUniqueKey(UserRole.USER_ROLE, DSL.name("KEY_user_role_uk_user_id_group_id_role"), new TableField[] { UserRole.USER_ROLE.USER_ID, UserRole.USER_ROLE.GROUP_ID, UserRole.USER_ROLE.ROLE }, true);
|
public static final UniqueKey<UserRoleRecord> KEY_USER_ROLE_UK_USER_ID_GROUP_ID_ROLE = Internal.createUniqueKey(UserRoleTable.USER_ROLE, DSL.name("KEY_user_role_uk_user_id_group_id_role"), new TableField[] { UserRoleTable.USER_ROLE.USER_ID, UserRoleTable.USER_ROLE.GROUP_ID, UserRoleTable.USER_ROLE.ROLE }, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,32 +4,32 @@
|
||||||
package com.databasir.dao;
|
package com.databasir.dao;
|
||||||
|
|
||||||
|
|
||||||
import com.databasir.dao.tables.DataSource;
|
import com.databasir.dao.tables.DataSourcePropertyTable;
|
||||||
import com.databasir.dao.tables.DataSourceProperty;
|
import com.databasir.dao.tables.DataSourceTable;
|
||||||
import com.databasir.dao.tables.DatabaseDocument;
|
import com.databasir.dao.tables.DatabaseDocumentTable;
|
||||||
import com.databasir.dao.tables.DatabaseType;
|
import com.databasir.dao.tables.DatabaseTypeTable;
|
||||||
import com.databasir.dao.tables.DocumentDescription;
|
import com.databasir.dao.tables.DocumentDescriptionTable;
|
||||||
import com.databasir.dao.tables.DocumentDiscussion;
|
import com.databasir.dao.tables.DocumentDiscussionTable;
|
||||||
import com.databasir.dao.tables.DocumentFullText;
|
import com.databasir.dao.tables.DocumentFullTextTable;
|
||||||
import com.databasir.dao.tables.DocumentTemplateProperty;
|
import com.databasir.dao.tables.DocumentTemplatePropertyTable;
|
||||||
import com.databasir.dao.tables.Group;
|
import com.databasir.dao.tables.GroupTable;
|
||||||
import com.databasir.dao.tables.Login;
|
import com.databasir.dao.tables.LoginTable;
|
||||||
import com.databasir.dao.tables.MockDataRule;
|
import com.databasir.dao.tables.MockDataRuleTable;
|
||||||
import com.databasir.dao.tables.OauthApp;
|
import com.databasir.dao.tables.OauthAppTable;
|
||||||
import com.databasir.dao.tables.OperationLog;
|
import com.databasir.dao.tables.OperationLogTable;
|
||||||
import com.databasir.dao.tables.Project;
|
import com.databasir.dao.tables.ProjectSyncRuleTable;
|
||||||
import com.databasir.dao.tables.ProjectSyncRule;
|
import com.databasir.dao.tables.ProjectSyncTaskTable;
|
||||||
import com.databasir.dao.tables.ProjectSyncTask;
|
import com.databasir.dao.tables.ProjectTable;
|
||||||
import com.databasir.dao.tables.SysKey;
|
import com.databasir.dao.tables.SysKeyTable;
|
||||||
import com.databasir.dao.tables.SysMail;
|
import com.databasir.dao.tables.SysMailTable;
|
||||||
import com.databasir.dao.tables.TableColumnDocument;
|
import com.databasir.dao.tables.TableColumnDocumentTable;
|
||||||
import com.databasir.dao.tables.TableDocument;
|
import com.databasir.dao.tables.TableDocumentTable;
|
||||||
import com.databasir.dao.tables.TableForeignKeyDocument;
|
import com.databasir.dao.tables.TableForeignKeyDocumentTable;
|
||||||
import com.databasir.dao.tables.TableIndexDocument;
|
import com.databasir.dao.tables.TableIndexDocumentTable;
|
||||||
import com.databasir.dao.tables.TableTriggerDocument;
|
import com.databasir.dao.tables.TableTriggerDocumentTable;
|
||||||
import com.databasir.dao.tables.User;
|
import com.databasir.dao.tables.UserFavoriteProjectTable;
|
||||||
import com.databasir.dao.tables.UserFavoriteProject;
|
import com.databasir.dao.tables.UserRoleTable;
|
||||||
import com.databasir.dao.tables.UserRole;
|
import com.databasir.dao.tables.UserTable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,130 +41,130 @@ public class Tables {
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.data_source</code>.
|
* The table <code>databasir.data_source</code>.
|
||||||
*/
|
*/
|
||||||
public static final DataSource DATA_SOURCE = DataSource.DATA_SOURCE;
|
public static final DataSourceTable DATA_SOURCE = DataSourceTable.DATA_SOURCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.data_source_property</code>.
|
* The table <code>databasir.data_source_property</code>.
|
||||||
*/
|
*/
|
||||||
public static final DataSourceProperty DATA_SOURCE_PROPERTY = DataSourceProperty.DATA_SOURCE_PROPERTY;
|
public static final DataSourcePropertyTable DATA_SOURCE_PROPERTY = DataSourcePropertyTable.DATA_SOURCE_PROPERTY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.database_document</code>.
|
* The table <code>databasir.database_document</code>.
|
||||||
*/
|
*/
|
||||||
public static final DatabaseDocument DATABASE_DOCUMENT = DatabaseDocument.DATABASE_DOCUMENT;
|
public static final DatabaseDocumentTable DATABASE_DOCUMENT = DatabaseDocumentTable.DATABASE_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* customer database types
|
* customer database types
|
||||||
*/
|
*/
|
||||||
public static final DatabaseType DATABASE_TYPE = DatabaseType.DATABASE_TYPE;
|
public static final DatabaseTypeTable DATABASE_TYPE = DatabaseTypeTable.DATABASE_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* custom document description
|
* custom document description
|
||||||
*/
|
*/
|
||||||
public static final DocumentDescription DOCUMENT_DESCRIPTION = DocumentDescription.DOCUMENT_DESCRIPTION;
|
public static final DocumentDescriptionTable DOCUMENT_DESCRIPTION = DocumentDescriptionTable.DOCUMENT_DESCRIPTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.document_discussion</code>.
|
* The table <code>databasir.document_discussion</code>.
|
||||||
*/
|
*/
|
||||||
public static final DocumentDiscussion DOCUMENT_DISCUSSION = DocumentDiscussion.DOCUMENT_DISCUSSION;
|
public static final DocumentDiscussionTable DOCUMENT_DISCUSSION = DocumentDiscussionTable.DOCUMENT_DISCUSSION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.document_full_text</code>.
|
* The table <code>databasir.document_full_text</code>.
|
||||||
*/
|
*/
|
||||||
public static final DocumentFullText DOCUMENT_FULL_TEXT = DocumentFullText.DOCUMENT_FULL_TEXT;
|
public static final DocumentFullTextTable DOCUMENT_FULL_TEXT = DocumentFullTextTable.DOCUMENT_FULL_TEXT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* template property
|
* template property
|
||||||
*/
|
*/
|
||||||
public static final DocumentTemplateProperty DOCUMENT_TEMPLATE_PROPERTY = DocumentTemplateProperty.DOCUMENT_TEMPLATE_PROPERTY;
|
public static final DocumentTemplatePropertyTable DOCUMENT_TEMPLATE_PROPERTY = DocumentTemplatePropertyTable.DOCUMENT_TEMPLATE_PROPERTY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.group</code>.
|
* The table <code>databasir.group</code>.
|
||||||
*/
|
*/
|
||||||
public static final Group GROUP = Group.GROUP;
|
public static final GroupTable GROUP = GroupTable.GROUP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.login</code>.
|
* The table <code>databasir.login</code>.
|
||||||
*/
|
*/
|
||||||
public static final Login LOGIN = Login.LOGIN;
|
public static final LoginTable LOGIN = LoginTable.LOGIN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.mock_data_rule</code>.
|
* The table <code>databasir.mock_data_rule</code>.
|
||||||
*/
|
*/
|
||||||
public static final MockDataRule MOCK_DATA_RULE = MockDataRule.MOCK_DATA_RULE;
|
public static final MockDataRuleTable MOCK_DATA_RULE = MockDataRuleTable.MOCK_DATA_RULE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* oauth app info
|
* oauth app info
|
||||||
*/
|
*/
|
||||||
public static final OauthApp OAUTH_APP = OauthApp.OAUTH_APP;
|
public static final OauthAppTable OAUTH_APP = OauthAppTable.OAUTH_APP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.operation_log</code>.
|
* The table <code>databasir.operation_log</code>.
|
||||||
*/
|
*/
|
||||||
public static final OperationLog OPERATION_LOG = OperationLog.OPERATION_LOG;
|
public static final OperationLogTable OPERATION_LOG = OperationLogTable.OPERATION_LOG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.project</code>.
|
* The table <code>databasir.project</code>.
|
||||||
*/
|
*/
|
||||||
public static final Project PROJECT = Project.PROJECT;
|
public static final ProjectTable PROJECT = ProjectTable.PROJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.project_sync_rule</code>.
|
* The table <code>databasir.project_sync_rule</code>.
|
||||||
*/
|
*/
|
||||||
public static final ProjectSyncRule PROJECT_SYNC_RULE = ProjectSyncRule.PROJECT_SYNC_RULE;
|
public static final ProjectSyncRuleTable PROJECT_SYNC_RULE = ProjectSyncRuleTable.PROJECT_SYNC_RULE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.project_sync_task</code>.
|
* The table <code>databasir.project_sync_task</code>.
|
||||||
*/
|
*/
|
||||||
public static final ProjectSyncTask PROJECT_SYNC_TASK = ProjectSyncTask.PROJECT_SYNC_TASK;
|
public static final ProjectSyncTaskTable PROJECT_SYNC_TASK = ProjectSyncTaskTable.PROJECT_SYNC_TASK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.sys_key</code>.
|
* The table <code>databasir.sys_key</code>.
|
||||||
*/
|
*/
|
||||||
public static final SysKey SYS_KEY = SysKey.SYS_KEY;
|
public static final SysKeyTable SYS_KEY = SysKeyTable.SYS_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.sys_mail</code>.
|
* The table <code>databasir.sys_mail</code>.
|
||||||
*/
|
*/
|
||||||
public static final SysMail SYS_MAIL = SysMail.SYS_MAIL;
|
public static final SysMailTable SYS_MAIL = SysMailTable.SYS_MAIL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_column_document</code>.
|
* The table <code>databasir.table_column_document</code>.
|
||||||
*/
|
*/
|
||||||
public static final TableColumnDocument TABLE_COLUMN_DOCUMENT = TableColumnDocument.TABLE_COLUMN_DOCUMENT;
|
public static final TableColumnDocumentTable TABLE_COLUMN_DOCUMENT = TableColumnDocumentTable.TABLE_COLUMN_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_document</code>.
|
* The table <code>databasir.table_document</code>.
|
||||||
*/
|
*/
|
||||||
public static final TableDocument TABLE_DOCUMENT = TableDocument.TABLE_DOCUMENT;
|
public static final TableDocumentTable TABLE_DOCUMENT = TableDocumentTable.TABLE_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_foreign_key_document</code>.
|
* The table <code>databasir.table_foreign_key_document</code>.
|
||||||
*/
|
*/
|
||||||
public static final TableForeignKeyDocument TABLE_FOREIGN_KEY_DOCUMENT = TableForeignKeyDocument.TABLE_FOREIGN_KEY_DOCUMENT;
|
public static final TableForeignKeyDocumentTable TABLE_FOREIGN_KEY_DOCUMENT = TableForeignKeyDocumentTable.TABLE_FOREIGN_KEY_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_index_document</code>.
|
* The table <code>databasir.table_index_document</code>.
|
||||||
*/
|
*/
|
||||||
public static final TableIndexDocument TABLE_INDEX_DOCUMENT = TableIndexDocument.TABLE_INDEX_DOCUMENT;
|
public static final TableIndexDocumentTable TABLE_INDEX_DOCUMENT = TableIndexDocumentTable.TABLE_INDEX_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.table_trigger_document</code>.
|
* The table <code>databasir.table_trigger_document</code>.
|
||||||
*/
|
*/
|
||||||
public static final TableTriggerDocument TABLE_TRIGGER_DOCUMENT = TableTriggerDocument.TABLE_TRIGGER_DOCUMENT;
|
public static final TableTriggerDocumentTable TABLE_TRIGGER_DOCUMENT = TableTriggerDocumentTable.TABLE_TRIGGER_DOCUMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.user</code>.
|
* The table <code>databasir.user</code>.
|
||||||
*/
|
*/
|
||||||
public static final User USER = User.USER;
|
public static final UserTable USER = UserTable.USER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.user_favorite_project</code>.
|
* The table <code>databasir.user_favorite_project</code>.
|
||||||
*/
|
*/
|
||||||
public static final UserFavoriteProject USER_FAVORITE_PROJECT = UserFavoriteProject.USER_FAVORITE_PROJECT;
|
public static final UserFavoriteProjectTable USER_FAVORITE_PROJECT = UserFavoriteProjectTable.USER_FAVORITE_PROJECT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The table <code>databasir.user_role</code>.
|
* The table <code>databasir.user_role</code>.
|
||||||
*/
|
*/
|
||||||
public static final UserRole USER_ROLE = UserRole.USER_ROLE;
|
public static final UserRoleTable USER_ROLE = UserRoleTable.USER_ROLE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DataSourceProperty extends TableImpl<DataSourcePropertyRecord> {
|
public class DataSourcePropertyTable extends TableImpl<DataSourcePropertyRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.data_source_property</code>
|
* The reference instance of <code>databasir.data_source_property</code>
|
||||||
*/
|
*/
|
||||||
public static final DataSourceProperty DATA_SOURCE_PROPERTY = new DataSourceProperty();
|
public static final DataSourcePropertyTable DATA_SOURCE_PROPERTY = new DataSourcePropertyTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -76,11 +76,11 @@ public class DataSourceProperty extends TableImpl<DataSourcePropertyRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<DataSourcePropertyRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<DataSourcePropertyRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private DataSourceProperty(Name alias, Table<DataSourcePropertyRecord> aliased) {
|
private DataSourcePropertyTable(Name alias, Table<DataSourcePropertyRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataSourceProperty(Name alias, Table<DataSourcePropertyRecord> aliased, Field<?>[] parameters) {
|
private DataSourcePropertyTable(Name alias, Table<DataSourcePropertyRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class DataSourceProperty extends TableImpl<DataSourcePropertyRecord> {
|
||||||
* Create an aliased <code>databasir.data_source_property</code> table
|
* Create an aliased <code>databasir.data_source_property</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DataSourceProperty(String alias) {
|
public DataSourcePropertyTable(String alias) {
|
||||||
this(DSL.name(alias), DATA_SOURCE_PROPERTY);
|
this(DSL.name(alias), DATA_SOURCE_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,18 +96,18 @@ public class DataSourceProperty extends TableImpl<DataSourcePropertyRecord> {
|
||||||
* Create an aliased <code>databasir.data_source_property</code> table
|
* Create an aliased <code>databasir.data_source_property</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DataSourceProperty(Name alias) {
|
public DataSourcePropertyTable(Name alias) {
|
||||||
this(alias, DATA_SOURCE_PROPERTY);
|
this(alias, DATA_SOURCE_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.data_source_property</code> table reference
|
* Create a <code>databasir.data_source_property</code> table reference
|
||||||
*/
|
*/
|
||||||
public DataSourceProperty() {
|
public DataSourcePropertyTable() {
|
||||||
this(DSL.name("data_source_property"), null);
|
this(DSL.name("data_source_property"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> DataSourceProperty(Table<O> child, ForeignKey<O, DataSourcePropertyRecord> key) {
|
public <O extends Record> DataSourcePropertyTable(Table<O> child, ForeignKey<O, DataSourcePropertyRecord> key) {
|
||||||
super(child, key, DATA_SOURCE_PROPERTY);
|
super(child, key, DATA_SOURCE_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,29 +132,29 @@ public class DataSourceProperty extends TableImpl<DataSourcePropertyRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSourceProperty as(String alias) {
|
public DataSourcePropertyTable as(String alias) {
|
||||||
return new DataSourceProperty(DSL.name(alias), this);
|
return new DataSourcePropertyTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSourceProperty as(Name alias) {
|
public DataSourcePropertyTable as(Name alias) {
|
||||||
return new DataSourceProperty(alias, this);
|
return new DataSourcePropertyTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DataSourceProperty rename(String name) {
|
public DataSourcePropertyTable rename(String name) {
|
||||||
return new DataSourceProperty(DSL.name(name), null);
|
return new DataSourcePropertyTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DataSourceProperty rename(Name name) {
|
public DataSourcePropertyTable rename(Name name) {
|
||||||
return new DataSourceProperty(name, null);
|
return new DataSourcePropertyTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -32,14 +32,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DataSource extends TableImpl<DataSourceRecord> {
|
public class DataSourceTable extends TableImpl<DataSourceRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.data_source</code>
|
* The reference instance of <code>databasir.data_source</code>
|
||||||
*/
|
*/
|
||||||
public static final DataSource DATA_SOURCE = new DataSource();
|
public static final DataSourceTable DATA_SOURCE = new DataSourceTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -99,36 +99,36 @@ public class DataSource extends TableImpl<DataSourceRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<DataSourceRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<DataSourceRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private DataSource(Name alias, Table<DataSourceRecord> aliased) {
|
private DataSourceTable(Name alias, Table<DataSourceRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataSource(Name alias, Table<DataSourceRecord> aliased, Field<?>[] parameters) {
|
private DataSourceTable(Name alias, Table<DataSourceRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.data_source</code> table reference
|
* Create an aliased <code>databasir.data_source</code> table reference
|
||||||
*/
|
*/
|
||||||
public DataSource(String alias) {
|
public DataSourceTable(String alias) {
|
||||||
this(DSL.name(alias), DATA_SOURCE);
|
this(DSL.name(alias), DATA_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.data_source</code> table reference
|
* Create an aliased <code>databasir.data_source</code> table reference
|
||||||
*/
|
*/
|
||||||
public DataSource(Name alias) {
|
public DataSourceTable(Name alias) {
|
||||||
this(alias, DATA_SOURCE);
|
this(alias, DATA_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.data_source</code> table reference
|
* Create a <code>databasir.data_source</code> table reference
|
||||||
*/
|
*/
|
||||||
public DataSource() {
|
public DataSourceTable() {
|
||||||
this(DSL.name("data_source"), null);
|
this(DSL.name("data_source"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> DataSource(Table<O> child, ForeignKey<O, DataSourceRecord> key) {
|
public <O extends Record> DataSourceTable(Table<O> child, ForeignKey<O, DataSourceRecord> key) {
|
||||||
super(child, key, DATA_SOURCE);
|
super(child, key, DATA_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,29 +153,29 @@ public class DataSource extends TableImpl<DataSourceRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSource as(String alias) {
|
public DataSourceTable as(String alias) {
|
||||||
return new DataSource(DSL.name(alias), this);
|
return new DataSourceTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSource as(Name alias) {
|
public DataSourceTable as(Name alias) {
|
||||||
return new DataSource(alias, this);
|
return new DataSourceTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DataSource rename(String name) {
|
public DataSourceTable rename(String name) {
|
||||||
return new DataSource(DSL.name(name), null);
|
return new DataSourceTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DataSource rename(Name name) {
|
public DataSourceTable rename(Name name) {
|
||||||
return new DataSource(name, null);
|
return new DataSourceTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -32,14 +32,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
public class DatabaseDocumentTable extends TableImpl<DatabaseDocumentRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.database_document</code>
|
* The reference instance of <code>databasir.database_document</code>
|
||||||
*/
|
*/
|
||||||
public static final DatabaseDocument DATABASE_DOCUMENT = new DatabaseDocument();
|
public static final DatabaseDocumentTable DATABASE_DOCUMENT = new DatabaseDocumentTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -99,11 +99,11 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<DatabaseDocumentRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<DatabaseDocumentRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private DatabaseDocument(Name alias, Table<DatabaseDocumentRecord> aliased) {
|
private DatabaseDocumentTable(Name alias, Table<DatabaseDocumentRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DatabaseDocument(Name alias, Table<DatabaseDocumentRecord> aliased, Field<?>[] parameters) {
|
private DatabaseDocumentTable(Name alias, Table<DatabaseDocumentRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
* Create an aliased <code>databasir.database_document</code> table
|
* Create an aliased <code>databasir.database_document</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DatabaseDocument(String alias) {
|
public DatabaseDocumentTable(String alias) {
|
||||||
this(DSL.name(alias), DATABASE_DOCUMENT);
|
this(DSL.name(alias), DATABASE_DOCUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,18 +119,18 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
* Create an aliased <code>databasir.database_document</code> table
|
* Create an aliased <code>databasir.database_document</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DatabaseDocument(Name alias) {
|
public DatabaseDocumentTable(Name alias) {
|
||||||
this(alias, DATABASE_DOCUMENT);
|
this(alias, DATABASE_DOCUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.database_document</code> table reference
|
* Create a <code>databasir.database_document</code> table reference
|
||||||
*/
|
*/
|
||||||
public DatabaseDocument() {
|
public DatabaseDocumentTable() {
|
||||||
this(DSL.name("database_document"), null);
|
this(DSL.name("database_document"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> DatabaseDocument(Table<O> child, ForeignKey<O, DatabaseDocumentRecord> key) {
|
public <O extends Record> DatabaseDocumentTable(Table<O> child, ForeignKey<O, DatabaseDocumentRecord> key) {
|
||||||
super(child, key, DATABASE_DOCUMENT);
|
super(child, key, DATABASE_DOCUMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,29 +155,29 @@ public class DatabaseDocument extends TableImpl<DatabaseDocumentRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseDocument as(String alias) {
|
public DatabaseDocumentTable as(String alias) {
|
||||||
return new DatabaseDocument(DSL.name(alias), this);
|
return new DatabaseDocumentTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseDocument as(Name alias) {
|
public DatabaseDocumentTable as(Name alias) {
|
||||||
return new DatabaseDocument(alias, this);
|
return new DatabaseDocumentTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DatabaseDocument rename(String name) {
|
public DatabaseDocumentTable rename(String name) {
|
||||||
return new DatabaseDocument(DSL.name(name), null);
|
return new DatabaseDocumentTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DatabaseDocument rename(Name name) {
|
public DatabaseDocumentTable rename(Name name) {
|
||||||
return new DatabaseDocument(name, null);
|
return new DatabaseDocumentTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -32,14 +32,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* customer database types
|
* customer database types
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DatabaseType extends TableImpl<DatabaseTypeRecord> {
|
public class DatabaseTypeTable extends TableImpl<DatabaseTypeRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.database_type</code>
|
* The reference instance of <code>databasir.database_type</code>
|
||||||
*/
|
*/
|
||||||
public static final DatabaseType DATABASE_TYPE = new DatabaseType();
|
public static final DatabaseTypeTable DATABASE_TYPE = new DatabaseTypeTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -115,36 +115,36 @@ public class DatabaseType extends TableImpl<DatabaseTypeRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<DatabaseTypeRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<DatabaseTypeRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private DatabaseType(Name alias, Table<DatabaseTypeRecord> aliased) {
|
private DatabaseTypeTable(Name alias, Table<DatabaseTypeRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DatabaseType(Name alias, Table<DatabaseTypeRecord> aliased, Field<?>[] parameters) {
|
private DatabaseTypeTable(Name alias, Table<DatabaseTypeRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment("customer database types"), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment("customer database types"), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.database_type</code> table reference
|
* Create an aliased <code>databasir.database_type</code> table reference
|
||||||
*/
|
*/
|
||||||
public DatabaseType(String alias) {
|
public DatabaseTypeTable(String alias) {
|
||||||
this(DSL.name(alias), DATABASE_TYPE);
|
this(DSL.name(alias), DATABASE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.database_type</code> table reference
|
* Create an aliased <code>databasir.database_type</code> table reference
|
||||||
*/
|
*/
|
||||||
public DatabaseType(Name alias) {
|
public DatabaseTypeTable(Name alias) {
|
||||||
this(alias, DATABASE_TYPE);
|
this(alias, DATABASE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.database_type</code> table reference
|
* Create a <code>databasir.database_type</code> table reference
|
||||||
*/
|
*/
|
||||||
public DatabaseType() {
|
public DatabaseTypeTable() {
|
||||||
this(DSL.name("database_type"), null);
|
this(DSL.name("database_type"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> DatabaseType(Table<O> child, ForeignKey<O, DatabaseTypeRecord> key) {
|
public <O extends Record> DatabaseTypeTable(Table<O> child, ForeignKey<O, DatabaseTypeRecord> key) {
|
||||||
super(child, key, DATABASE_TYPE);
|
super(child, key, DATABASE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,29 +169,29 @@ public class DatabaseType extends TableImpl<DatabaseTypeRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseType as(String alias) {
|
public DatabaseTypeTable as(String alias) {
|
||||||
return new DatabaseType(DSL.name(alias), this);
|
return new DatabaseTypeTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseType as(Name alias) {
|
public DatabaseTypeTable as(Name alias) {
|
||||||
return new DatabaseType(alias, this);
|
return new DatabaseTypeTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DatabaseType rename(String name) {
|
public DatabaseTypeTable rename(String name) {
|
||||||
return new DatabaseType(DSL.name(name), null);
|
return new DatabaseTypeTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DatabaseType rename(Name name) {
|
public DatabaseTypeTable rename(Name name) {
|
||||||
return new DatabaseType(name, null);
|
return new DatabaseTypeTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -32,14 +32,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* custom document description
|
* custom document description
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DocumentDescription extends TableImpl<DocumentDescriptionRecord> {
|
public class DocumentDescriptionTable extends TableImpl<DocumentDescriptionRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.document_description</code>
|
* The reference instance of <code>databasir.document_description</code>
|
||||||
*/
|
*/
|
||||||
public static final DocumentDescription DOCUMENT_DESCRIPTION = new DocumentDescription();
|
public static final DocumentDescriptionTable DOCUMENT_DESCRIPTION = new DocumentDescriptionTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -89,11 +89,11 @@ public class DocumentDescription extends TableImpl<DocumentDescriptionRecord> {
|
||||||
*/
|
*/
|
||||||
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, "");
|
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) {
|
private DocumentDescriptionTable(Name alias, Table<DocumentDescriptionRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DocumentDescription(Name alias, Table<DocumentDescriptionRecord> aliased, Field<?>[] parameters) {
|
private DocumentDescriptionTable(Name alias, Table<DocumentDescriptionRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment("custom document description"), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment("custom document description"), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public class DocumentDescription extends TableImpl<DocumentDescriptionRecord> {
|
||||||
* Create an aliased <code>databasir.document_description</code> table
|
* Create an aliased <code>databasir.document_description</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentDescription(String alias) {
|
public DocumentDescriptionTable(String alias) {
|
||||||
this(DSL.name(alias), DOCUMENT_DESCRIPTION);
|
this(DSL.name(alias), DOCUMENT_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,18 +109,18 @@ public class DocumentDescription extends TableImpl<DocumentDescriptionRecord> {
|
||||||
* Create an aliased <code>databasir.document_description</code> table
|
* Create an aliased <code>databasir.document_description</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentDescription(Name alias) {
|
public DocumentDescriptionTable(Name alias) {
|
||||||
this(alias, DOCUMENT_DESCRIPTION);
|
this(alias, DOCUMENT_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.document_description</code> table reference
|
* Create a <code>databasir.document_description</code> table reference
|
||||||
*/
|
*/
|
||||||
public DocumentDescription() {
|
public DocumentDescriptionTable() {
|
||||||
this(DSL.name("document_description"), null);
|
this(DSL.name("document_description"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> DocumentDescription(Table<O> child, ForeignKey<O, DocumentDescriptionRecord> key) {
|
public <O extends Record> DocumentDescriptionTable(Table<O> child, ForeignKey<O, DocumentDescriptionRecord> key) {
|
||||||
super(child, key, DOCUMENT_DESCRIPTION);
|
super(child, key, DOCUMENT_DESCRIPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,29 +145,29 @@ public class DocumentDescription extends TableImpl<DocumentDescriptionRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentDescription as(String alias) {
|
public DocumentDescriptionTable as(String alias) {
|
||||||
return new DocumentDescription(DSL.name(alias), this);
|
return new DocumentDescriptionTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentDescription as(Name alias) {
|
public DocumentDescriptionTable as(Name alias) {
|
||||||
return new DocumentDescription(alias, this);
|
return new DocumentDescriptionTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DocumentDescription rename(String name) {
|
public DocumentDescriptionTable rename(String name) {
|
||||||
return new DocumentDescription(DSL.name(name), null);
|
return new DocumentDescriptionTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DocumentDescription rename(Name name) {
|
public DocumentDescriptionTable rename(Name name) {
|
||||||
return new DocumentDescription(name, null);
|
return new DocumentDescriptionTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -34,14 +34,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DocumentDiscussion extends TableImpl<DocumentDiscussionRecord> {
|
public class DocumentDiscussionTable extends TableImpl<DocumentDiscussionRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.document_discussion</code>
|
* The reference instance of <code>databasir.document_discussion</code>
|
||||||
*/
|
*/
|
||||||
public static final DocumentDiscussion DOCUMENT_DISCUSSION = new DocumentDiscussion();
|
public static final DocumentDiscussionTable DOCUMENT_DISCUSSION = new DocumentDiscussionTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -86,11 +86,11 @@ public class DocumentDiscussion extends TableImpl<DocumentDiscussionRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<DocumentDiscussionRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<DocumentDiscussionRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private DocumentDiscussion(Name alias, Table<DocumentDiscussionRecord> aliased) {
|
private DocumentDiscussionTable(Name alias, Table<DocumentDiscussionRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DocumentDiscussion(Name alias, Table<DocumentDiscussionRecord> aliased, Field<?>[] parameters) {
|
private DocumentDiscussionTable(Name alias, Table<DocumentDiscussionRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ public class DocumentDiscussion extends TableImpl<DocumentDiscussionRecord> {
|
||||||
* Create an aliased <code>databasir.document_discussion</code> table
|
* Create an aliased <code>databasir.document_discussion</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentDiscussion(String alias) {
|
public DocumentDiscussionTable(String alias) {
|
||||||
this(DSL.name(alias), DOCUMENT_DISCUSSION);
|
this(DSL.name(alias), DOCUMENT_DISCUSSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,18 +106,18 @@ public class DocumentDiscussion extends TableImpl<DocumentDiscussionRecord> {
|
||||||
* Create an aliased <code>databasir.document_discussion</code> table
|
* Create an aliased <code>databasir.document_discussion</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentDiscussion(Name alias) {
|
public DocumentDiscussionTable(Name alias) {
|
||||||
this(alias, DOCUMENT_DISCUSSION);
|
this(alias, DOCUMENT_DISCUSSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.document_discussion</code> table reference
|
* Create a <code>databasir.document_discussion</code> table reference
|
||||||
*/
|
*/
|
||||||
public DocumentDiscussion() {
|
public DocumentDiscussionTable() {
|
||||||
this(DSL.name("document_discussion"), null);
|
this(DSL.name("document_discussion"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> DocumentDiscussion(Table<O> child, ForeignKey<O, DocumentDiscussionRecord> key) {
|
public <O extends Record> DocumentDiscussionTable(Table<O> child, ForeignKey<O, DocumentDiscussionRecord> key) {
|
||||||
super(child, key, DOCUMENT_DISCUSSION);
|
super(child, key, DOCUMENT_DISCUSSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,29 +142,29 @@ public class DocumentDiscussion extends TableImpl<DocumentDiscussionRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentDiscussion as(String alias) {
|
public DocumentDiscussionTable as(String alias) {
|
||||||
return new DocumentDiscussion(DSL.name(alias), this);
|
return new DocumentDiscussionTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentDiscussion as(Name alias) {
|
public DocumentDiscussionTable as(Name alias) {
|
||||||
return new DocumentDiscussion(alias, this);
|
return new DocumentDiscussionTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DocumentDiscussion rename(String name) {
|
public DocumentDiscussionTable rename(String name) {
|
||||||
return new DocumentDiscussion(DSL.name(name), null);
|
return new DocumentDiscussionTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DocumentDiscussion rename(Name name) {
|
public DocumentDiscussionTable rename(Name name) {
|
||||||
return new DocumentDiscussion(name, null);
|
return new DocumentDiscussionTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -8,28 +8,39 @@ import com.databasir.dao.Databasir;
|
||||||
import com.databasir.dao.Indexes;
|
import com.databasir.dao.Indexes;
|
||||||
import com.databasir.dao.Keys;
|
import com.databasir.dao.Keys;
|
||||||
import com.databasir.dao.tables.records.DocumentFullTextRecord;
|
import com.databasir.dao.tables.records.DocumentFullTextRecord;
|
||||||
import org.jooq.*;
|
|
||||||
import org.jooq.impl.DSL;
|
|
||||||
import org.jooq.impl.SQLDataType;
|
|
||||||
import org.jooq.impl.TableImpl;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.jooq.Field;
|
||||||
|
import org.jooq.ForeignKey;
|
||||||
|
import org.jooq.Identity;
|
||||||
|
import org.jooq.Index;
|
||||||
|
import org.jooq.Name;
|
||||||
|
import org.jooq.Record;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
|
public class DocumentFullTextTable extends TableImpl<DocumentFullTextRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.document_full_text</code>
|
* The reference instance of <code>databasir.document_full_text</code>
|
||||||
*/
|
*/
|
||||||
public static final DocumentFullText DOCUMENT_FULL_TEXT = new DocumentFullText();
|
public static final DocumentFullTextTable DOCUMENT_FULL_TEXT = new DocumentFullTextTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -164,11 +175,11 @@ public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<DocumentFullTextRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<DocumentFullTextRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private DocumentFullText(Name alias, Table<DocumentFullTextRecord> aliased) {
|
private DocumentFullTextTable(Name alias, Table<DocumentFullTextRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DocumentFullText(Name alias, Table<DocumentFullTextRecord> aliased, Field<?>[] parameters) {
|
private DocumentFullTextTable(Name alias, Table<DocumentFullTextRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +187,7 @@ public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
|
||||||
* Create an aliased <code>databasir.document_full_text</code> table
|
* Create an aliased <code>databasir.document_full_text</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentFullText(String alias) {
|
public DocumentFullTextTable(String alias) {
|
||||||
this(DSL.name(alias), DOCUMENT_FULL_TEXT);
|
this(DSL.name(alias), DOCUMENT_FULL_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,18 +195,18 @@ public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
|
||||||
* Create an aliased <code>databasir.document_full_text</code> table
|
* Create an aliased <code>databasir.document_full_text</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentFullText(Name alias) {
|
public DocumentFullTextTable(Name alias) {
|
||||||
this(alias, DOCUMENT_FULL_TEXT);
|
this(alias, DOCUMENT_FULL_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.document_full_text</code> table reference
|
* Create a <code>databasir.document_full_text</code> table reference
|
||||||
*/
|
*/
|
||||||
public DocumentFullText() {
|
public DocumentFullTextTable() {
|
||||||
this(DSL.name("document_full_text"), null);
|
this(DSL.name("document_full_text"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> DocumentFullText(Table<O> child, ForeignKey<O, DocumentFullTextRecord> key) {
|
public <O extends Record> DocumentFullTextTable(Table<O> child, ForeignKey<O, DocumentFullTextRecord> key) {
|
||||||
super(child, key, DOCUMENT_FULL_TEXT);
|
super(child, key, DOCUMENT_FULL_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,28 +231,28 @@ public class DocumentFullText extends TableImpl<DocumentFullTextRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentFullText as(String alias) {
|
public DocumentFullTextTable as(String alias) {
|
||||||
return new DocumentFullText(DSL.name(alias), this);
|
return new DocumentFullTextTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentFullText as(Name alias) {
|
public DocumentFullTextTable as(Name alias) {
|
||||||
return new DocumentFullText(alias, this);
|
return new DocumentFullTextTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DocumentFullText rename(String name) {
|
public DocumentFullTextTable rename(String name) {
|
||||||
return new DocumentFullText(DSL.name(name), null);
|
return new DocumentFullTextTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DocumentFullText rename(Name name) {
|
public DocumentFullTextTable rename(Name name) {
|
||||||
return new DocumentFullText(name, null);
|
return new DocumentFullTextTable(name, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ import org.jooq.impl.TableImpl;
|
||||||
* template property
|
* template property
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class DocumentTemplateProperty extends TableImpl<DocumentTemplatePropertyRecord> {
|
public class DocumentTemplatePropertyTable extends TableImpl<DocumentTemplatePropertyRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class DocumentTemplateProperty extends TableImpl<DocumentTemplateProperty
|
||||||
* The reference instance of
|
* The reference instance of
|
||||||
* <code>databasir.document_template_property</code>
|
* <code>databasir.document_template_property</code>
|
||||||
*/
|
*/
|
||||||
public static final DocumentTemplateProperty DOCUMENT_TEMPLATE_PROPERTY = new DocumentTemplateProperty();
|
public static final DocumentTemplatePropertyTable DOCUMENT_TEMPLATE_PROPERTY = new DocumentTemplatePropertyTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -83,11 +83,11 @@ public class DocumentTemplateProperty extends TableImpl<DocumentTemplateProperty
|
||||||
*/
|
*/
|
||||||
public final TableField<DocumentTemplatePropertyRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<DocumentTemplatePropertyRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private DocumentTemplateProperty(Name alias, Table<DocumentTemplatePropertyRecord> aliased) {
|
private DocumentTemplatePropertyTable(Name alias, Table<DocumentTemplatePropertyRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DocumentTemplateProperty(Name alias, Table<DocumentTemplatePropertyRecord> aliased, Field<?>[] parameters) {
|
private DocumentTemplatePropertyTable(Name alias, Table<DocumentTemplatePropertyRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment("template property"), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment("template property"), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class DocumentTemplateProperty extends TableImpl<DocumentTemplateProperty
|
||||||
* Create an aliased <code>databasir.document_template_property</code> table
|
* Create an aliased <code>databasir.document_template_property</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentTemplateProperty(String alias) {
|
public DocumentTemplatePropertyTable(String alias) {
|
||||||
this(DSL.name(alias), DOCUMENT_TEMPLATE_PROPERTY);
|
this(DSL.name(alias), DOCUMENT_TEMPLATE_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public class DocumentTemplateProperty extends TableImpl<DocumentTemplateProperty
|
||||||
* Create an aliased <code>databasir.document_template_property</code> table
|
* Create an aliased <code>databasir.document_template_property</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentTemplateProperty(Name alias) {
|
public DocumentTemplatePropertyTable(Name alias) {
|
||||||
this(alias, DOCUMENT_TEMPLATE_PROPERTY);
|
this(alias, DOCUMENT_TEMPLATE_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,11 +111,11 @@ public class DocumentTemplateProperty extends TableImpl<DocumentTemplateProperty
|
||||||
* Create a <code>databasir.document_template_property</code> table
|
* Create a <code>databasir.document_template_property</code> table
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
public DocumentTemplateProperty() {
|
public DocumentTemplatePropertyTable() {
|
||||||
this(DSL.name("document_template_property"), null);
|
this(DSL.name("document_template_property"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> DocumentTemplateProperty(Table<O> child, ForeignKey<O, DocumentTemplatePropertyRecord> key) {
|
public <O extends Record> DocumentTemplatePropertyTable(Table<O> child, ForeignKey<O, DocumentTemplatePropertyRecord> key) {
|
||||||
super(child, key, DOCUMENT_TEMPLATE_PROPERTY);
|
super(child, key, DOCUMENT_TEMPLATE_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,29 +140,29 @@ public class DocumentTemplateProperty extends TableImpl<DocumentTemplateProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentTemplateProperty as(String alias) {
|
public DocumentTemplatePropertyTable as(String alias) {
|
||||||
return new DocumentTemplateProperty(DSL.name(alias), this);
|
return new DocumentTemplatePropertyTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocumentTemplateProperty as(Name alias) {
|
public DocumentTemplatePropertyTable as(Name alias) {
|
||||||
return new DocumentTemplateProperty(alias, this);
|
return new DocumentTemplatePropertyTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DocumentTemplateProperty rename(String name) {
|
public DocumentTemplatePropertyTable rename(String name) {
|
||||||
return new DocumentTemplateProperty(DSL.name(name), null);
|
return new DocumentTemplatePropertyTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public DocumentTemplateProperty rename(Name name) {
|
public DocumentTemplatePropertyTable rename(Name name) {
|
||||||
return new DocumentTemplateProperty(name, null);
|
return new DocumentTemplatePropertyTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -30,14 +30,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class Group extends TableImpl<GroupRecord> {
|
public class GroupTable extends TableImpl<GroupRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.group</code>
|
* The reference instance of <code>databasir.group</code>
|
||||||
*/
|
*/
|
||||||
public static final Group GROUP = new Group();
|
public static final GroupTable GROUP = new GroupTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -77,36 +77,36 @@ public class Group extends TableImpl<GroupRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<GroupRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<GroupRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private Group(Name alias, Table<GroupRecord> aliased) {
|
private GroupTable(Name alias, Table<GroupRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Group(Name alias, Table<GroupRecord> aliased, Field<?>[] parameters) {
|
private GroupTable(Name alias, Table<GroupRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.group</code> table reference
|
* Create an aliased <code>databasir.group</code> table reference
|
||||||
*/
|
*/
|
||||||
public Group(String alias) {
|
public GroupTable(String alias) {
|
||||||
this(DSL.name(alias), GROUP);
|
this(DSL.name(alias), GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.group</code> table reference
|
* Create an aliased <code>databasir.group</code> table reference
|
||||||
*/
|
*/
|
||||||
public Group(Name alias) {
|
public GroupTable(Name alias) {
|
||||||
this(alias, GROUP);
|
this(alias, GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.group</code> table reference
|
* Create a <code>databasir.group</code> table reference
|
||||||
*/
|
*/
|
||||||
public Group() {
|
public GroupTable() {
|
||||||
this(DSL.name("group"), null);
|
this(DSL.name("group"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> Group(Table<O> child, ForeignKey<O, GroupRecord> key) {
|
public <O extends Record> GroupTable(Table<O> child, ForeignKey<O, GroupRecord> key) {
|
||||||
super(child, key, GROUP);
|
super(child, key, GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,29 +126,29 @@ public class Group extends TableImpl<GroupRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Group as(String alias) {
|
public GroupTable as(String alias) {
|
||||||
return new Group(DSL.name(alias), this);
|
return new GroupTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Group as(Name alias) {
|
public GroupTable as(Name alias) {
|
||||||
return new Group(alias, this);
|
return new GroupTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Group rename(String name) {
|
public GroupTable rename(String name) {
|
||||||
return new Group(DSL.name(name), null);
|
return new GroupTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Group rename(Name name) {
|
public GroupTable rename(Name name) {
|
||||||
return new Group(name, null);
|
return new GroupTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -32,14 +32,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class Login extends TableImpl<LoginRecord> {
|
public class LoginTable extends TableImpl<LoginRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.login</code>
|
* The reference instance of <code>databasir.login</code>
|
||||||
*/
|
*/
|
||||||
public static final Login LOGIN = new Login();
|
public static final LoginTable LOGIN = new LoginTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -89,36 +89,36 @@ public class Login extends TableImpl<LoginRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<LoginRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<LoginRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private Login(Name alias, Table<LoginRecord> aliased) {
|
private LoginTable(Name alias, Table<LoginRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Login(Name alias, Table<LoginRecord> aliased, Field<?>[] parameters) {
|
private LoginTable(Name alias, Table<LoginRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.login</code> table reference
|
* Create an aliased <code>databasir.login</code> table reference
|
||||||
*/
|
*/
|
||||||
public Login(String alias) {
|
public LoginTable(String alias) {
|
||||||
this(DSL.name(alias), LOGIN);
|
this(DSL.name(alias), LOGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.login</code> table reference
|
* Create an aliased <code>databasir.login</code> table reference
|
||||||
*/
|
*/
|
||||||
public Login(Name alias) {
|
public LoginTable(Name alias) {
|
||||||
this(alias, LOGIN);
|
this(alias, LOGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.login</code> table reference
|
* Create a <code>databasir.login</code> table reference
|
||||||
*/
|
*/
|
||||||
public Login() {
|
public LoginTable() {
|
||||||
this(DSL.name("login"), null);
|
this(DSL.name("login"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> Login(Table<O> child, ForeignKey<O, LoginRecord> key) {
|
public <O extends Record> LoginTable(Table<O> child, ForeignKey<O, LoginRecord> key) {
|
||||||
super(child, key, LOGIN);
|
super(child, key, LOGIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,29 +143,29 @@ public class Login extends TableImpl<LoginRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Login as(String alias) {
|
public LoginTable as(String alias) {
|
||||||
return new Login(DSL.name(alias), this);
|
return new LoginTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Login as(Name alias) {
|
public LoginTable as(Name alias) {
|
||||||
return new Login(alias, this);
|
return new LoginTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Login rename(String name) {
|
public LoginTable rename(String name) {
|
||||||
return new Login(DSL.name(name), null);
|
return new LoginTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Login rename(Name name) {
|
public LoginTable rename(Name name) {
|
||||||
return new Login(name, null);
|
return new LoginTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -34,14 +34,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* This class is generated by jOOQ.
|
* This class is generated by jOOQ.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class MockDataRule extends TableImpl<MockDataRuleRecord> {
|
public class MockDataRuleTable extends TableImpl<MockDataRuleRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.mock_data_rule</code>
|
* The reference instance of <code>databasir.mock_data_rule</code>
|
||||||
*/
|
*/
|
||||||
public static final MockDataRule MOCK_DATA_RULE = new MockDataRule();
|
public static final MockDataRuleTable MOCK_DATA_RULE = new MockDataRuleTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -101,36 +101,36 @@ public class MockDataRule extends TableImpl<MockDataRuleRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<MockDataRuleRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<MockDataRuleRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private MockDataRule(Name alias, Table<MockDataRuleRecord> aliased) {
|
private MockDataRuleTable(Name alias, Table<MockDataRuleRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MockDataRule(Name alias, Table<MockDataRuleRecord> aliased, Field<?>[] parameters) {
|
private MockDataRuleTable(Name alias, Table<MockDataRuleRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.mock_data_rule</code> table reference
|
* Create an aliased <code>databasir.mock_data_rule</code> table reference
|
||||||
*/
|
*/
|
||||||
public MockDataRule(String alias) {
|
public MockDataRuleTable(String alias) {
|
||||||
this(DSL.name(alias), MOCK_DATA_RULE);
|
this(DSL.name(alias), MOCK_DATA_RULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.mock_data_rule</code> table reference
|
* Create an aliased <code>databasir.mock_data_rule</code> table reference
|
||||||
*/
|
*/
|
||||||
public MockDataRule(Name alias) {
|
public MockDataRuleTable(Name alias) {
|
||||||
this(alias, MOCK_DATA_RULE);
|
this(alias, MOCK_DATA_RULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.mock_data_rule</code> table reference
|
* Create a <code>databasir.mock_data_rule</code> table reference
|
||||||
*/
|
*/
|
||||||
public MockDataRule() {
|
public MockDataRuleTable() {
|
||||||
this(DSL.name("mock_data_rule"), null);
|
this(DSL.name("mock_data_rule"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> MockDataRule(Table<O> child, ForeignKey<O, MockDataRuleRecord> key) {
|
public <O extends Record> MockDataRuleTable(Table<O> child, ForeignKey<O, MockDataRuleRecord> key) {
|
||||||
super(child, key, MOCK_DATA_RULE);
|
super(child, key, MOCK_DATA_RULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,29 +155,29 @@ public class MockDataRule extends TableImpl<MockDataRuleRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockDataRule as(String alias) {
|
public MockDataRuleTable as(String alias) {
|
||||||
return new MockDataRule(DSL.name(alias), this);
|
return new MockDataRuleTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MockDataRule as(Name alias) {
|
public MockDataRuleTable as(Name alias) {
|
||||||
return new MockDataRule(alias, this);
|
return new MockDataRuleTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MockDataRule rename(String name) {
|
public MockDataRuleTable rename(String name) {
|
||||||
return new MockDataRule(DSL.name(name), null);
|
return new MockDataRuleTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MockDataRule rename(Name name) {
|
public MockDataRuleTable rename(Name name) {
|
||||||
return new MockDataRule(name, null);
|
return new MockDataRuleTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
|
@ -34,14 +34,14 @@ import org.jooq.impl.TableImpl;
|
||||||
* oauth app info
|
* oauth app info
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||||
public class OauthApp extends TableImpl<OauthAppRecord> {
|
public class OauthAppTable extends TableImpl<OauthAppRecord> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The reference instance of <code>databasir.oauth_app</code>
|
* The reference instance of <code>databasir.oauth_app</code>
|
||||||
*/
|
*/
|
||||||
public static final OauthApp OAUTH_APP = new OauthApp();
|
public static final OauthAppTable OAUTH_APP = new OauthAppTable();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class holding records for this type
|
* The class holding records for this type
|
||||||
|
@ -111,36 +111,36 @@ public class OauthApp extends TableImpl<OauthAppRecord> {
|
||||||
*/
|
*/
|
||||||
public final TableField<OauthAppRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
public final TableField<OauthAppRecord, LocalDateTime> CREATE_AT = createField(DSL.name("create_at"), SQLDataType.LOCALDATETIME(0).nullable(false).defaultValue(DSL.field("CURRENT_TIMESTAMP", SQLDataType.LOCALDATETIME)), this, "");
|
||||||
|
|
||||||
private OauthApp(Name alias, Table<OauthAppRecord> aliased) {
|
private OauthAppTable(Name alias, Table<OauthAppRecord> aliased) {
|
||||||
this(alias, aliased, null);
|
this(alias, aliased, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OauthApp(Name alias, Table<OauthAppRecord> aliased, Field<?>[] parameters) {
|
private OauthAppTable(Name alias, Table<OauthAppRecord> aliased, Field<?>[] parameters) {
|
||||||
super(alias, null, aliased, parameters, DSL.comment("oauth app info"), TableOptions.table());
|
super(alias, null, aliased, parameters, DSL.comment("oauth app info"), TableOptions.table());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.oauth_app</code> table reference
|
* Create an aliased <code>databasir.oauth_app</code> table reference
|
||||||
*/
|
*/
|
||||||
public OauthApp(String alias) {
|
public OauthAppTable(String alias) {
|
||||||
this(DSL.name(alias), OAUTH_APP);
|
this(DSL.name(alias), OAUTH_APP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an aliased <code>databasir.oauth_app</code> table reference
|
* Create an aliased <code>databasir.oauth_app</code> table reference
|
||||||
*/
|
*/
|
||||||
public OauthApp(Name alias) {
|
public OauthAppTable(Name alias) {
|
||||||
this(alias, OAUTH_APP);
|
this(alias, OAUTH_APP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a <code>databasir.oauth_app</code> table reference
|
* Create a <code>databasir.oauth_app</code> table reference
|
||||||
*/
|
*/
|
||||||
public OauthApp() {
|
public OauthAppTable() {
|
||||||
this(DSL.name("oauth_app"), null);
|
this(DSL.name("oauth_app"), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <O extends Record> OauthApp(Table<O> child, ForeignKey<O, OauthAppRecord> key) {
|
public <O extends Record> OauthAppTable(Table<O> child, ForeignKey<O, OauthAppRecord> key) {
|
||||||
super(child, key, OAUTH_APP);
|
super(child, key, OAUTH_APP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,29 +165,29 @@ public class OauthApp extends TableImpl<OauthAppRecord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OauthApp as(String alias) {
|
public OauthAppTable as(String alias) {
|
||||||
return new OauthApp(DSL.name(alias), this);
|
return new OauthAppTable(DSL.name(alias), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OauthApp as(Name alias) {
|
public OauthAppTable as(Name alias) {
|
||||||
return new OauthApp(alias, this);
|
return new OauthAppTable(alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public OauthApp rename(String name) {
|
public OauthAppTable rename(String name) {
|
||||||
return new OauthApp(DSL.name(name), null);
|
return new OauthAppTable(DSL.name(name), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rename this table
|
* Rename this table
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public OauthApp rename(Name name) {
|
public OauthAppTable rename(Name name) {
|
||||||
return new OauthApp(name, null);
|
return new OauthAppTable(name, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue