|
@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.sql.Timestamp;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -35,6 +36,8 @@ public class RecordController {
|
|
|
String idChannel = request.getParameter("idChannel");
|
|
|
String idDevice = request.getParameter("idDevice");
|
|
|
String idAudio = request.getParameter("idAudio");
|
|
|
+ String start = request.getParameter("start");
|
|
|
+ String end = request.getParameter("end");
|
|
|
String page = request.getParameter("page");
|
|
|
String size = request.getParameter("size");
|
|
|
if(page==null || page.length()<1)
|
|
@@ -50,14 +53,26 @@ public class RecordController {
|
|
|
List<Record> list = null;
|
|
|
if(idRecord!=null && idRecord.length()>0)
|
|
|
list = recordService.SearchById(Long.valueOf(idRecord));
|
|
|
- else if(idChannel!=null && idChannel.length()>0)
|
|
|
- pageRes = recordService.SearchByIdChannel(Long.valueOf(idChannel), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
- else if(idDevice!=null && idDevice.length()>0)
|
|
|
- pageRes = recordService.SearchByIdDevice(Long.valueOf(idDevice), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
- else if(idAudio!=null && idAudio.length()>0)
|
|
|
- pageRes = recordService.SearchByIdAudio(Long.valueOf(idAudio), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
- else
|
|
|
- pageRes = recordService.SearchAll(Integer.valueOf(page), Integer.valueOf(size));
|
|
|
+ else if((start==null || start.length()==0) && (end==null || end.length()==0)){
|
|
|
+ if(idChannel!=null && idChannel.length()>0)
|
|
|
+ pageRes = recordService.SearchByIdChannel(Long.valueOf(idChannel), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
+ else if(idDevice!=null && idDevice.length()>0)
|
|
|
+ pageRes = recordService.SearchByIdDevice(Long.valueOf(idDevice), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
+ else if(idAudio!=null && idAudio.length()>0)
|
|
|
+ pageRes = recordService.SearchByIdAudio(Long.valueOf(idAudio), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
+ else
|
|
|
+ pageRes = recordService.SearchAll(Integer.valueOf(page), Integer.valueOf(size));
|
|
|
+ }else{
|
|
|
+ if(idChannel!=null && idChannel.length()>0)
|
|
|
+ pageRes = recordService.SearchByIdChannelAndCreatedBetween(Long.valueOf(idChannel), Integer.valueOf(page), Integer.valueOf(size), Timestamp.valueOf(start), Timestamp.valueOf(end));
|
|
|
+ else if(idDevice!=null && idDevice.length()>0)
|
|
|
+ pageRes = recordService.SearchByIdDeviceAndCreatedBetween(Long.valueOf(idDevice), Integer.valueOf(page), Integer.valueOf(size), Timestamp.valueOf(start), Timestamp.valueOf(end));
|
|
|
+ else if(idAudio!=null && idAudio.length()>0)
|
|
|
+ pageRes = recordService.SearchByIdAudioAndCreatedBetween(Long.valueOf(idAudio), Integer.valueOf(page), Integer.valueOf(size), Timestamp.valueOf(start), Timestamp.valueOf(end));
|
|
|
+ else
|
|
|
+ pageRes = recordService.SearchCreatedBetween(Integer.valueOf(page), Integer.valueOf(size), Timestamp.valueOf(start), Timestamp.valueOf(end));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// if(list==null || list.size()<1){
|
|
|
// HttpUtil.responseApiCode(request, response, ApiCode.NOT_FOUND);
|