-
-
Notifications
You must be signed in to change notification settings - Fork 39
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 #725 from lserveriiev/feature/replace-thymeleaf-wi…
…th-jte Replace Thymeleaf with JTE
- Loading branch information
Showing
31 changed files
with
390 additions
and
276 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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@param String rootTable | ||
@param String rootWhere | ||
|
||
SELECT | ||
COUNT(*) | ||
FROM | ||
${rootTable} | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif |
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
api-rest/src/main/resources/sql-templates/delete-mssql.jte
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,10 @@ | ||
@param String rootTable | ||
@param String rootWhere | ||
@param String rootTableAlias | ||
|
||
DELETE FROM ${rootTableAlias} | ||
FROM ${rootTable} | ||
|
||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
@param String rootTable | ||
@param String rootWhere | ||
|
||
DELETE FROM | ||
${rootTable} | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif |
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
api-rest/src/main/resources/sql-templates/exists-mssql.jte
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,17 @@ | ||
@import com.homihq.db2rest.jdbc.config.model.DbJoin | ||
@import java.util.List | ||
|
||
@param String rootTable | ||
@param String rootWhere | ||
@param List<DbJoin> joins | ||
|
||
SELECT TOP 1 1 | ||
FROM ${rootTable} | ||
@if(joins != null) | ||
@for(DbJoin join : joins) | ||
${join.render()} | ||
@endfor | ||
@endif | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif |
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
@import com.homihq.db2rest.jdbc.config.model.DbJoin | ||
@import java.util.List | ||
|
||
@param String rootTable | ||
@param String rootWhere | ||
@param List<DbJoin> joins | ||
|
||
SELECT | ||
1 | ||
FROM ${rootTable} | ||
@if(joins != null) | ||
@for(DbJoin join : joins) | ||
${join.render()} | ||
@endfor | ||
@endif | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif | ||
LIMIT 1 |
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
@param String rootTable | ||
@param String rootWhere | ||
@param String columns | ||
|
||
SELECT | ||
${columns} | ||
FROM | ||
${rootTable} | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
@param String columns | ||
@param String table | ||
@param String parameters | ||
|
||
INSERT INTO ${table} | ||
(${columns}) | ||
VALUES | ||
(${parameters}) |
This file was deleted.
Oops, something went wrong.
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,70 @@ | ||
@import com.homihq.db2rest.jdbc.config.model.DbJoin | ||
@import java.util.List | ||
|
||
@param List<DbJoin> joins | ||
@param String rootTable | ||
@param String columns | ||
@param String rootWhere | ||
@param String sorts | ||
@param Integer limit | ||
@param Long offset | ||
|
||
@if(sorts != null) | ||
SELECT | ||
${columns} | ||
FROM ${rootTable} | ||
@if(joins != null) | ||
@for(DbJoin join : joins) | ||
${join.render()} | ||
@endfor | ||
@endif | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif | ||
ORDER BY ${sorts} | ||
@if(limit != null) | ||
OFFSET ${(offset == null ? 0 : offset)} ROWS FETCH NEXT ${limit} ROWS ONLY | ||
@endif | ||
@elseif(limit != null) | ||
@if(offset != null) | ||
SELECT T.* FROM | ||
( | ||
SELECT | ||
${columns}, | ||
ROW_NUMBER() OVER(ORDER BY (SELECT 1)) AS rowIndex | ||
FROM ${rootTable} | ||
@if(joins != null) | ||
@for(DbJoin join : joins) | ||
${join.render()} | ||
@endfor | ||
@endif | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif | ||
) AS T | ||
WHERE rowIndex > ${offset} AND rowIndex <= ${offset + limit} | ||
@else | ||
SELECT TOP ${limit} ${columns} | ||
FROM ${rootTable} | ||
@if(joins != null) | ||
@for(DbJoin join : joins) | ||
${join.render()} | ||
@endfor | ||
@endif | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif | ||
@endif | ||
@else | ||
SELECT | ||
${columns} | ||
FROM ${rootTable} | ||
@if(joins != null) | ||
@for(DbJoin join : joins) | ||
${join.render()} | ||
@endfor | ||
@endif | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif | ||
@endif |
This file was deleted.
Oops, something went wrong.
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,34 @@ | ||
@import com.homihq.db2rest.jdbc.config.model.DbJoin | ||
@import java.util.List | ||
|
||
@param List<DbJoin> joins | ||
@param String rootTable | ||
@param String columns | ||
@param String rootWhere | ||
@param String sorts | ||
@param Integer limit | ||
@param Long offset | ||
|
||
SELECT | ||
${columns} | ||
FROM | ||
${rootTable} | ||
@if(joins != null) | ||
@for(DbJoin join : joins) | ||
${join.render()} | ||
@endfor | ||
@endif | ||
@if(rootWhere != null) | ||
WHERE ${rootWhere} | ||
@endif | ||
@if(sorts != null) | ||
ORDER BY ${sorts} | ||
@endif | ||
@if(limit != null) | ||
@if(offset != null) | ||
OFFSET ${offset} ROWS | ||
FETCH NEXT ${limit} ROWS ONLY | ||
@else | ||
FETCH FIRST ${limit} ROWS ONLY | ||
@endif | ||
@endif |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.