【发布地图时修改原有的关联信息】
This commit is contained in:
parent
20dd4e942f
commit
232d1cd0f4
|
@ -57,10 +57,13 @@ func PublishFormDraft(req *publishedGi.PublishReqDto, user *model.User) {
|
|||
}
|
||||
//需要删除的同名数据
|
||||
oldData, _ := dbquery.PublishedGi.Debug().Where(dbquery.PublishedGi.Name.Eq(req.Name)).Find()
|
||||
if len(oldData) > 0 {
|
||||
oldDataLen := len(oldData)
|
||||
mids := make([]int32, oldDataLen)
|
||||
if oldDataLen > 0 {
|
||||
// 逻辑删除
|
||||
dbquery.PublishedGi.Debug().Where(dbquery.PublishedGi.Name.Eq(req.Name)).UpdateColumn(dbquery.PublishedGi.Status, 0)
|
||||
for _, v := range oldData {
|
||||
for i, v := range oldData {
|
||||
mids[i] = v.ID
|
||||
memory.DeleteMapVerifyStructure(v.ID) // 移除内存中的发布信息
|
||||
}
|
||||
}
|
||||
|
@ -81,6 +84,10 @@ func PublishFormDraft(req *publishedGi.PublishReqDto, user *model.User) {
|
|||
newData, _ := dbquery.PublishedGi.
|
||||
Where(dbquery.PublishedGi.Name.Eq(req.Name), dbquery.PublishedGi.Status.Eq(1)).
|
||||
Order(dbquery.PublishedGi.PublishAt.Desc()).First()
|
||||
// 对项目关联的地图进行修改
|
||||
if oldDataLen > 0 {
|
||||
dbquery.ProjectPublishLink.Where(dbquery.ProjectPublishLink.Mid.In(mids...)).UpdateColumn(dbquery.ProjectPublishLink.Mid, newData.ID)
|
||||
}
|
||||
// 地图信息更新到缓存
|
||||
if newData != nil {
|
||||
memory.PublishMapVerifyStructure(newData)
|
||||
|
|
Loading…
Reference in New Issue