@GET @RequestMapping("/multiply/{names}") @Produces(MediaType.APPLICATION_JSON) public List<StockVo> getTwoStocks(@PathVariable("names") String names) { List<StockVo> array = new ArrayList<>(); if (names != null) { String[] stringLets = names.split(" "); for (int i = 0; i < stringLets.length; i++) { if (StringPatternAware.isStockCode(stringLets[i])) { array.add(stocksService.queryStock(stringLets[i])); } } } return array; }
@GET @RequestMapping("/{name}") @Produces(MediaType.APPLICATION_JSON) public StockVo getStock(@PathVariable("name") String name) { return stocksService.queryStock(name); }