diff --git a/core/package.json b/core/package.json index 9c3bd50..f1aedff 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "@cool-midway/core", - "version": "7.0.4", + "version": "7.0.6", "description": "", "main": "dist/index.js", "typings": "index.d.ts", diff --git a/core/src/package.json b/core/src/package.json index 4dcf6f2..1f94dfa 100644 --- a/core/src/package.json +++ b/core/src/package.json @@ -1,6 +1,6 @@ { "name": "@cool-midway/core", - "version": "7.0.4", + "version": "7.0.6", "description": "", "main": "index.js", "typings": "index.d.ts", diff --git a/core/src/service/base.ts b/core/src/service/base.ts index 2affdef..d6befcc 100644 --- a/core/src/service/base.ts +++ b/core/src/service/base.ts @@ -340,6 +340,13 @@ export abstract class BaseService { } else{ const upsert = this._coolConfig.crud?.upsert || 'normal'; if (type == 'update') { + if(upsert == 'save') { + const info = await this.entity.findOneBy({id: param.id}) + param = { + ...info, + ...param + } + } param.updateTime = new Date(); upsert == 'normal'? await this.entity.update(param.id, param): await this.entity.save(param); }