|
@@ -47,6 +47,8 @@ public class TrailController {
|
|
String idAdmin = request.getParameter("idAdmin");
|
|
String idAdmin = request.getParameter("idAdmin");
|
|
String target = request.getParameter("target");
|
|
String target = request.getParameter("target");
|
|
String idTarget = request.getParameter("idTarget");
|
|
String idTarget = request.getParameter("idTarget");
|
|
|
|
+ String start = request.getParameter("start");
|
|
|
|
+ String end = request.getParameter("end");
|
|
String page = request.getParameter("page");
|
|
String page = request.getParameter("page");
|
|
String size = request.getParameter("size");
|
|
String size = request.getParameter("size");
|
|
if(page==null || page.length()<1)
|
|
if(page==null || page.length()<1)
|
|
@@ -55,16 +57,28 @@ public class TrailController {
|
|
size = "0";
|
|
size = "0";
|
|
Map<String,Object> map = new HashMap<>();
|
|
Map<String,Object> map = new HashMap<>();
|
|
Page<Trail> pageRes = null;
|
|
Page<Trail> pageRes = null;
|
|
- if(idAdmin!=null && idAdmin.length()>0)
|
|
|
|
- pageRes = trailService.SearchByIdAdmin(Long.valueOf(idAdmin), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
|
- else if(target!=null && target.length()>0 && idTarget!=null && idTarget.length()>0)
|
|
|
|
|
|
+ if(target!=null && target.length()>0 && idTarget!=null && idTarget.length()>0)
|
|
pageRes = trailService.SearchByTargetAndIdTarget(target, Long.valueOf(idTarget), Integer.valueOf(page), Integer.valueOf(size));
|
|
pageRes = trailService.SearchByTargetAndIdTarget(target, Long.valueOf(idTarget), Integer.valueOf(page), Integer.valueOf(size));
|
|
- else if(target!=null && target.length()>0)
|
|
|
|
- pageRes = trailService.SearchByTarget(target, Integer.valueOf(page), Integer.valueOf(size));
|
|
|
|
- else if(idTarget!=null && idTarget.length()>0)
|
|
|
|
- pageRes = trailService.SearchByIdTarget(Long.valueOf(idTarget), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
|
- else
|
|
|
|
- pageRes = trailService.SearchAll(Integer.valueOf(page), Integer.valueOf(size));
|
|
|
|
|
|
+ else if((start==null || start.length()==0) || (end==null || end.length()==0)){
|
|
|
|
+ if(idAdmin!=null && idAdmin.length()>0)
|
|
|
|
+ pageRes = trailService.SearchByIdAdmin(Long.valueOf(idAdmin), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
|
+ else if(target!=null && target.length()>0)
|
|
|
|
+ pageRes = trailService.SearchByTarget(target, Integer.valueOf(page), Integer.valueOf(size));
|
|
|
|
+ else if(idTarget!=null && idTarget.length()>0)
|
|
|
|
+ pageRes = trailService.SearchByIdTarget(Long.valueOf(idTarget), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
|
+ else
|
|
|
|
+ pageRes = trailService.SearchAll(Integer.valueOf(page), Integer.valueOf(size));
|
|
|
|
+ }else {
|
|
|
|
+ if(idAdmin!=null && idAdmin.length()>0)
|
|
|
|
+ pageRes = trailService.SearchByIdAdminAndCreatedBetween(Long.valueOf(idAdmin), Integer.valueOf(page), Integer.valueOf(size), Timestamp.valueOf(start), Timestamp.valueOf(end));
|
|
|
|
+ else if(target!=null && target.length()>0)
|
|
|
|
+ pageRes = trailService.SearchByTargetAndCreatedBetween(target, Integer.valueOf(page), Integer.valueOf(size), Timestamp.valueOf(start), Timestamp.valueOf(end));
|
|
|
|
+ else if(idTarget!=null && idTarget.length()>0)
|
|
|
|
+ pageRes = trailService.SearchByIdTargetAndCreatedBetween(Long.valueOf(idTarget), Integer.valueOf(page), Integer.valueOf(size), Timestamp.valueOf(start), Timestamp.valueOf(end));
|
|
|
|
+ else
|
|
|
|
+ pageRes = trailService.SearchByCreatedBetween(Integer.valueOf(page), Integer.valueOf(size), Timestamp.valueOf(start), Timestamp.valueOf(end));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
if(pageRes!=null){
|
|
if(pageRes!=null){
|
|
map.put("data", pageRes.getContent());
|
|
map.put("data", pageRes.getContent());
|