|
@@ -111,16 +111,16 @@ public class StructurePatentServiceImpl extends ServiceImpl<AssoStructurePatentM
|
|
|
wrapper.eq(AssoStructurePatent::getProjectId, projectId);
|
|
|
List<AssoStructurePatent> oldAssoStructurePatents = this.list(wrapper);
|
|
|
if (oldAssoStructurePatents != null && oldAssoStructurePatents.size() > 0) {
|
|
|
- //遍历查询出来的所有数据,将id改为Null
|
|
|
+ //遍历查询出来的所有数据,将id改为Null(为了集合去重,两个集合的所有属性都相同才能去重)
|
|
|
for (AssoStructurePatent assoStructurePatent2 : oldAssoStructurePatents) {
|
|
|
assoStructurePatent2.setId(null);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//集合去重,去重后留下来的数据即为新增的标引就可以直接入库了
|
|
|
- boolean flag = newAssoStructurePatents.removeAll(oldAssoStructurePatents);
|
|
|
+ newAssoStructurePatents.removeAll(oldAssoStructurePatents);
|
|
|
//若有新增的标引则入库
|
|
|
- if (flag) {
|
|
|
+ if (newAssoStructurePatents.size() > 0) {
|
|
|
//数据批量插入架构和专利关联表
|
|
|
log.info("数据批量插入架构和专利关联表");
|
|
|
this.saveBatch(newAssoStructurePatents);
|