@Override public List<ShoppingCartVo> getShoppingCartForApi( String accountId, String address, Integer skip, int num) { StringBuffer hqlSb = new StringBuffer("o.accountId=? "); Object[] params; if (StringUtils.isNotBlank(address)) { hqlSb.append("and (o.sellerInfo.sellerAddress like ? or o.sellerInfo.locationName like ?)"); params = new Object[] {accountId, "%" + address.trim() + "%", "%" + address.trim() + "%"}; } else { params = new Object[] {accountId}; } LinkedHashMap<String, String> order = new LinkedHashMap<>(); order.put("createTime", "desc"); QueryResult<ShoppingCart> queryResult = shoppingCartDAO.getScrollData( ShoppingCart.class, skip, num, hqlSb.toString(), params, order); if (queryResult == null || queryResult.getList() == null || queryResult.getList().isEmpty()) { return null; } return formatShoppingCartVo(queryResult.getList()); }
@Override @Transactional(propagation = Propagation.NOT_SUPPORTED) public QueryResult<TradeRecord> getTradeRecords(String accountId, int skip, int num) { QueryResult<UserTradeRecord> userTradeRecordResult = userTradeRecordDAO.getTradeRecords(accountId, skip, num); QueryResult<TradeRecord> tradeRecordResult = new QueryResult<TradeRecord>(); tradeRecordResult.setTotalRecord(userTradeRecordResult.getTotalRecord()); List<TradeRecord> list = new ArrayList<TradeRecord>(); for (UserTradeRecord userTradeRecord : userTradeRecordResult.getList()) { list.add(userTradeRecord.getTradeRecord()); } tradeRecordResult.setList(list); return tradeRecordResult; }