diff --git a/src/main/java/com/zky/manager/MenuManageServlet.java b/src/main/java/com/zky/manager/MenuManageServlet.java index 05f155f..15e71b0 100644 --- a/src/main/java/com/zky/manager/MenuManageServlet.java +++ b/src/main/java/com/zky/manager/MenuManageServlet.java @@ -32,9 +32,10 @@ public class MenuManageServlet extends DispatchServlet String companyid = request.getParameter("companyidQ"); String areaid = request.getParameter("areaidQ"); String menuitem = request.getParameter("menuitemQ"); + System.out.println(menuitem); if ((menuitem != null) && (!(menuitem.equals("")))) { - sql.append(" and menuitem=").append(menuitemname).append("'"); + sql.append(" and menuitem=").append(menuitemname).append(""); } else { if ((menuitemname != null) && (!(menuitemname.equals("")))) { sql.append(" and menuitemname like '%").append(menuitemname).append("%'"); @@ -62,6 +63,30 @@ public class MenuManageServlet extends DispatchServlet } } + + public void queryMenu1(HttpServletRequest request, HttpServletResponse response) throws Exception { + StringBuffer sql = new StringBuffer("select distinct frameworkid,menuitem,menuitemname from tab_menuitem where 1=1"); + String menuitemname = request.getParameter("menuitemnameQ"); + String companyid = request.getParameter("companyidQ"); + String areaid = request.getParameter("areaidQ"); + String menuitem = request.getParameter("menuitemQ"); + + Connection conn = null; + try { + conn = DbConn.getConn(); + //HashFmlBuf buf = (HashFmlBuf)JDBCUtils.query(conn, sql.toString(),new HashFmlBufResultSetHandler()); + PageQuery pageQuery = new PageQuery(conn,sql.toString(),new HashFmlBufResultSetHandler(),request); + HashFmlBuf buf=(HashFmlBuf)pageQuery.query(20); + request.setAttribute("menu_buf", buf); + request.getRequestDispatcher("/manage/MenuManage.jsp").forward(request, response); + } catch (SQLException e) { + throw e; + } finally { + JDBCUtils.close(conn); + } + } + + public void deleteMenu(HttpServletRequest request, HttpServletResponse response) throws Exception { String companyid = request.getParameter("companyid"); String menuitem = request.getParameter("menuitem"); @@ -101,7 +126,7 @@ public class MenuManageServlet extends DispatchServlet public void getMenuTree(HttpServletRequest request, HttpServletResponse response) throws Exception { String companyid = request.getParameter("companyid"); String menuitem = request.getParameter("menuitem"); - String sql = "select a.frameworkid,a.menuitem,a.menuitemname,a.menuid,a.menuname,a.menulevel,a.uplevel,decode(b.web_workobject,null,'0','1') as type from tab_menuitem a,tab_funcmodu b where a.menuid=b.funcmoducode(+) and a.frameworkid = ? and a.menuitem =? order by type,a.menuid"; + String sql = "select a.frameworkid,a.menuitem,a.menuitemname,a.menuid,a.menuname,a.menulevel,a.uplevel ,(CASE WHEN b.web_workobject IS NULL THEN '0' ELSE '1' END) as type from tab_menuitem a,tab_funcmodu b where a.menuid=b.funcmoducode and a.frameworkid = ? and a.menuitem =? order by type , a.menuid"; Connection conn = null; try { conn = DbConn.getConn(); @@ -280,6 +305,38 @@ public class MenuManageServlet extends DispatchServlet } } + + + public void editTree(HttpServletRequest request, HttpServletResponse response) throws Exception { + ManagerServlet ms=new ManagerServlet(); + String menuitem=request.getParameter("menuitem"); + String companyid=request.getParameter("companyid"); + + MenuTree tree = (MenuTree)request.getSession().getAttribute("menu_tree"); + if (tree == null) + throw new Exception("提示!"); + String menuitemname = request.getParameter("menuitemname"); + tree.setTreeName(menuitemname); + Connection conn = null; + try { + conn = DbConn.getConn(); + conn.setAutoCommit(false); + JDBCUtils.update(conn, "delete from tab_menuitem where menuitem=? and frameworkid=?", + tree.getTreeId(), tree.getCompanyId()); + MenuTreeUtils.saveTree(conn, tree); + //oracle数据库手动提交,mysql中 自动提交autoCommit(); + conn.commit(); + queryMenu1(request, response); + } catch (SQLException e) { + if (conn != null) + conn.rollback(); + throw e; + } finally { + JDBCUtils.close(conn); + } + } + + public void defaultMethod(HttpServletRequest request, HttpServletResponse response) throws Exception { } } \ No newline at end of file diff --git a/src/main/java/com/zky/manager/MenuTreeUtils.java b/src/main/java/com/zky/manager/MenuTreeUtils.java index 4f793e6..79e406b 100644 --- a/src/main/java/com/zky/manager/MenuTreeUtils.java +++ b/src/main/java/com/zky/manager/MenuTreeUtils.java @@ -76,7 +76,6 @@ public class MenuTreeUtils { public static void saveTree(Connection conn, MenuTree tree) throws SQLException { BatchParam param = new BatchParam(); - System.out.println(); for (int i=0; i @@ -84,7 +84,7 @@ function saveMenu() { } form1.button1.disabled=true; form1.button2.disabled=true; - form1.operate.value="saveTree"; + form1.operate.value="editTree"; form1.submit(); } @@ -368,4 +368,4 @@ function selectChange(i){ form1.submit(); } - \ No newline at end of file + \ No newline at end of file diff --git a/web/manage/MenuManage.jsp b/web/manage/MenuManage.jsp index 2eb0ffd..11cbadd 100644 --- a/web/manage/MenuManage.jsp +++ b/web/manage/MenuManage.jsp @@ -9,19 +9,22 @@ String menuitemname = Common.convertNull(request.getParameter("menuitemnameQ")); String companyid = Common.convertNull(request.getParameter("companyidQ")); String areaid=Common.convertNull(request.getParameter("areaidQ")); + String disabled=""; %> 菜单管理 - - + +