Просмотр исходного кода

添加关系主对象和从对象不能重复

caiaf 4 лет назад
Родитель
Сommit
235c50b109

+ 8 - 0
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/ManualRelationAddService.kt

@@ -899,6 +899,14 @@ class ManualRelationAddService {
             logger.debug("空间类型 = ${relZoneSpaceList.toJson()}")
             val relZoneSpace = relZoneSpaceList[0]
             for (fromContent in relationAddRequest.fromContent!!){
+                if(relationAddRequest.mainContent!! == fromContent){
+                    /** 主对象和从对象不能重复 */
+                    sCreateResponse.result = SResponseType.failure
+                    sCreateResponse.message = fromContent+":主对象和从对象不能重复"
+                    sCreateResponse.errorType = "2"
+                    return sCreateResponse
+                }
+
                 /** 去除主对象空间id */
                 val relZoneToSpaceList = relZoneSpaceService.select(
                     SFilter.eq("projectId", projectId), SFilter.eq(relationAddRequest.type!!, fromContent!!),