From f020a2a4d3617ee01ffd44392dff56fe44a10c66 Mon Sep 17 00:00:00 2001 From: wjh Date: Wed, 14 Aug 2024 12:57:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9B=B4=E5=8F=91?= =?UTF-8?q?=E5=8D=95=E7=94=9F=E6=88=90=E7=A7=9F=E8=B5=81=E5=8D=95=E6=97=B6?= =?UTF-8?q?=E7=BB=B4=E4=BF=AE=E8=B5=94=E5=81=BF=E6=95=B0=E6=8D=AE=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=9B=B4=E6=96=B0=20(#1459)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1459 Reviewed-by: sealday Co-authored-by: wjh Co-committed-by: wjh --- .../src/server/services/record-service.ts | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts index 2c9a07060..9d93358d2 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts @@ -45,16 +45,14 @@ export class RecordService { records.map((item) => item.id), transaction, ); - // 删除新建时创建的订单 - await this.db.sequelize.query( - ` - delete from records - where records.direct_record_id = ${model.id} - `, - { - transaction, + await this.db.getRepository('records').destroy({ + filter: { + direct_record_id: { + $eq: model.id, + }, }, - ); + transaction, + }); const numbers = deleteDatas.map((item) => item.number); await this._createRecord(model, values, transaction, context, numbers); } @@ -392,6 +390,9 @@ export class RecordService { purchaseData['number'] = numbers[0]; } purchaseData.items.forEach((element) => { + element.fee_items?.forEach((feeItem) => { + delete feeItem.id; + }); delete element.record_id; delete element.id; }); @@ -411,6 +412,9 @@ export class RecordService { leaseData['number'] = numbers[1]; } leaseData.items.forEach((element) => { + element.fee_items?.forEach((feeItem) => { + delete feeItem.id; + }); delete element.record_id; delete element.id; }); @@ -448,6 +452,9 @@ export class RecordService { leaseInData['number'] = numbers[0]; } leaseInData.items.forEach((element) => { + element.fee_items?.forEach((feeItem) => { + delete feeItem.id; + }); delete element.record_id; delete element.id; }); @@ -467,6 +474,9 @@ export class RecordService { leaseOutData['number'] = numbers[1]; } leaseOutData.items.forEach((element) => { + element.fee_items?.forEach((feeItem) => { + delete feeItem.id; + }); delete element.record_id; delete element.id; });