2 次代碼提交 8b143c863c ... af84c88f11

作者 SHA1 備註 提交日期
  yaoll af84c88f11 Merge remote-tracking branch 'origin/master' 4 年之前
  yaoll 7a1e1766ed 删除对象时同时删除关系,物理删除!! 4 年之前
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      dmp-rwd/src/main/java/com/persagy/dmp/rwd/service/ObjectInstanceDeleteService.java

+ 4 - 0
dmp-rwd/src/main/java/com/persagy/dmp/rwd/service/ObjectInstanceDeleteService.java

@@ -5,6 +5,7 @@ import com.persagy.dmp.config.DmpParameterStorage;
 import com.persagy.dmp.rwd.config.RwdConstants;
 import com.persagy.dmp.rwd.entity.ObjectInstance;
 import com.persagy.dmp.rwd.entity.QObjectInstance;
+import com.persagy.dmp.rwd.entity.QRelationInstance;
 import com.persagy.dmp.rwd.model.DmpMessage;
 import org.springframework.stereotype.Service;
 
@@ -33,6 +34,7 @@ public class ObjectInstanceDeleteService extends BaseService {
 		}
 
 		QObjectInstance qt = QObjectInstance.objectInstance;
+		QRelationInstance rqt = QRelationInstance.relationInstance;
 		for (String id : idList) {
 			Optional<ObjectInstance> one = objectInstanceRepository.findOne(qt.id.eq(id)
 					.and(qt.groupCode.eq(DmpParameterStorage.getGroupCode()))
@@ -49,6 +51,8 @@ public class ObjectInstanceDeleteService extends BaseService {
 				entityManager.clear();
 
 				// TODO 关系处理
+				jpaQueryFactory.delete(rqt).where(rqt.objFrom.eq(entity.getId())).execute();
+				jpaQueryFactory.delete(rqt).where(rqt.objTo.eq(entity.getId())).execute();
 
 				// 消息通知
 				DmpMessage message = new DmpMessage(RwdConstants.MESSAGE_INSTANCE_OBJECT_DELETE, id);