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