@ -32,9 +32,10 @@ public class MenuManageServlet extends DispatchServlet
String companyid = request . getParameter ( "companyidQ" ) ;
String companyid = request . getParameter ( "companyidQ" ) ;
String areaid = request . getParameter ( "areaidQ" ) ;
String areaid = request . getParameter ( "areaidQ" ) ;
String menuitem = request . getParameter ( "menuitemQ" ) ;
String menuitem = request . getParameter ( "menuitemQ" ) ;
System . out . println ( menuitem ) ;
if ( ( menuitem ! = null ) & & ( ! ( menuitem . equals ( "" ) ) ) ) {
if ( ( menuitem ! = null ) & & ( ! ( menuitem . equals ( "" ) ) ) ) {
sql . append ( " and menuitem=" ) . append ( menuitemname ) . append ( " ' ") ;
sql . append ( " and menuitem=" ) . append ( menuitemname ) . append ( " ") ;
} else {
} else {
if ( ( menuitemname ! = null ) & & ( ! ( menuitemname . equals ( "" ) ) ) ) {
if ( ( menuitemname ! = null ) & & ( ! ( menuitemname . equals ( "" ) ) ) ) {
sql . append ( " and menuitemname like '%" ) . append ( menuitemname ) . append ( "%'" ) ;
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 {
public void deleteMenu ( HttpServletRequest request , HttpServletResponse response ) throws Exception {
String companyid = request . getParameter ( "companyid" ) ;
String companyid = request . getParameter ( "companyid" ) ;
String menuitem = request . getParameter ( "menuitem" ) ;
String menuitem = request . getParameter ( "menuitem" ) ;
@ -101,7 +126,7 @@ public class MenuManageServlet extends DispatchServlet
public void getMenuTree ( HttpServletRequest request , HttpServletResponse response ) throws Exception {
public void getMenuTree ( HttpServletRequest request , HttpServletResponse response ) throws Exception {
String companyid = request . getParameter ( "companyid" ) ;
String companyid = request . getParameter ( "companyid" ) ;
String menuitem = request . getParameter ( "menuitem" ) ;
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 ;
Connection conn = null ;
try {
try {
conn = DbConn . getConn ( ) ;
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 {
public void defaultMethod ( HttpServletRequest request , HttpServletResponse response ) throws Exception {
}
}
}
}