package com.newvideo.controller.admin.api; import java.io.PrintWriter; import java.util.List; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.newvideo.domain.DetailSystem; import com.newvideo.domain.VideoInfo; import com.newvideo.service.imp.SystemService; import com.newvideo.service.imp.VideoService; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @Controller @RequestMapping("admin/new/api/common") public class CommonController { @Resource private VideoService videoService; @Resource private SystemService systemService; @RequestMapping(value = "/searchvideo", method = RequestMethod.POST) public void searchVideo(String key, PrintWriter out) { List list = videoService.searchVideoUsedByAdmin(key); JSONArray array = new JSONArray(); if (list != null) for (VideoInfo info : list) { JSONObject obj = new JSONObject(); obj.put("id", info.getId()); obj.put("name", info.getName()); obj.put("picture", info.getPicture()); obj.put("show", info.getShow()); array.add(obj); } JSONObject object = new JSONObject(); object.put("code", 0); object.put("data", array); out.print(object); } @RequestMapping(value = "/detailsystemlist", method = RequestMethod.POST) public void detailSystemList(String key, PrintWriter out) { List list = systemService.getDetailSystemList(); JSONArray array = new JSONArray(); if (list != null) for (DetailSystem system : list) { JSONObject obj = new JSONObject(); obj.put("id", system.getId()); obj.put("name", system.getAppName()); obj.put("platform", system.getPlatform()); array.add(obj); } JSONObject object = new JSONObject(); object.put("code", 0); object.put("data", array); out.print(object); } }