public Result<DeliveryReceitpVo> selectByIdAndPassCount(Map<String, Object> params) {
//旅客总人数,是否配餐
int count = 0;
//头等/公务
int firstClassBusiness = 0;
//经济舱
int economyClass = 0;
//成人
int aults = 0;
//儿童
int child = 0;
//婴儿
int infant = 0;
//贵宾
int vipLevel = 0;
//特餐
int passMeal = 0;
//特服
int specialService = 0;
//免责
int disclaimer = 0;
//是否补偿
int compensate = 0;
//减客信息
int cutGuest = 0;
//查询交接旅客
List<DlrcDelvrecpPassenger> passenger = dlrcDelvrecpPassengerService.selectByMap(params);
//查询交接单
EntityWrapper<DlrcDeliveryReceitp> de = new EntityWrapper<DlrcDeliveryReceitp>();
String id = passenger.get(0).getDeliveryReceitpId();
de.eq("ID", id);
DlrcDeliveryReceitp ddr = dlrcDeliveryReceitpService.selectOne(de);
for (DlrcDelvrecpPassenger ddp : passenger) {
if(!"".equals(ddp.getId())){
count = passenger.size();
}
if(!"".equals(ddp.getPassCabin()) && "Y".equals(ddp.getPassCabin())){
economyClass += 1;
}else{
firstClassBusiness += 1;
}
if(!"".equals(ddp.getAdultChildInfant()) && "A".equals(ddp.getAdultChildInfant())){
aults += 1;
}else if(!"".equals(ddp.getAdultChildInfant()) && "C".equals(ddp.getAdultChildInfant())){
child += 1;
}else{
infant += 1;
}
//1:是 0:否
if(!"".equals(ddp.getVipLevel()) && "1".equals(ddp.getVipLevel())){
vipLevel += 1;
}
if(!"".equals(ddp.getMealType()) && "1".equals(ddp.getMealType())){
passMeal += 1;
}
if(!"".equals(ddp.getSpecialServiceType()) && "1".equals(ddp.getSpecialServiceType())){
specialService += 1;
}
if(!"".equals(ddp.getDisclaimerType()) && "1".equals(ddp.getDisclaimerType())){
disclaimer += 1;
}
if(!"".equals(ddp.getCompensateType()) && "1".equals(ddp.getCompensateType())){
compensate += 1;
}
if(!"".equals(ddp.getCutOffCause())){
cutGuest += 1;
}
}
//根据查询和统计出来的数据,放入要返回的实体类中
DeliveryReceitpVo drv = new DeliveryReceitpVo();
drv.setFlightDate(ddr.getFlightDate());
drv.setFlightNo(ddr.getFlightNo());
drv.setAircraftNo(ddr.getAircraftNo());
drv.setDepartureAirport(ddr.getDepartureAirport());
drv.setArrivalAirport(ddr.getArrivalAirport());
drv.setStartBoardTime(ddr.getStartBoardTime());
drv.setEndBoardTime(ddr.getEndBoardTime());
drv.setPassTotal(count);
drv.setFirstClassBusiness(firstClassBusiness);
drv.setEconomyClass(economyClass);
drv.setAults(aults);
drv.setChild(child);
drv.setInfant(infant);
drv.setVipLevel(vipLevel);
drv.setPassMeal(passMeal);
drv.setSpecialService(specialService);
drv.setDisclaimer(disclaimer);
drv.setIsMeal(count);
drv.setCompensate(compensate);
drv.setCutGuest(cutGuest);
//查询旅客信息
EntityWrapper<DlrcDelvrecpPassenger> ewd = new EntityWrapper<DlrcDelvrecpPassenger>();
List<DlrcDelvrecpPassenger> list = dlrcDelvrecpPassengerService.selectList(ewd);
drv.setPassenger(list);
return new Result<DeliveryReceitpVo>(drv);
}
关于用两张表的数据,查询出一张表的部分所必需字段数据,统计出另外一张表所需的各个字段总数。
最新推荐文章于 2022-07-21 14:32:52 发布