use of com.hfut.entity.AjaxResult in project Workload by amoxu.
the class MatchController method saveLoad.
@RequestMapping(value = "/saveLocalMatch", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String saveLoad(HttpServletRequest request) throws Exception {
Map<String, String[]> req = request.getParameterMap();
AjaxResult ajaxResult = new AjaxResult();
if (req.get("data") != null) {
JSONObject jsonObject = JSON.parseObject(String.valueOf(req.get("data")[0]));
LMatchWorkload workload;
workload = JSON.parseObject(String.valueOf(jsonObject), LMatchWorkload.class);
if (matchService.updateLoad(workload)) {
ajaxResult.ok();
ajaxResult.setMsg("保存成功");
} else {
ajaxResult.failed();
ajaxResult.setMsg("保存失败");
}
} else {
ajaxResult.failed();
ajaxResult.setMsg("参数错误");
}
return JSON.toJSONString(ajaxResult);
}
use of com.hfut.entity.AjaxResult in project Workload by amoxu.
the class TeachCourseController method getTeachLoadList.
@RequestMapping(value = "/LCourse/{years}/{teacher}", produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String getTeachLoadList(HttpServletRequest request, @PathVariable("years") Integer years, @PathVariable("teacher") String teacher) throws Exception {
String limitParam = request.getParameter("limit");
String pageParam = request.getParameter("page");
Integer page, limit;
if (limitParam == null) {
limit = 30;
} else {
limit = Integer.valueOf(limitParam);
}
if (pageParam == null) {
page = 0;
} else {
page = (Integer.valueOf(pageParam) - 1) * limit;
}
System.out.println(page + " " + limit);
List<LocalCourseWorkload> list = courseService.getList(years, teacher, page, limit);
AjaxResult ajaxResult = new AjaxResult();
ajaxResult.setCount(courseService.getCount(years, teacher));
ajaxResult.ok();
ajaxResult.setData(list);
String json = JSON.toJSONString(ajaxResult);
return json;
}
use of com.hfut.entity.AjaxResult in project Workload by amoxu.
the class TeachCourseController method saveRemote.
@RequestMapping(value = "/saveLocalCourse", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String saveRemote(HttpServletRequest request) throws Exception {
Map<String, String[]> req = request.getParameterMap();
AjaxResult ajaxResult = new AjaxResult();
if (req.get("data") != null) {
JSONObject jsonObject = JSON.parseObject(String.valueOf(req.get("data")[0]));
LocalCourseWorkload workload;
workload = JSON.parseObject(String.valueOf(jsonObject), LocalCourseWorkload.class);
if (courseService.updateLoad(workload)) {
ajaxResult.ok();
ajaxResult.setMsg("保存成功");
} else {
ajaxResult.failed();
ajaxResult.setMsg("保存失败");
}
} else {
ajaxResult.failed();
ajaxResult.setMsg("参数错误");
}
return JSON.toJSONString(ajaxResult);
}
use of com.hfut.entity.AjaxResult in project Workload by amoxu.
the class TeachCourseController method removeRemote.
@RequestMapping(value = "/removeLocalCourse", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String removeRemote(HttpServletRequest request) throws Exception {
Map<String, String[]> req = request.getParameterMap();
AjaxResult ajaxResult = new AjaxResult();
if (req.get("data") != null) {
JSONObject jsonObject = JSON.parseObject(String.valueOf(req.get("data")[0]));
LocalCourseWorkload workload;
workload = JSON.parseObject(String.valueOf(jsonObject), LocalCourseWorkload.class);
if (courseService.removeLoad(workload.getId())) {
ajaxResult.ok();
ajaxResult.setMsg("删除成功");
} else {
ajaxResult.failed();
ajaxResult.setMsg("删除失败");
}
} else {
ajaxResult.failed();
ajaxResult.setMsg("参数错误");
}
return JSON.toJSONString(ajaxResult);
}
use of com.hfut.entity.AjaxResult in project Workload by amoxu.
the class TeachPracticeController method getTeachLoadList.
@RequestMapping(value = "/LPractice/{years}/{teacher}", produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String getTeachLoadList(HttpServletRequest request, @PathVariable("years") Integer years, @PathVariable("teacher") String teacher) throws Exception {
String limitParam = request.getParameter("limit");
String pageParam = request.getParameter("page");
Integer page, limit;
if (limitParam == null) {
limit = 10;
} else {
limit = Integer.valueOf(limitParam);
}
if (pageParam == null) {
page = 0;
} else {
page = (Integer.valueOf(pageParam) - 1) * limit;
}
System.out.println(page + " " + limit);
List<LPracticeWorkload> list = practiceService.getList(years, teacher, page, limit);
AjaxResult ajaxResult = new AjaxResult();
ajaxResult.setCount(practiceService.getCount(years, teacher));
ajaxResult.ok();
ajaxResult.setData(list);
String json = JSON.toJSONString(ajaxResult);
return json;
}
Aggregations