mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2025-12-11 05:42:49 +00:00
值为空不返回第一条
This commit is contained in:
parent
f0ab1a14e3
commit
4ccb08cb49
@ -2462,8 +2462,8 @@ export class SelectQueryBuilder extends QueryBuilder {
|
||||
else {
|
||||
let andConditions = [];
|
||||
for (let key in where) {
|
||||
if (where[key] === undefined || where[key] === null)
|
||||
continue;
|
||||
// if (where[key] === undefined || where[key] === null)
|
||||
// continue;
|
||||
const propertyPath = embedPrefix ? embedPrefix + "." + key : key;
|
||||
const column = metadata.findColumnWithPropertyPathStrict(propertyPath);
|
||||
const embed = metadata.findEmbeddedWithPropertyPath(propertyPath);
|
||||
@ -2518,7 +2518,11 @@ export class SelectQueryBuilder extends QueryBuilder {
|
||||
// const parameter = this.connection.driver.createParameter(parameterName, parameterIndex - 1);
|
||||
// andConditions.push(`${aliasPath} = ${parameter}`);
|
||||
// }
|
||||
andConditions.push(this.createWhereConditionExpression(this.getWherePredicateCondition(aliasPath, parameterValue)));
|
||||
if (parameterValue === undefined || parameterValue === null) {
|
||||
andConditions.push(`${aliasPath} IS NULL`);
|
||||
}else{
|
||||
andConditions.push(this.createWhereConditionExpression(this.getWherePredicateCondition(aliasPath, parameterValue)));
|
||||
}
|
||||
// this.conditions.push(`${alias}.${propertyPath} = :${paramName}`);
|
||||
// this.expressionMap.parameters[paramName] = where[key]; // todo: handle functions and other edge cases
|
||||
}
|
||||
|
||||
@ -2465,8 +2465,8 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
||||
else {
|
||||
let andConditions = [];
|
||||
for (let key in where) {
|
||||
if (where[key] === undefined || where[key] === null)
|
||||
continue;
|
||||
// if (where[key] === undefined || where[key] === null)
|
||||
// continue;
|
||||
const propertyPath = embedPrefix ? embedPrefix + "." + key : key;
|
||||
const column = metadata.findColumnWithPropertyPathStrict(propertyPath);
|
||||
const embed = metadata.findEmbeddedWithPropertyPath(propertyPath);
|
||||
@ -2490,6 +2490,11 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
||||
: (parameterValue =
|
||||
ApplyValueTransformers_1.ApplyValueTransformers.transformTo(column.transformer, parameterValue));
|
||||
}
|
||||
if (parameterValue === undefined || parameterValue === null) {
|
||||
andConditions.push(`${aliasPath} IS NULL`);
|
||||
}else{
|
||||
andConditions.push(this.createWhereConditionExpression(this.getWherePredicateCondition(aliasPath, parameterValue)));
|
||||
}
|
||||
// if (parameterValue === null) {
|
||||
// andConditions.push(`${aliasPath} IS NULL`);
|
||||
//
|
||||
@ -2521,7 +2526,7 @@ class SelectQueryBuilder extends QueryBuilder_1.QueryBuilder {
|
||||
// const parameter = this.connection.driver.createParameter(parameterName, parameterIndex - 1);
|
||||
// andConditions.push(`${aliasPath} = ${parameter}`);
|
||||
// }
|
||||
andConditions.push(this.createWhereConditionExpression(this.getWherePredicateCondition(aliasPath, parameterValue)));
|
||||
// andConditions.push(this.createWhereConditionExpression(this.getWherePredicateCondition(aliasPath, parameterValue)));
|
||||
// this.conditions.push(`${alias}.${propertyPath} = :${paramName}`);
|
||||
// this.expressionMap.parameters[paramName] = where[key]; // todo: handle functions and other edge cases
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user