|
@@ -162,6 +162,39 @@ public class RelationCaclServiceImpl implements RelationCaclService {
|
|
|
addRelations.addAll(updateRelations);
|
|
|
return ResultHelper.multi(addRelations,addRelations.size());
|
|
|
}
|
|
|
+
|
|
|
+ /***
|
|
|
+ * Description: 根据fromId,toId,relType,graphCode删除关系
|
|
|
+ * @param objectRelation : 请求参数
|
|
|
+ * @return : com.persagy.dmp.common.model.response.CommonResult<java.util.List<com.persagy.dmp.digital.entity.ObjectRelation>>
|
|
|
+ * @author : lijie
|
|
|
+ * @date :2021/9/2 20:20
|
|
|
+ * Update By lijie 2021/9/2 20:20
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public CommonResult<List<ObjectRelation>> deleteObjRelationsByRelId(ObjectRelation objectRelation) {
|
|
|
+ // 1.先查询关系
|
|
|
+ LambdaQueryWrapper<ObjectRelation> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(ObjectRelation::getGraphCode,objectRelation.getGraphCode());
|
|
|
+ queryWrapper.eq(ObjectRelation::getRelCode,objectRelation.getRelCode());
|
|
|
+ queryWrapper.eq(ObjectRelation::getObjFrom,objectRelation.getObjFrom());
|
|
|
+ queryWrapper.eq(ObjectRelation::getObjTo,objectRelation.getObjTo());
|
|
|
+ queryWrapper.eq(ObjectRelation::getValid,true);
|
|
|
+ List<ObjectRelation> objectRelations = objectRelationService.list(queryWrapper);
|
|
|
+ if (CollUtil.isEmpty(objectRelations)){
|
|
|
+ throw new BusinessException(BusinessErrorRwdCode.A7201.getCode(),BusinessErrorRwdCode.A7201.getDesc());
|
|
|
+ }
|
|
|
+ // 2.先更新计算时间
|
|
|
+ // 3.删除关系
|
|
|
+ for (ObjectRelation relation : objectRelations) {
|
|
|
+ relation.setValid(0);
|
|
|
+ relation.setModifier(AppContext.getContext().getAccountId());
|
|
|
+ relation.setUpdateApp(AppContext.getContext().getAppId());
|
|
|
+ }
|
|
|
+ objectRelationService.updateBatchById(objectRelations);
|
|
|
+ return ResultHelper.multi(objectRelations,objectRelations.size());
|
|
|
+ }
|
|
|
+
|
|
|
/***
|
|
|
* Description: 根据fromId和toIds查询关系
|
|
|
* @param fromId : fromId
|