Final (?) de-widgetification

This commit is contained in:
2021-09-07 14:33:48 +00:00
parent 898daac02c
commit 316c8aa5bd
27 changed files with 45 additions and 1560 deletions

View File

@@ -9,14 +9,7 @@ namespace AyaNova.PickList
internal static class PickListSqlBuilder
{
/*Example
select awidget.id as plId, awidget.active as plActive, awidget.name || ' ' || awidget.serial || ' ' || auser.name as plname, awidget.tags
from awidget left join auser on (awidget.userid=auser.id)
where array_to_string(awidget.tags,',') like '%zone-8%'
and awidget.active = true
and ((awidget.name like '%we%') or (cast (awidget.serial as text) like '%we%') or (auser.name like '%we%'))
order by awidget.name,awidget.serial,auser.name limit 100
*/
//Maximum number of results to return at any given time
//did a little research and may adjust this but it can be fairly girthy in this day and age
@@ -149,7 +142,7 @@ namespace AyaNova.PickList
lOrderBy.Add(valueColumnName);
//THIS is the best filter method for a like comparison to each individual tag:
//(array_to_string(awidget.tags,',') like '%zo%')
//(array_to_string(acustomer.tags,',') like '%zo%')
//Note that a tag specific query takes precendence over this which exists
//in cases where there are tags in the template and the user has not specified a tag specific query
//so this will handle it as a like query against all tags as a composite string of text just like
@@ -191,7 +184,7 @@ namespace AyaNova.PickList
lOrderBy.Add(valueColumnName);
//Where fragment is different for non text fields: it needs to be cast to text to like query on it
//(cast (awidget.serial as text) like '%some%')
//(cast (aworkorder.serial as text) like '%some%')
if (HasAutoCompleteQuery)
if (ServerGlobalBizSettings.Cache.SearchCaseSensitiveOnly)
sWhere = $"(cast ({valueColumnName} as text) like '%{autoCompleteQuery}%')";
@@ -221,9 +214,9 @@ namespace AyaNova.PickList
sb.Append(", ");
//nope, this will return null if any of the values are null, very bad for this use, instead
//select name || ' ' || serial || ' ' || array_to_string(tags,',') as display from awidget
//select name || ' ' || serial || ' ' || array_to_string(tags,',') as display from acustomer
//this, on the other hand will work even if all of them are null
//concat_ws(' ', awidget.name, awidget.serial, auser.name)
//concat_ws(' ', acustomer.name, acustomer.serial, auser.name)
sb.Append("concat_ws(' ', ");
foreach (string s in lSelect)
@@ -315,8 +308,8 @@ namespace AyaNova.PickList
return sb.ToString();
}
//"select awidget.id as plId || ' 'awidget.active as plActive || ' 'awidget.name || ' 'awidget.serial || ' 'auser.name as plname from awidget left join auser on (awidget.userid=auser.id)
//where awidget.active = true and ((awidget.name like '%on%') or (cast (awidget.serial as text) like '%on%') or (auser.name like '%on%')) order by awidget.name,awidget.serial,auser.name limit 100"
//"select acustomer.id as plId || ' 'acustomer.active as plActive || ' 'acustomer.name || ' 'acustomer.serial || ' 'auser.name as plname from acustomer left join auser on (acustomer.userid=auser.id)
//where acustomer.active = true and ((acustomer.name like '%on%') or (cast (acustomer.serial as text) like '%on%') or (auser.name like '%on%')) order by acustomer.name,acustomer.serial,auser.name limit 100"
}//eoc