📄 hetongaction.jsp
字号:
<!--ACTION 动作控制JSP--><%@ page contentType="text/html; charset=GBK"%><%@ page import="cn.com.juneng.system.common.BaseForm" %><%@ page import="cn.com.juneng.system.common.COMMON" %><%@ page import="cn.com.juneng.system.common.util.ValueObjectHelper" %><%@ page import="cn.com.juneng.hetong.service.HetongService" %><%@ page import="cn.com.juneng.hetong.vo.HetongVOImpl" %><%@ page import="cn.com.juneng.system.common.SpringBeanFactory" %><%@ page import="java.util.List" %><%@ include file="/common/inc/CommonAction.jsp"%><%! private HetongService hetongService = (HetongService)SpringBeanFactory.getBean("hetongService"); private String jspPath = "/hetong/"; private String actionJsp = jspPath+"HetongAction.jsp"; private String listJsp = jspPath+"List.jsp"; private String editJsp = jspPath+"Edit.jsp"; private String showAllJsp = jspPath+"ShowAll.jsp"; //列表 public void list(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { //根据传入参数构造查询条件语句 String querySql = COMMON.getQuerySql(request); String orderSql = null; //排序 if(!COMMON.isEmpty(bForm.getOrderCol())){ orderSql = "order by "+bForm.getOrderCol()+" "+bForm.getOrder(); } List list = hetongService.getList(querySql,orderSql,bForm.getStartPos(),bForm.getRowCount()); bForm.setTotalCount(hetongService.getRowCount(querySql)); request.setAttribute("List",list); request.setAttribute("BaseForm",bForm); pageForward(listJsp,request,response); } //初始化编辑页面 public void init(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; vo.setActionType("create"); request.setAttribute("VO", vo); pageForward(editJsp,request,response); } //创建 public void create(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; try{ hetongService.create(vo); request.setAttribute("Message","成功创建!"); pageForward(actionJsp,request,response); }catch(Exception e){ request.setAttribute("Error","创建失败:"+e.getMessage()); request.setAttribute("VO",vo); pageForward(editJsp,request,response); } } //查看 public void view(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; vo = (HetongVOImpl)hetongService.findByPrimaryKey(vo.getRid()); vo.setCurrentPage(bForm.getCurrentPage()); vo.setActionType("save"); request.setAttribute("VO", vo); pageForward(editJsp,request,response); } //保存 public void save(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; try{ hetongService.update(vo); request.setAttribute("Message","成功保存!"); pageForward(actionJsp+"?currentPage="+vo.getCurrentPage(),request,response); }catch(Exception e){ request.setAttribute("Error","保存失败:"+e.getMessage()); request.setAttribute("VO",vo); pageForward(editJsp,request,response); } } //删除 public void delete(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { String[] ids = request.getParameterValues("Ids"); hetongService.remove(ids); request.setAttribute("Message","成功删除!"); pageForward(actionJsp+"?currentPage="+bForm.getCurrentPage(),request,response); } //复合页面初始化编辑页面 public void complexInit(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; vo.setActionType("createBinfo"); request.setAttribute("VO", vo); pageForward(editJsp,request,response); } //从职工信息创建 public void createBinfo(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; try{ hetongService.create(vo); request.setAttribute("info","成功保存!"); //vo = (HetongVOImpl)hetongService.findByPrimaryKey(vo.getRid()); vo.setActionType("saveBinfo"); request.setAttribute("VO", vo); pageForward(editJsp,request,response); }catch(Exception e){ request.setAttribute("Error","创建失败:"+e.getMessage()); request.setAttribute("VO",vo); pageForward(editJsp,request,response); } } //从职工信息编辑 public void edit(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; String hql=" zgid='"+vo.getZgid()+"' "; List list = this.hetongService.getList(hql,"order by startdate desc ",0,Integer.MAX_VALUE); if(COMMON.isEmpty(list)){ vo.setActionType("createBinfo"); }else{ if(vo.getRid()==null){ vo = (HetongVOImpl)list.get(0); }else{ //获取特定历史记录 vo = (HetongVOImpl)COMMON.getObjectFromList(list,"rid eq \""+vo.getRid()+"\""); } vo.setActionType("saveBinfo"); } request.setAttribute("VO", vo); pageForward(editJsp,request,response); } //从职工信息保存 public void saveBinfo(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; try{ hetongService.update(vo); request.setAttribute("info","成功保存!"); //vo = (HetongVOImpl)hetongService.findByPrimaryKey(vo.getRid()); vo.setActionType("saveBinfo"); request.setAttribute("VO", vo); pageForward(editJsp,request,response); }catch(Exception e){ e.printStackTrace(System.out); request.setAttribute("Error","保存失败:"+e.getMessage()); request.setAttribute("VO",vo); pageForward(editJsp,request,response); } } //复合页面删除 public void complexdelete(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = null; String[] ids = request.getParameterValues("Ids"); hetongService.remove(ids); request.setAttribute("Info","成功删除!"); String gzid=request.getParameter("rid"); String gzxm=request.getParameter("gzxm"); String hql=" zgid='"+gzid+"' "; List list = this.hetongService.getList(hql,"order by startdate desc ",0,Integer.MAX_VALUE); if(COMMON.isEmpty(list)){ vo=new HetongVOImpl(); vo.setZgid(gzid); vo.setZgname(gzxm); }else vo=(HetongVOImpl)list.get(0); request.setAttribute("VO",vo); request.setAttribute("List",list); pageForward(showAllJsp,request,response); } //从职工信息编辑 public void showAll(HttpServletRequest request,HttpServletResponse response,BaseForm bForm) throws Exception { HetongVOImpl vo = (HetongVOImpl)bForm; String hql=" zgid='"+vo.getZgid()+"' "; List list = this.hetongService.getList(hql,"order by startdate desc ",0,Integer.MAX_VALUE); request.setAttribute("VO",vo); request.setAttribute("List",list); pageForward(showAllJsp,request,response); }%><% request.setAttribute("ActionUrl",request.getContextPath()+actionJsp); HetongVOImpl vo = new HetongVOImpl(); ValueObjectHelper.fillObjectBean(vo, request); this.processRequest(request, response,vo);%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -