示例#1
0
 @RequestMapping(value = "/api/courseSession/{sid}", method = RequestMethod.GET)
 public @ResponseBody HashMap<String, Object> courseSession(@PathVariable("sid") int sid) {
   HashMap<String, Object> h = new HashMap<String, Object>();
   try {
     CourseSession cs = csService.getCourseSession(sid);
     h.put("code", 0);
     h.put("data", cs);
   } catch (Exception e) {
     logger.info(e.toString());
     h.put("code", 2);
     h.put("msg", "操作中发生异常!");
   }
   return h;
 }
示例#2
0
 @RequestMapping(value = "/api/courseSession/lecturerName/{sid}", method = RequestMethod.GET)
 public @ResponseBody HashMap<String, Object> sessionLecturerName(@PathVariable("sid") int sid) {
   HashMap<String, Object> h = new HashMap<String, Object>();
   try {
     String name = csService.getLecturerNameBySID(sid);
     h.put("code", 0);
     h.put("data", name);
   } catch (Exception e) {
     logger.info(e.toString());
     h.put("code", 2);
     h.put("msg", "操作中发生异常!");
   }
   return h;
 }
示例#3
0
 @RequestMapping(
     value = "/api/courseSession/querySession/{start}/{limit}",
     method = RequestMethod.GET)
 public @ResponseBody HashMap<String, Object> courseSessionQuery(
     HttpServletRequest req, @PathVariable("start") int start, @PathVariable("limit") int limit) {
   HashMap<String, Object> h = new HashMap<String, Object>();
   Integer uid = Integer.parseInt((String) req.getAttribute("uid"));
   String sname = req.getParameter("sname");
   if (sname != null && !sname.isEmpty())
     try {
       sname = new String(sname.getBytes("ISO8859-1"), "utf-8");
     } catch (Exception e) {
       sname = "";
     }
   logger.debug("search string:" + sname);
   try {
     User u = uService.getUserById(uid);
     if (u == null) throw new Exception();
     List<CourseSession> l = null;
     int sz = 0;
     if (u.getPriv() != 0) {
       l = csService.queryCourseSessionEx(sname, start, limit);
       sz = csService.countCourseSessionEx(sname);
     } else {
       l = csService.queryCourseSession(uid, sname, start, limit);
       sz = csService.countCourseSessionByUID(uid, sname);
     }
     h.put("data", l);
     h.put("count", sz);
     h.put("code", 0);
   } catch (Exception e) {
     logger.info(e.toString());
     h.put("code", 1);
     h.put("msg", "操作中发生异常!");
   }
   return h;
 }
示例#4
0
 @RequestMapping(value = "/api/courseSession/priv/{sid}", method = RequestMethod.GET)
 public @ResponseBody HashMap<String, Object> courseSessionPriv(
     HttpServletRequest req, @PathVariable("sid") int sid) {
   HashMap<String, Object> h = new HashMap<String, Object>();
   int uid = Integer.parseInt((String) req.getAttribute("uid"));
   try {
     h.put("code", 0);
     h.put("lecturer", csService.islecturer(uid, sid));
   } catch (Exception e) {
     logger.info(e.toString());
     h.put("code", 2);
     h.put("msg", "操作中发生异常!");
   }
   return h;
 }
示例#5
0
 @RequestMapping(value = "/api/courseSession/query", method = RequestMethod.GET)
 public @ResponseBody HashMap<String, Object> courseSession(HttpServletRequest req) {
   HashMap<String, Object> h = new HashMap<String, Object>();
   int uid = Integer.parseInt((String) req.getAttribute("uid"));
   try {
     List<CourseSession> l = csService.getCourseSessionByUID(uid);
     h.put("code", 0);
     h.put("data", l);
     h.put("count", l.size());
   } catch (Exception e) {
     logger.info(e.toString());
     h.put("code", 2);
     h.put("msg", "操作中发生异常!");
   }
   return h;
 }