|
@@ -1,6 +1,7 @@
|
|
|
package cn.efunbox.audio.controller;
|
|
|
|
|
|
import cn.efunbox.audio.clients.AudioHttp;
|
|
|
+import cn.efunbox.audio.consts.MediaType;
|
|
|
import cn.efunbox.audio.consts.Status;
|
|
|
import cn.efunbox.audio.entity.*;
|
|
|
import cn.efunbox.audio.service.*;
|
|
@@ -53,11 +54,14 @@ public class AudioController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/admsearch", method = RequestMethod.POST)
|
|
|
public void AdminSearch(HttpServletRequest request, HttpServletResponse response){
|
|
|
+ String mediaType = request.getParameter("mediaType");
|
|
|
String name = request.getParameter("name");
|
|
|
String album = request.getParameter("album");
|
|
|
String idGroup = request.getParameter("idGroup");
|
|
|
String page = request.getParameter("page");
|
|
|
String size = request.getParameter("size");
|
|
|
+ if(mediaType==null || mediaType.length()<1)
|
|
|
+ mediaType = "0";
|
|
|
if(page==null || page.length()<1)
|
|
|
page = "0";
|
|
|
if(size==null || size.length()<1)
|
|
@@ -66,18 +70,18 @@ public class AudioController {
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
List<Audio> list = null;
|
|
|
if(idGroup!=null && idGroup.length()>0){
|
|
|
- Page<Audio> pageRes = audioService.SearchByIdGroup(Long.valueOf(idGroup), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
+ Page<Audio> pageRes = audioService.SearchByIdGroup(Integer.valueOf(mediaType), Long.valueOf(idGroup), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
map.put("data", pageRes.getContent());
|
|
|
map.put("size", pageRes.getNumberOfElements());
|
|
|
map.put("total", pageRes.getTotalElements());
|
|
|
}else if(name!=null && name.length()>0 && album!=null && album.length()>0){
|
|
|
- list = audioService.SearchByNameAlbum(name, album);
|
|
|
+ list = audioService.SearchByNameAlbum(Integer.valueOf(mediaType), name, album);
|
|
|
}else if(name!=null && name.length()>0){
|
|
|
- list = audioService.SearchByName(name);
|
|
|
+ list = audioService.SearchByName(Integer.valueOf(mediaType), name);
|
|
|
}else if(album!=null && album.length()>0){
|
|
|
- list = audioService.SearchByAlbum(album);
|
|
|
+ list = audioService.SearchByAlbum(Integer.valueOf(mediaType), album);
|
|
|
}else{
|
|
|
- Page<Audio> pageRes = audioService.SearchAll(Integer.valueOf(page), Integer.valueOf(size));
|
|
|
+ Page<Audio> pageRes = audioService.SearchAll(Integer.valueOf(mediaType), Integer.valueOf(page), Integer.valueOf(size));
|
|
|
map.put("data", pageRes.getContent());
|
|
|
map.put("size", pageRes.getNumberOfElements());
|
|
|
map.put("total", pageRes.getTotalElements());
|
|
@@ -99,9 +103,12 @@ public class AudioController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/search", method = RequestMethod.POST)
|
|
|
public void Search(HttpServletRequest request, HttpServletResponse response){
|
|
|
+ String mediaType = request.getParameter("mediaType");
|
|
|
String id = request.getParameter("id");
|
|
|
String name = request.getParameter("name");
|
|
|
String album = request.getParameter("album");
|
|
|
+ if(mediaType==null || mediaType.length()<1)
|
|
|
+ mediaType = "0";
|
|
|
if(name==null && album==null){
|
|
|
HttpUtil.responseApiCode(request, response, ApiCode.PARAMETER_ERROR);
|
|
|
return;
|
|
@@ -111,11 +118,11 @@ public class AudioController {
|
|
|
List<Audio> list = null;
|
|
|
// System.out.println("album:"+album+",name:"+name);
|
|
|
if(name!=null && name.length()>0 && album!=null && album.length()>0)
|
|
|
- list = audioService.SearchByNameAlbum(name, album);
|
|
|
+ list = audioService.SearchByNameAlbum(Integer.valueOf(mediaType), name, album);
|
|
|
else if(name!=null && name.length()>0)
|
|
|
- list = audioService.SearchByName(name);
|
|
|
+ list = audioService.SearchByName(Integer.valueOf(mediaType), name);
|
|
|
else
|
|
|
- list = audioService.SearchByAlbum(album);
|
|
|
+ list = audioService.SearchByAlbum(Integer.valueOf(mediaType), album);
|
|
|
|
|
|
if(list==null || list.size()<1){
|
|
|
HttpUtil.responseApiCode(request, response, ApiCode.NOT_FOUND);
|