|
|
@RequestMapping("/getRecordMsg")
|
|
|
public PageResult getRecordMsg(HttpServletRequest request){
|
|
|
Integer pageNum=1; //默认页码为1
|
|
|
Integer pageSize=20;// 默认每页大小为20
|
|
|
Integer dormBuildId=0; // 默认宿舍楼ID为0
|
|
|
String filter=request.getParameter("filter"); // 获取过滤条件
|
|
|
String key=request.getParameter("key"); // 获取关键字
|
|
|
if(request.getParameter("pageNum")!=null && request.getParameter("pageNum")!="") // 解析并设置pageNum参数
|
|
|
{
|
|
|
pageNum=Integer.parseInt(request.getParameter("pageNum"));
|
|
|
}
|
|
|
if(request.getParameter("pageSize")!=null && request.getParameter("pageSize")!="") // 解析并设置pageSize参数
|
|
|
{
|
|
|
pageSize=Integer.parseInt(request.getParameter("pageSize"));
|
|
|
}
|
|
|
if(request.getParameter("dormBuildId")!=null && request.getParameter("dormBuildId")!="") // 解析并设置dormBuildId参数
|
|
|
{
|
|
|
dormBuildId=Integer.parseInt(request.getParameter("dormBuildId"));
|
|
|
}
|
|
|
System.out.println("pageNum="+pageNum);
|
|
|
System.out.println("pageSize="+pageSize);
|
|
|
return dormManageServiceImpl.getRecordMsg(pageNum, pageSize, filter, key, dormBuildId); // 调用dormManageServiceImpl的getRecordMsg方法,并返回结果
|
|
|
}
|
|
|
|
|
|
@RequestMapping("getRecordById")// 调用dormManageServiceImpl的getRecordById方法,并返回结果
|
|
|
public Record getRecordById(Integer recordId) {
|
|
|
return dormManageServiceImpl.getRecordById(recordId);
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping("updataRecordMsg")
|
|
|
public Result updataRecordMsg(@RequestBody Record record) {
|
|
|
try {
|
|
|
dormManageServiceImpl.updataRecordMsg(record);
|
|
|
return new Result(true, "更新成功");
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
e.printStackTrace();
|
|
|
return new Result(false, "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping("addRecordMsg")
|
|
|
public Result addRecordMsg(@RequestBody Record record) {
|
|
|
try {
|
|
|
System.out.println(record);
|
|
|
dormManageServiceImpl.addRecordMsg(record);
|
|
|
return new Result(true, "添加成功");
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
e.printStackTrace();
|
|
|
return new Result(false, "添加失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@RequestMapping("recordManagerDeleteById1")
|
|
|
public Result recordManagerDeleteById(HttpServletRequest request) {
|
|
|
Integer recordId=0;
|
|
|
if(request.getParameter("recordId")!=null && request.getParameter("recordId")!="") {
|
|
|
recordId=Integer.parseInt(request.getParameter("recordId"));
|
|
|
}
|
|
|
try {
|
|
|
dormManageServiceImpl.recordManagerDeleteById1(recordId);
|
|
|
return new Result(true, "删除成功");
|
|
|
} catch (Exception e) {
|
|
|
// TODO: handle exception
|
|
|
e.printStackTrace();
|
|
|
return new Result(false, "删除失败");
|
|
|
}
|
|
|
}
|
|
|
|