Ejemplo n.º 1
0
  /**
   * 创建产品目录树
   *
   * @param orderprods
   * @return
   */
  public List<ProdDictDto> queryProdTree(List<PProd> orderprods) throws Exception {
    if (orderprods != null && orderprods.size() > 0) {
      String[] prodIds = new String[orderprods.size()];
      for (int i = 0; i < orderprods.size(); i++) {
        prodIds[i] = orderprods.get(i).getProd_id();
      }

      Map<String, PProd> prodMap = CollectionHelper.converToMapSingle(orderprods, "prod_id");
      List<ProdDictDto> prodList =
          pDictProdDao.queryProdDict(prodIds, getOptr().getArea_id(), getOptr().getCounty_id());

      for (ProdDictDto p : prodList) {
        p.setPProd(prodMap.get(p.getNode_id()));

        // 设置产品的ID:自身ID+父节点ID
        if (p.getPProd() != null) {
          p.setNode_id(p.getNode_pid() + "," + p.getNode_id());
        }
      }
      return prodList;
    }
    return new ArrayList<ProdDictDto>();
  }
Ejemplo n.º 2
0
 /**
  * 创建产品目录树
  *
  * @param userType
  * @return
  * @throws Exception
  */
 public List<ProdDictDto> queryProdTree(String userType) throws Exception {
   List<ProdDictDto> prodList = pDictProdDao.queryAll(userType, getOptr().getArea_id());
   return prodList;
 }