根据实体属性查找实体集合,替换更改元素,执行更新
//忽略结果表记录importExportDocumentCustomRiskCalcResultCustom riskCalcResultCustom = newRiskCalcResultCustom();riskCalcResultCustom.setCompanyId(Long.valueOf(String.valueOf(map.get("companyId"))));riskCalcResultCustom.setDocumentNo(importExportDocumentCustom.getEntryId());List riskCalcResultCustoms =
riskCalcResultMapper.selectList(newEntityWrapper<>(riskCalcResultCustom));riskCalcResultCustoms.stream().filter(bean -> {
bean.setRcrStatus(1);bean.setUpdateTime(this.logMapper.getCurrentDates());return true;}).collect(Collectors.toList());riskCalcResultMapper.updateListEntity(riskCalcResultCustoms);
替换元素部分:
import com.google.common.collect.Lists;
import java.util.List;
import java.util.stream.Collectors;
public class Test {
public static void main(String[] args) {
Bean bean1 = new Bean(1, 2);
Bean bean2 = new Bean(3, 4);
List list = Lists.newArrayList(bean1, bean2);
System.out.println("list1 : " + list);
list.stream().filter(bean -> {
if (1 == bean.getNum1())
bean.setNum1(2);
return true;
}).collect(Collectors.toList());
System.out.println("list2 : " + list);
}
}
list1 : [Bean(num1=1,num2=2.0),Bean(num1=3,num2=4.0)]
list2 : [Bean(num1=2,num2=2.0),Bean(num1=3,num2=4.0)]