if("add".equals(method)){
int postId=Integer.parseInt(request.getParameter("postId"));
int userId=Integer.parseInt(request.getParameter("userId"));
String createTime=request.getParameter("createTime");
if(new TbPostUserMiddleDAO().add(new TbPostUserMiddle(postId,userId,createTime))){
request.getSession().setAttribute("result", "添加成功");
}else{
request.getSession().setAttribute("result", "添加失败");
}
request.getSession(true).setAttribute("tbPostUserMiddleList",new TbPostUserMiddleDAO().getTbPostUserMiddleAll());
response.sendRedirect("PostusermiddleModule/TbPostUserMiddleList.jsp");
}
if("del".equals(method)){
if(UtilDAO.delin("Tb_PostUserMiddle", "PostUserMiddleId", request.getParameter("delIds"))){
request.getSession().setAttribute("result", "删除成功");
}else{
request.getSession().setAttribute("result", "删除失败");
}
request.getSession(true).setAttribute("tbPostUserMiddleList",new TbPostUserMiddleDAO().getTbPostUserMiddleAll());
response.sendRedirect("PostusermiddleModule/TbPostUserMiddleList.jsp");
}
if("edit".equals(method)){
int postUserMiddleId=Integer.parseInt(request.getParameter("postUserMiddleId"));
int postId=Integer.parseInt(request.getParameter("postId"));
int userId=Integer.parseInt(request.getParameter("userId"));
String createTime=request.getParameter("createTime");
if(new TbPostUserMiddleDAO().add(new TbPostUserMiddle(postUserMiddleId,postId,userId,createTime))){
request.getSession().setAttribute("result", "修改成功");
}else{
request.getSession().setAttribute("result", "修改失败");
}
request.getSession(true).setAttribute("tbPostUserMiddleList",new TbPostUserMiddleDAO().getTbPostUserMiddleAll());