use of com.hfut.entity.AjaxResult in project Workload by amoxu.
the class ExprimentController method removeLoad.
@RequestMapping(value = "/removeLocalExp", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String removeLoad(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]));
LocalExpWorkload workload;
workload = JSON.parseObject(String.valueOf(jsonObject), LocalExpWorkload.class);
if (expService.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 GraDesignController method removeLoad.
@RequestMapping(value = "/removeLocalGraDesign", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String removeLoad(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]));
LGraDesignWorkload workload;
workload = JSON.parseObject(String.valueOf(jsonObject), LGraDesignWorkload.class);
if (service.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 GraPracticeController method getLoadList.
@RequestMapping(value = "/LGPractice/{years}/{teacher}", produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String getLoadList(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<LGraPracticeWorkload> 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;
}
use of com.hfut.entity.AjaxResult in project Workload by amoxu.
the class GraPracticeController method removeLoad.
@RequestMapping(value = "/removeLocalPractice", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String removeLoad(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]));
LGraPracticeWorkload workload;
workload = JSON.parseObject(String.valueOf(jsonObject), LGraPracticeWorkload.class);
if (practiceService.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 NetCourseController method getLoadList.
@RequestMapping(value = "/LNet/{years}/{teacher}", produces = MediaType.APPLICATION_JSON_VALUE + ";charset=utf-8")
@ResponseBody
public String getLoadList(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<LNetWorkload> list = netService.getList(years, teacher, page, limit);
AjaxResult ajaxResult = new AjaxResult();
ajaxResult.setCount(netService.getCount(years, teacher));
ajaxResult.ok();
ajaxResult.setData(list);
String json = JSON.toJSONString(ajaxResult);
return json;
}
Aggregations