-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #271 from kdhrubo/feature/270_revamp_query_engine
Feature/270 revamp query engine
- Loading branch information
Showing
46 changed files
with
510 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 9 additions & 38 deletions
47
src/main/java/com/homihq/db2rest/rest/read/ReadService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 12 additions & 6 deletions
18
src/main/java/com/homihq/db2rest/rest/read/dto/JoinDetail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
package com.homihq.db2rest.rest.read.dto; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.mybatis.dynamic.sql.select.join.JoinType; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
|
||
public record JoinDetail (String table, List<String> fields,String on, List<String> andFilters, String type){ | ||
public record JoinDetail (String table, String with, List<String> fields, | ||
List<String> on, String filter, String type){ | ||
|
||
public JoinType getJoinType() { | ||
return StringUtils.isBlank(type) ? JoinType.INNER : | ||
JoinType.valueOf(StringUtils.upperCase(type)); | ||
public String getJoinType() { | ||
return StringUtils.isBlank(type) ? "INNER" : | ||
StringUtils.upperCase(type); | ||
|
||
} | ||
public boolean hasOn() { | ||
return Objects.nonNull(on) && !on.isEmpty(); | ||
} | ||
|
||
|
||
public boolean hasFilter() { | ||
return StringUtils.isNotBlank(filter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/java/com/homihq/db2rest/rest/read/helper/AliasGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.homihq.db2rest.rest.read.helper; | ||
|
||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.Random; | ||
|
||
@Component | ||
public class AliasGenerator { | ||
private Random random = new Random(); | ||
public String getAlias(String prefix, int length, String sqlIdentifier) { | ||
return | ||
sqlIdentifier.length() > length ? | ||
prefix + sqlIdentifier.substring(0,length) + "_" +random.nextInt(2000) | ||
: prefix + sqlIdentifier + "_" +random.nextInt(2000); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
@NoArgsConstructor | ||
@Data | ||
@Slf4j | ||
@Deprecated | ||
public class ReadContext { | ||
|
||
String schemaName; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
@Component | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
@Deprecated | ||
public class WhereBuilder{ | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.