|
@@ -1,16 +1,21 @@
|
|
|
package com.persagy.dmp.rwd.digital.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.persagy.dmp.common.constant.ValidEnum;
|
|
|
+import com.persagy.dmp.define.entity.RelationDefine;
|
|
|
import com.persagy.dmp.rwd.basic.utils.DigitalMessageHelper;
|
|
|
import com.persagy.dmp.rwd.digital.dao.ObjectRelationMapper;
|
|
|
import com.persagy.dmp.rwd.digital.entity.ObjectRelation;
|
|
|
+import com.persagy.dmp.rwd.digital.iservice.ObjectRelationIService;
|
|
|
import com.persagy.dmp.rwd.digital.service.IObjectRelationService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@@ -26,7 +31,14 @@ public class ObjectRelationServiceImpl implements IObjectRelationService {
|
|
|
private ObjectRelationMapper dao;
|
|
|
@Autowired
|
|
|
private DigitalMessageHelper messageSender;
|
|
|
+ @Autowired
|
|
|
+ private ObjectRelationIService iService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询对象关系数据
|
|
|
+ * @param queryWrapper 查询条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public List<ObjectRelation> queryByCondition(Wrapper<ObjectRelation> queryWrapper) {
|
|
|
return dao.selectList(queryWrapper);
|
|
@@ -37,18 +49,49 @@ public class ObjectRelationServiceImpl implements IObjectRelationService {
|
|
|
return dao.selectPage(page, queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 新增关系数据
|
|
|
+ * @param voList 待新增数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public List<ObjectRelation> insert(List<ObjectRelation> voList) {
|
|
|
- return null;
|
|
|
+ iService.saveOrUpdateBatch(voList);
|
|
|
+ return voList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改关系数据
|
|
|
+ * @param voList 修改条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
public List<ObjectRelation> update(List<ObjectRelation> voList) {
|
|
|
- return null;
|
|
|
+ iService.saveOrUpdateBatch(voList);
|
|
|
+ return voList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除关系数据
|
|
|
+ * @param wrapper 删除条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@Override
|
|
|
- public void delete(List<String> idList) {
|
|
|
-
|
|
|
+ public List<ObjectRelation> delete(QueryWrapper wrapper) {
|
|
|
+ //根据条件查询有效关系数据
|
|
|
+ wrapper.eq("valid",ValidEnum.TRUE.getType());
|
|
|
+ List<ObjectRelation> list = dao.selectList(wrapper);
|
|
|
+ if(list == null || list.size()<=0){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ //批量删除关系数据
|
|
|
+ for (ObjectRelation relation : list) {
|
|
|
+ relation.setValid(ValidEnum.FALSE.getType());
|
|
|
+ }
|
|
|
+ iService.saveOrUpdateBatch(list);
|
|
|
+ return list;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|