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 {