体测导入修改
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
package com.srs.common.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -29,37 +26,41 @@ public class listFunc {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<String> subList(List<String> actualList, List<String> expectList){
|
||||
List<String> list1 = actualList.stream().map(String::new).collect(Collectors.toList());
|
||||
List<String> list2 = expectList.stream().map(String::new).collect(Collectors.toList());
|
||||
/**
|
||||
* 获取需要添加的元素(在list1中存在但在list2中不存在的元素)
|
||||
* @param list1 待导入的列表
|
||||
* @param list2 已存在的列表
|
||||
* @return 需要添加的元素列表
|
||||
*/
|
||||
public static List<String> subList(List<String> list1, List<String> list2) {
|
||||
List<String> result = new ArrayList<>();
|
||||
Set<String> set2 = new HashSet<>(list2); // 使用HashSet提高查找效率
|
||||
|
||||
if(list2.size() == 0){
|
||||
return list1;
|
||||
}
|
||||
if(list1.containsAll(list2) && list2.containsAll(list1)){
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
List<String> temp = list1.stream()
|
||||
.filter(x->list2.contains(x)).collect(Collectors.toList());
|
||||
list1.removeAll(temp);
|
||||
return list1;
|
||||
for (String item : list1) {
|
||||
if (!set2.contains(item)) {
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 两个列表的交集
|
||||
* @author zhy
|
||||
* @date 2023-08-18 09:59:34
|
||||
* @param list1
|
||||
* @param list2
|
||||
* @return
|
||||
**/
|
||||
public static List<String> intersectList(List<String> list1, List<String> list2){
|
||||
Map<String, String> tempMap = list2.parallelStream().collect(Collectors.toMap(Function.identity(), Function.identity(), (oldData, newData) -> newData));
|
||||
return list1.parallelStream().filter(str->{
|
||||
return tempMap.containsKey(str);
|
||||
}).collect(Collectors.toList());
|
||||
* 获取需要修改的元素(两个列表中都存在的元素)
|
||||
* @param list1 待导入的列表
|
||||
* @param list2 已存在的列表
|
||||
* @return 需要修改的元素列表
|
||||
*/
|
||||
public static List<String> intersectList(List<String> list1, List<String> list2) {
|
||||
List<String> result = new ArrayList<>();
|
||||
Set<String> set2 = new HashSet<>(list2); // 使用HashSet提高查找效率
|
||||
|
||||
for (String item : list1) {
|
||||
if (set2.contains(item)) {
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.srs.common.annotation.Excel;
|
||||
import com.srs.common.core.domain.AjaxResult;
|
||||
import com.srs.common.core.domain.BaseEntity;
|
||||
@@ -38,7 +39,7 @@ import static org.apache.commons.lang3.SystemUtils.getUserName;
|
||||
* @date 2023-06-28
|
||||
*/
|
||||
@Service
|
||||
public class SrsSportTestServiceImpl implements ISrsSportTestService
|
||||
public class SrsSportTestServiceImpl extends ServiceImpl<SrsSportTestMapper,SrsSportTest> implements ISrsSportTestService
|
||||
{
|
||||
@Autowired
|
||||
private SrsSportTestMapper srsSportTestMapper;
|
||||
@@ -274,10 +275,12 @@ public class SrsSportTestServiceImpl implements ISrsSportTestService
|
||||
}
|
||||
//修改体能测试
|
||||
if (needUpdateQuery.size() != 0) {
|
||||
//单条
|
||||
for (SrsSportTest srsSportTest:needUpdateQuery){
|
||||
srsSportTestMapper.updateSrsSportTest(srsSportTest);
|
||||
}
|
||||
this.updateBatchById(needUpdateQuery);
|
||||
// //单条
|
||||
// for (SrsSportTest srsSportTest:needUpdateQuery){
|
||||
//
|
||||
// srsSportTestMapper.updateSrsSportTest(srsSportTest);
|
||||
// }
|
||||
//切片批量
|
||||
// int userListSize=needUpdateQuery.size();
|
||||
// int sum=userListSize/1000;
|
||||
|
Reference in New Issue
Block a user