query riferimenti progress

This commit is contained in:
cesare 2025-02-03 09:43:02 +01:00
parent fa3df99610
commit 9b20985629
1 changed files with 19 additions and 0 deletions

View File

@ -135,6 +135,14 @@ export async function queryRiferimenti(filtro, cid) {
return
}
console.log(filtro)
var contenuti_riferimento={'personaggio': " and CPER !='' and CPER !='no'",
'episodio': " and CEP !='' and CEP !='no'",
'motivo': " and CMO !='' and CMO !='no'",
'immagine': " and CIM !='' and CIM !='no'",
'teoria': " and CTE !='' and CTE !='no'",
'stilema': " and CST !='' and CST !='no'",
'topografia': " and CTO !='' and CTO !='no'"
}
const tconn = await db.connect();
var querytl = 'select Cantica, Canto, Verso from riferimenti'
var queryfi = ' where '
@ -152,6 +160,17 @@ export async function queryRiferimenti(filtro, cid) {
if (filtro.Tipo_Riferimento != null && filtro.Tipo_Riferimento.trim() != 'all')
queryfi += " and NaRi='" + filtro.Tipo_Riferimento.trim().toUpperCase() + "'"
if( filtro.Contenuto_Riferimento!=null && filtro.Contenuto_Riferimento!='all')
queryfi+=contenuti_riferimento[filtro.Contenuto_Riferimento.trim()]
if( filtro.Rapporto_Testo_Fonte!=null && filtro.Rapporto_Testo_Fonte!='all')
queryfi+=" and UPPER(RSO)=UPPER('" + filtro.Rapporto_Testo_Fonte.trim() + "')"
if( filtro.Testo_Fonte!=null && filtro.Testo_Fonte.trim()!='')
queryfi+=" and TF like '%" + filtro.Testo_Fonte.trim() + "%'"
if( filtro.Testo_Nota!=null && filtro.Testo_Nota.trim()!='')
queryfi+=" and Ann like '%" + filtro.Testo_Nota.trim() + "%'"
var rs = await tconn.query(querytl + queryfi)
var result4 = rs.toArray().map((row) => row.toJSON());