fieldEq 支持类似 b.type 多表情况下的对应筛选

This commit is contained in:
cool 2023-10-14 12:59:46 +08:00
parent 34f86e4a85
commit d16a84b57b
3 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@cool-midway/core",
"version": "7.0.0-beta4",
"version": "7.0.0-beta5",
"description": "",
"main": "dist/index.js",
"typings": "index.d.ts",

View File

@ -1,6 +1,6 @@
{
"name": "@cool-midway/core",
"version": "7.0.0-beta4",
"version": "7.0.0-beta5",
"description": "",
"main": "index.js",
"typings": "index.d.ts",

View File

@ -458,8 +458,14 @@ export abstract class BaseService {
}
// 字段全匹配
if (!_.isEmpty(option.fieldEq)) {
for (const key of option.fieldEq) {
for (let key of option.fieldEq) {
const c = {};
// 如果key有包含.的情况下操作
if(typeof key === "string" && key.includes('.')){
const keys = key.split('.');
const lastKey = keys.pop();
key = {requestParam: lastKey, column: keys.join('.')};
}
// 单表字段无别名的情况下操作
if (typeof key === "string") {
if (query[key] || (query[key] == 0 && query[key] == "")) {