| | |
| | | |
| | | private LambdaQueryWrapper<ZfEquipment> buildCondition(ZfEquipment zfEquipment,List<Long> familyIdList) { |
| | | LambdaQueryWrapper<ZfEquipment> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.orderByDesc(ZfEquipment::getCreateTime); |
| | | lqw.orderByDesc(ZfEquipment::getHappenTime); |
| | | lqw.like(StringUtils.isNotEmpty(zfEquipment.getName()), ZfEquipment::getName, zfEquipment.getName()); |
| | | lqw.like(StringUtils.isNotEmpty(zfEquipment.getBuyer()), ZfEquipment::getBuyer, zfEquipment.getBuyer()); |
| | | lqw.like(StringUtils.isNotEmpty(zfEquipment.getContent()), ZfEquipment::getContent, zfEquipment.getContent()); |
| | |
| | | fatherFaId = zInfoUserService.getInfoById(myself.getFatherId()).getFamilyId(); |
| | | Long motherFaId = 0L; |
| | | if(myself.getMomId()!=null) |
| | | motherFaId = zInfoUserService.getInfoBysysId(myself.getMomId()).getFamilyId(); |
| | | motherFaId = zInfoUserService.getInfoById(myself.getMomId()).getFamilyId(); |
| | | //也要查别人授权的 |
| | | List<ZAuthority> authority = zAuthorityService.getAuthority(); |
| | | List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EQUIPMENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList()); |
| | |
| | | //加上父母家族id |
| | | idList.add(fatherFaId); |
| | | idList.add(motherFaId); |
| | | |
| | | List<Long> fms = zInfoUserService.findByUaidToFaid(myself.getUaid()).stream().map(ZInfoUser::getFamilyId).collect(Collectors.toList()); |
| | | if(!fms.isEmpty()) |
| | | { |
| | | idList.addAll(fms); |
| | | } |
| | | LambdaQueryWrapper<ZfEquipment> lambdaQueryWrapper = buildCondition(zfEquipment, idList); |
| | | List<ZfEquipment> beanRecords = list(lambdaQueryWrapper); |
| | | log.info("从数据库中查到的为:{}", beanRecords); |
| | |
| | | public List<ZfEquipment> markOwnData(Long familyId,Long fatherFamilyId, Long motherFamilyId, List<ZfEquipment> beanRecords){ |
| | | return beanRecords.stream().peek( |
| | | bean -> { |
| | | if (bean.getFamilyId() == familyId ||(fatherFamilyId!=0L && fatherFamilyId==familyId)||(motherFamilyId!=0L && motherFamilyId==familyId)) { |
| | | if (Objects.equals(bean.getFamilyId(), familyId) ||(fatherFamilyId!=0L && fatherFamilyId.equals(familyId))||(motherFamilyId!=0L && motherFamilyId.equals(familyId))) { |
| | | bean.setOwnData(1); |
| | | } else { |
| | | bean.setOwnData(0); |
| | |
| | | //加上父母家族id |
| | | idList.add(fatherFaId); |
| | | idList.add(motherFaId); |
| | | |
| | | List<Long> fms = zInfoUserService.findByUaidToFaid(myself.getUaid()).stream().map(ZInfoUser::getFamilyId).collect(Collectors.toList()); |
| | | if(!fms.isEmpty()) |
| | | { |
| | | idList.addAll(fms); |
| | | } |
| | | // String familyIds = listFamilyIds(); |
| | | // String secondFamilyAuthority = listSecondFamilyIds(); |
| | | LambdaQueryWrapper<ZfEquipment> lqw = buildCondition(zfEquipment, idList); |