public int getGoodsTypeListWithAttrCount( List<GoodsType> resultSet, int firstRow, int maxRow, Criteria criteria) { try { List<GoodsType> res = SpringUtil.getGoodsTypeManager().getGoodsTypeList(firstRow, maxRow, criteria); for (GoodsType gt : res) { Long gtid = gt.getId(); Criteria c2 = new Criteria(); Condition cond = new Condition(); cond.setField(GOODSTYPE); cond.setOperator(Condition.EQUALS); cond.setValue(gtid); c2.addCondition(cond); int attcount = SpringUtil.getAttributeManager().getAttributeCount(c2); gt.setAttrCount(attcount); } resultSet.addAll(res); return SpringUtil.getGoodsTypeManager().getGoodsTypeCount(criteria); } catch (Exception ex) { ex.printStackTrace(); throw new RuntimeException(ex); } }
public void getShippingAreaWithRegionName(List<ShippingArea> resultSet, Long shippingId) { try { Criteria criteria = new Criteria(); criteria.addCondition(new Condition(IShippingArea.SHIPPING, Condition.EQUALS, shippingId)); List<ShippingArea> list = SpringUtil.getShippingAreaManager().getShippingAreaList(criteria); // for(ShippingArea sa:list) { // String saId = sa.getId(); // Criteria c2 = new Criteria(); // Condition cond = new Condition(); // cond.setField(IAreaRegion.SHIPPING_AREA); // cond.setOperator(Condition.EQUALS); // cond.setValue(saId); // c2.addCondition(cond); // // List<AreaRegion> ars = SpringUtil.getAreaRegionManager().getAreaRegionList(c2); // sa.setRegions(new HashSet<AreaRegion>(ars)); // } resultSet.addAll(list); } catch (Exception ex) { ex.printStackTrace(); throw new RuntimeException(ex); } }