我在编写下面的代码时遇到了一个问题,我想根据其中一个属性的布尔值过滤零件。但是当我试图写的时候,我犯了一个错误
在将其添加到数据库之前,我尝试检查的对象是esn的活动标志。但我得到编译错误。我做错了什么
我要过滤的对象是
unarchiveParts:::::[Part(partId=20001582, partNumber=2411M39P02, partDescription=BEARING, NO 3 BALL, esn=Esn(esnId=2233, name=892292, active=true, workOrder=WorkOrder(workOrderId=2313, number=000010149107, tenant=Tenant(tenantId=1, name=GE Aviation)), gate=Gate(gateId=1, name=Gate 0, active=true, tenant=Tenant(tenantId=1, name=GE Aviation)), model=Model(modelId=48, name=CFM56-7, label=CFM56-7, engineFamily=EngineFamily(engineFamilyId=13, name=CFM56, label=CFM56, site=com.ge.digital.oa.moa.domain.Site@75bb5a71, otrOffset=0, tenant=Tenant(tenantId=1, name=GE Aviation)), tenant=Tenant(tenantId=1, name=GE Aviation)), customer=com.ge.digital.oa.moa.domain.Customer@6c348019, isQpEngine=true, tenant=Tenant(tenantId=1, name=GE Aviation), workScope=WorkScope(workScopeId=0, name=Unknown, ooa_label=UNK), visitIndex=0), quantity=1/1, status=Status(statusId=0, name=N/A, tenant=Tenant(tenantId=1, name=GE Aviation)), materialStream=MaterialStream(materialStreamId=2, name=Used, tenant=Tenant(tenantId=1, name=GE Aviation)), source=Source(sourceId=24, name=Celma, tenant=Tenant(tenantId=1, name=GE Aviation)), oem=null, poNumber=N/A, manualCsoCommit=null, autoCsoCommit=null, drStatus=null, airwayBill=null, coreMaterial=true, active=true, tenant=Tenant(tenantId=1, name=GE Aviation), module=null, hpcStatus=null, actionUsers=[], shipOut=null, receipt=null, critShip=false, lateCall=false, exEsn=null, accumOffset=0, poLineNum=00000)]
我所写的,给出编译错误的是
public void unarchiveParts(final List<Integer> partIDs) {
List<Part> parts = partRepo.findAll((root, query, builder) -> root.get("partId").in(partIDs));
log.debug("unarchiveParts:::::"+ parts.toString());
parts.stream().filter(e -> e.getEsn().getActive() == Boolean.TRUE)
.forEach(p -> p.setActive(true));
partRepo.saveAll(parts);
}
1条答案
按热度按时间jum4pzuy1#
接口列表没有方法筛选器。我想你应该这么做: