From d79a79a132e35152ca32f964208b4c0b7a9d414e Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 13 Sep 2023 11:29:58 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=88=A0=E9=99=A4=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E5=88=A0=E9=99=A4=E5=85=B3=E8=81=94=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/publishedGi.go | 4 +++- service/trainManage.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/service/publishedGi.go b/service/publishedGi.go index a6026d2..81e579c 100644 --- a/service/publishedGi.go +++ b/service/publishedGi.go @@ -95,8 +95,10 @@ func PublishFormDraft(req *publishedGi.PublishReqDto, user *model.User) { } func DeletePublishedGiById(id int) { - dbquery.PublishedGi.Debug().Where(dbquery.PublishedGi.ID.Eq(int32(id))).UpdateColumn(dbquery.PublishedGi.Status, 0) + mid := int32(id) + dbquery.PublishedGi.Debug().Where(dbquery.PublishedGi.ID.Eq(mid)).UpdateColumn(dbquery.PublishedGi.Status, 0) memory.DeleteMapVerifyStructure(int32(id)) // 移除内存中的发布信息 + dbquery.ProjectPublishLink.Where(dbquery.ProjectPublishLink.Mid.In(mid)).Delete() } func SaveAsDraftingFromPublish(id int32, user *model.User, name string) { diff --git a/service/trainManage.go b/service/trainManage.go index 3e5ea4e..bba3f3b 100644 --- a/service/trainManage.go +++ b/service/trainManage.go @@ -163,7 +163,9 @@ func UpdateTrainSize(id int32, td *dto.TrainSizeDto) bool { // 删除列车尺寸 func DeleteTrainSizeById(id int) { - _, _ = dbquery.TrainSize.Debug().Where(dbquery.TrainSize.ID.Eq(int32(id))).Delete() + sid := int32(id) + _, _ = dbquery.TrainSize.Debug().Where(dbquery.TrainSize.ID.Eq(sid)).Delete() + dbquery.ProjectTrainSizeLink.Where(dbquery.ProjectTrainSizeLink.Sid.Eq(sid)).Delete() } func QueryProjectTrainSize(id int32) []*model.TrainSize {