📄 topbean.java
字号:
package com.sxit.wap.top;import java.sql.*;import java.util.*;import com.sxit.wap.common.*;import com.sxit.wap.exception.*;public class TopBean extends TopDao{ public static int getRowCountOfTop() throws SysException { String sql = "SELECT COUNT(*) FROM WAP_CHANNEL C, WAP_TOP T WHERE C.ID = T.CHANNEL_ID ORDER BY T.DISP_ORDER"; return getRowCountBySql(sql); } public static Collection queryTop() throws SysException { String sql = "SELECT C.* FROM WAP_CHANNEL C, WAP_TOP T WHERE C.ID = T.CHANNEL_ID ORDER BY T.DISP_ORDER"; return queryBySql(sql); } public static int getRowCountOfNotTop(int[] channels) throws SysException { String temp = ""; for (int i=0; i<channels.length; i++) { temp += " AND ID <> " + channels[i]; } String sql = "SELECT COUNT(*) FROM WAP_CHANNEL WHERE CHANNEL_TRADE = 0 AND CHANNEL_STATUS = 1 AND CHANNEL_TEST = 0" + temp; return getRowCountBySql(sql); } public static Collection queryNotTop(int[] channels, int beginRow, int endRow) throws SysException { String temp = ""; for (int i=0; i<channels.length; i++) { temp += " AND ID <> " + channels[i]; } String sql = "SELECT * FROM WAP_CHANNEL WHERE CHANNEL_TRADE = 0 AND CHANNEL_STATUS = 1 AND CHANNEL_TEST = 0" + temp; return queryBySql(sql, beginRow, endRow); } public static void in(int channelId) throws SysException { try { findByPK(channelId); } catch (FinderException e) { TopModel topModel = new TopModel(); topModel.setChannelId(channelId); topModel.setDispOrder(getMaxDispOrder() + 1); try { TopBean.insert(topModel); } catch (Exception ex) { throw new SysException("Exception while execute in"); } } } public static void out(int channelId) throws SysException { try { findByPK(channelId); try { TopBean.delete(channelId); } catch (Exception ex) { throw new SysException("Exception while execute out"); } } catch (FinderException e) { } } public static int getMaxDispOrder() throws SysException { String sql = "SELECT MAX(DISP_ORDER) FROM " + tableName; return getRowCountBySql(sql); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -