-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ NEW: golongan kata and cakupan filter in view
- Loading branch information
Showing
4 changed files
with
91 additions
and
4 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
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
backend/database/transactions/select_lemma_with_cakupan_in_konsep_view.sql
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,35 @@ | ||
WITH items AS ( | ||
WITH params AS (SELECT ? as lemma, ? as cakupan) | ||
SELECT | ||
lemma.nama AS lemma | ||
FROM lemma, params | ||
LEFT JOIN konsep ON konsep.lemma_id = lemma.id | ||
LEFT JOIN cakupan_x_konsep as cxk ON cxk.konsep_id = konsep.id | ||
LEFT JOIN cakupan ON cakupan.id = cxk.cakupan_id | ||
WHERE | ||
(CASE | ||
WHEN params.lemma IS NOT NULL THEN lemma.nama = params.lemma | ||
ELSE lemma.nama IS NOT NULL | ||
END) AND | ||
cakupan.nama = params.cakupan | ||
) | ||
-- THE RESULTING TABLE THAT IS DESERIALIZED INTO STRUCT | ||
SELECT | ||
lemma.nama AS lemma, | ||
konsep.keterangan AS konsep, | ||
golongan_kata.nama AS golongan_kata, | ||
cakupan.nama AS cakupan, | ||
kata_asing.nama AS kata_asing, | ||
kata_asing.bahasa AS bahasa_asing, | ||
lemma.id AS l_id, | ||
konsep.id AS k_id | ||
FROM lemma, items | ||
LEFT JOIN konsep ON konsep.lemma_id = lemma.id | ||
LEFT JOIN golongan_kata ON konsep.golongan_id = golongan_kata.id | ||
LEFT JOIN cakupan_x_konsep as cxk ON cxk.konsep_id = konsep.id | ||
LEFT JOIN cakupan ON cakupan.id = cxk.cakupan_id | ||
LEFT JOIN kata_asing_x_konsep as kaxk ON kaxk.konsep_id = konsep.id | ||
LEFT JOIN kata_asing ON kata_asing.id = kaxk.kata_asing_id | ||
WHERE | ||
lemma.nama = items.lemma | ||
|
24 changes: 24 additions & 0 deletions
24
backend/database/transactions/select_lemma_with_golongan_kata_in_konsep_view.sql
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,24 @@ | ||
WITH params AS (SELECT ? as lemma, ? as golkat) | ||
-- THE RESULTING TABLE THAT IS DESERIALIZED INTO STRUCT | ||
SELECT | ||
lemma.nama AS lemma, | ||
konsep.keterangan AS konsep, | ||
golongan_kata.nama AS golongan_kata, | ||
cakupan.nama AS cakupan, | ||
kata_asing.nama AS kata_asing, | ||
kata_asing.bahasa AS bahasa_asing, | ||
lemma.id AS l_id, | ||
konsep.id AS k_id | ||
FROM lemma, params | ||
LEFT JOIN konsep ON konsep.lemma_id = lemma.id | ||
LEFT JOIN golongan_kata ON konsep.golongan_id = golongan_kata.id | ||
LEFT JOIN cakupan_x_konsep as cxk ON cxk.konsep_id = konsep.id | ||
LEFT JOIN cakupan ON cakupan.id = cxk.cakupan_id | ||
LEFT JOIN kata_asing_x_konsep as kaxk ON kaxk.konsep_id = konsep.id | ||
LEFT JOIN kata_asing ON kata_asing.id = kaxk.kata_asing_id | ||
WHERE | ||
(CASE | ||
WHEN params.lemma IS NOT NULL THEN lemma.nama = params.lemma | ||
ELSE lemma.nama IS NOT NULL | ||
END) AND | ||
golongan_kata.nama = params.golkat |