Bootstrap

SpringBoot+SqlServer查询接口(回顾)

 @RequestMapping(value = "/getScmmByDateAndStaId")
   public Result getScmmByDateAndStaId(String times, String staId) {
       List<SurfChnMulMin> scmmList = scmmService.getScmmByDateAndStaId(times, staId);
       String[] arr = new String[]{"pre", "tem", "rhu", "win"};
       SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
       Map<String, Object> map1 = new HashMap<>();
       for (int j = 0; j < arr.length; j++) {
           List<Map<String, String>> listmap = new ArrayList<>();
           for (int i = 0; i < scmmList.size(); i++) {
               Map<String, String> map = new HashMap<>();
               map.put("datetime", simpleDateFormat.format(scmmList.get(i).getDatetime()));
               if (arr[j].equals("pre")) {
                   map.put(arr[j], toStr(scmmList.get(i).getPre()));
               } else if (arr[j].equals("tem")) {
                   map.put(arr[j], scmmList.get(i).getTem() + "");
               } else if (arr[j].equals("rhu")) {
                   map.put(arr[j], scmmList.get(i).getRhu() + "");
               } else if (arr[j].equals("win")) {
                   map.put("win_D", scmmList.get(i).getWinDAvg2mi() + "");
                   map.put("win-S", scmmList.get(i).getWinSAvg2mi() + "");
               }
               listmap.add(map);
           }
           map1.put(arr[j], listmap);
       }
       return Result.ok(map1);
   }
;