From d16a84b57b8daed725b125bc7f2f80af06df9365 Mon Sep 17 00:00:00 2001 From: cool Date: Sat, 14 Oct 2023 12:59:46 +0800 Subject: [PATCH] =?UTF-8?q?fieldEq=20=E6=94=AF=E6=8C=81=E7=B1=BB=E4=BC=BC?= =?UTF-8?q?=20b.type=20=E5=A4=9A=E8=A1=A8=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E5=AF=B9=E5=BA=94=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/package.json | 2 +- core/src/package.json | 2 +- core/src/service/base.ts | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/package.json b/core/package.json index 7c343e5..f482e6e 100644 --- a/core/package.json +++ b/core/package.json @@ -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", diff --git a/core/src/package.json b/core/src/package.json index 4be5e58..fde4506 100644 --- a/core/src/package.json +++ b/core/src/package.json @@ -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", diff --git a/core/src/service/base.ts b/core/src/service/base.ts index 950b012..b517197 100644 --- a/core/src/service/base.ts +++ b/core/src/service/base.ts @@ -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] == "")) {