fix space search bug
parent
19232ff1b6
commit
6a6081635d
|
|
@ -17,6 +17,9 @@ export function getLotNameWhereClause(lotName = '', lotNameSearchType, lotsTable
|
|||
default: {
|
||||
const lotNamePieces = lotName.toLowerCase().split(' ');
|
||||
for (const lotNamePiece of lotNamePieces) {
|
||||
if (lotNamePiece === '') {
|
||||
continue;
|
||||
}
|
||||
sqlWhereClause +=
|
||||
' and instr(lower(' + lotsTableAlias + '.lotName), ?)';
|
||||
sqlParameters.push(lotNamePiece);
|
||||
|
|
@ -70,6 +73,9 @@ export function getOccupantNameWhereClause(occupantName = '', tableAlias = 'o')
|
|||
if (occupantName !== '') {
|
||||
const occupantNamePieces = occupantName.toLowerCase().split(' ');
|
||||
for (const occupantNamePiece of occupantNamePieces) {
|
||||
if (occupantNamePiece === '') {
|
||||
continue;
|
||||
}
|
||||
sqlWhereClause += ` and instr(lower(${tableAlias}.occupantName), ?)`;
|
||||
sqlParameters.push(occupantNamePiece);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ export function getLotNameWhereClause(
|
|||
default: {
|
||||
const lotNamePieces = lotName.toLowerCase().split(' ')
|
||||
for (const lotNamePiece of lotNamePieces) {
|
||||
if (lotNamePiece === '') {
|
||||
continue
|
||||
}
|
||||
|
||||
sqlWhereClause +=
|
||||
' and instr(lower(' + lotsTableAlias + '.lotName), ?)'
|
||||
sqlParameters.push(lotNamePiece)
|
||||
|
|
@ -100,6 +104,10 @@ export function getOccupantNameWhereClause(
|
|||
if (occupantName !== '') {
|
||||
const occupantNamePieces = occupantName.toLowerCase().split(' ')
|
||||
for (const occupantNamePiece of occupantNamePieces) {
|
||||
if (occupantNamePiece === '') {
|
||||
continue
|
||||
}
|
||||
|
||||
sqlWhereClause += ` and instr(lower(${tableAlias}.occupantName), ?)`
|
||||
sqlParameters.push(occupantNamePiece)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,12 @@ export async function getPastLotOccupancyOccupants(filters, options) {
|
|||
const database = await acquireConnection();
|
||||
let sqlWhereClause = ' where o.recordDelete_timeMillis is null and l.recordDelete_timeMillis is null';
|
||||
const sqlParameters = [];
|
||||
if (filters.searchFilter) {
|
||||
if (filters.searchFilter !== '') {
|
||||
const searchFilterPieces = filters.searchFilter.split(' ');
|
||||
for (const searchFilterPiece of searchFilterPieces) {
|
||||
if (searchFilterPiece === '') {
|
||||
continue;
|
||||
}
|
||||
sqlWhereClause +=
|
||||
" and (o.occupantName like '%' || ? || '%'" +
|
||||
" or o.occupantAddress1 like '%' || ? || '%'" +
|
||||
|
|
|
|||
|
|
@ -21,10 +21,14 @@ export async function getPastLotOccupancyOccupants(
|
|||
|
||||
const sqlParameters: unknown[] = []
|
||||
|
||||
if (filters.searchFilter) {
|
||||
if (filters.searchFilter !== '') {
|
||||
const searchFilterPieces = filters.searchFilter.split(' ')
|
||||
|
||||
for (const searchFilterPiece of searchFilterPieces) {
|
||||
if (searchFilterPiece === '') {
|
||||
continue
|
||||
}
|
||||
|
||||
sqlWhereClause +=
|
||||
" and (o.occupantName like '%' || ? || '%'" +
|
||||
" or o.occupantAddress1 like '%' || ? || '%'" +
|
||||
|
|
|
|||
Loading…
Reference in New Issue