zoukankan      html  css  js  c++  java
  • 查询任务桌面失败

    出现一个问题:

    private List<Map<String, Object>> getBuIdByTask(Long userId, Integer clientShow) throws Exception {
            int complete_status = TaskCenterDefinedCode.OPERATION_STATUS.COMPLETE.getNumberCode().intValue();
            // 默认手机端 0,1
            List<Long> cardTypeUkids = getActionUkidsForTaskTags(clientShow, null);
            TsOperationDOExample tsOperationDOExample = new TsOperationDOExample();
            List<String> fields = new ArrayList<>(1);
            fields.add("owner_id");
          //  fields.add("operation_ukid");  //新加入 ①
            tsOperationDOExample.setCustomFields(fields);
            tsOperationDOExample.createCriteria().andStatusLessThan(complete_status)
                    .andOpUserIdEqualTo(userId)
                    .andOperationUnitUkidIn(cardTypeUkids);
            List<TsOperation> tsOperations = tsOperationManager.selectByExample(tsOperationDOExample);
            List<Map<String, Object>> buMaps = new ArrayList<>();
            Set<Long> buIdSets = tsOperations.stream().map(TsOperation::getOwnerId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toSet()); //这里报错②
            List<CmBusinessUnitInfo> businessUnits = cmBusinessUnitsService.getBusinessUnitInfoByBuIds(buIdSets);
            for (CmBusinessUnitInfo cmBusinessUnitInfo : businessUnits) {
                if (cmBusinessUnitInfo == null) {
                    continue;
                }
                Map<String, Object> bu = new HashMap<>(2);
                bu.put("buId", cmBusinessUnitInfo.getBusinessUnitId());
                bu.put("buName", cmBusinessUnitInfo.getBusinessUnitName());
                buMaps.add(bu);
            }
            return buMaps;
        }

    如果不新加入 ① fields.add("operation_ukid");

    Set<Long> buIdSets = tsOperations.stream().map(TsOperation::getOwnerId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toSet()); //这里报错②

    经过查找,
    tsOperationManager.selectByExample(tsOperationDOExample); 只会返回owner_id这个字段,并且使用
    TsOperation返回。当owner_id为null时,TsOperation会为null。
    所以这里把主键也返回,就不会返回null对象了。
  • 相关阅读:
    P1067 多项式输出(模拟水题)
    A. The Fair Nut and Elevator(暴力)
    A. The Fair Nut and Elevator(暴力)
    Knight Tournament (set)
    jquery怎么添加多个类名
    jquery对类的操作,添加,删除,点击添加,再点击删除
    jquery操作css样式的方法
    jquery浅复制和深复制区别
    TS 三种函数的定义方式
    ES7及ES8新特性
  • 原文地址:https://www.cnblogs.com/xingxing0521/p/10451652.html
Copyright © 2011-2022 走看看