📄 indexmenubean.java
字号:
package com.sxit.wap.indexmenu;
import java.sql.*;
import java.util.*;
import com.sxit.wap.common.*;
import com.sxit.wap.exception.*;
public class IndexMenuBean extends IndexMenuDao{
public static Collection getIndexMenu () throws SysException {
String sql = "SELECT I.*, M.IMG_URL FROM WAP_INDEX_MENU I, WAP_MENU_IMG M WHERE I.MENU_IMG = M.ID ORDER BY I.DISP_ORDER";
return queryBySql ( sql );
}
public static boolean isExists ( String menuName ) throws SysException {
int i = getRowCountBySql ( "SELECT COUNT(*) FROM " + tableName + " WHERE menu_Name = '" + menuName + "'" );
return ( i > 0 );
}
public static boolean isExists ( int id, String menuName ) throws SysException, UpdateException, AppException {
int i = getRowCountBySql ( "SELECT COUNT(*) FROM " + tableName + " WHERE menu_Name = '" + menuName +
"' and id <>" + id );
return ( i > 0 );
}
public static int getImageRowCountOfAll() throws SysException {
String sql = "SELECT count(*) FROM WAP_INDEX_MENU I, WAP_MENU_IMG M WHERE I.MENU_IMG = M.ID";
return getRowCountBySql(sql);
}
public static Collection queryImageAll(int beginRow, int endRow) throws SysException {
String sql = "SELECT I.*, M.IMG_URL FROM WAP_INDEX_MENU I, WAP_MENU_IMG M WHERE I.MENU_IMG = M.ID order by disp_order ";
return queryBySql(sql, beginRow, endRow);
}
public static void changeDispOrder ( int id, int count ) throws SysException, FinderException,Exception {
//如果count为-1则上移动,为1下移动
IndexMenuModel model1 = findByPK ( id );
int dispOrder = model1.getDispOrder();
java.util.Collection collection = null;
String sql = "";
if (count ==-1) {
sql = "SELECT * FROM WAP_INDEX_MENU where disp_order < " +dispOrder+" order by disp_order desc";
collection = queryBySql(sql, 1, 1);
if (collection.size() ==0 )
return;
}else {
sql = "SELECT * FROM WAP_INDEX_MENU where disp_order > " +dispOrder+" order by disp_order ";
collection = queryBySql(sql, 1, 1);
if (collection.size() ==0 )
return;
}
Hashtable element = (Hashtable) collection.iterator().next();
IndexMenuModel model2 = IndexMenuBean.toModel(element);
model1.setDispOrder(model2.getDispOrder());
model2.setDispOrder(dispOrder);
model1 = update(model1);
model2 = update(model2);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -