Controller层
@RequestMapping(value = "/queryTime", method = RequestMethod.POST)
public List<Pkg> sensorByTimeQuery(@RequestBody Map<String, Object> params) {
String sensorId = (String) params.get("sensorId");
String projectId = (String)params.get("projectId");
Long startTime = (Long)params.get("startTime");
Long endTime = (Long)params.get("endTime");
List<Pkg> pkgs = pkgService.queryTimePkgs(sensorId,projectId,startTime,endTime);
return pkgs;
Service层
方案一
@Override
public List<Pkg> queryTimePkgs(String sensorId,String projectId,long startTime,long endTime) {
// String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(startTime));
// String date1 = new SimpleDateForm