📄 channelfeebean.java
字号:
package com.sxit.wap.channelfee;import java.sql.*;import java.util.*;import com.sxit.wap.common.*;import com.sxit.wap.exception.*;public class ChannelFeeBean extends ChannelFeeDao{ public static Collection queryAllFeeCode() throws SysException{ String sql="SELECT FT.FEE_NAME,CH.CHANNEL_NAME,CF.FEE_CODE FROM WAP_FEE_TYPE FT,WAP_CHANNEL CH,WAP_CHANNEL_FEE CF WHERE CH.ID=CF.CHANNEL_ID AND CF.FEE_TYPE=FT.FEE_TYPE ORDER BY CHANNEL_NAME"; return queryBySql(sql); } public static Collection queryByChannelId(int channelId) throws SysException { String sql = "SELECT C.*, F.FEE_NAME FROM WAP_CHANNEL_FEE C, WAP_FEE_TYPE F WHERE C.FEE_TYPE = F.FEE_TYPE AND C.CHANNEL_ID = " + channelId; return queryBySql(sql); } public static int getFeeCode(int channelId, int feeType) throws SysException { try { return findByPK(channelId, feeType).getFeeCode(); } catch (FinderException e) { throw new SysException("FinderException while execute FinderException"); } } public static boolean hasDelete(int channel) throws SysException { return getRowCountBySql("SELECT COUNT(*) FROM " + tableName + " WHERE CHANNEL_ID = '" + channel +"'")<1; } public static Hashtable getChannelFeeHashtable(int channelId) throws SysException { Hashtable value = new Hashtable(); Collection coll = queryByChannelId(channelId); Iterator it = coll.iterator(); while (it.hasNext()) { Hashtable element = (Hashtable)it.next(); ChannelFeeModel channelFeeModel = ChannelFeeBean.toModel(element); int feeType = channelFeeModel.getFeeType(); int feeCode = channelFeeModel.getFeeCode(); int feeTimes = channelFeeModel.getFeeTimes(); Timestamp beginDate = channelFeeModel.getBeginDate(); Timestamp endDate = channelFeeModel.getEndDate(); int cent = channelFeeModel.getCent(); value.put(""+feeType, channelFeeModel); } return value; } public static boolean isFreeOrNot(int channelId) throws SysException { boolean rValue = false; Collection coll = queryByChannelId(channelId); Iterator it = coll.iterator(); while (it.hasNext()) { Hashtable element = (Hashtable) it.next(); ChannelFeeModel channelFeeModel = ChannelFeeBean.toModel(element); int feeType = channelFeeModel.getFeeType(); if (feeType==0) rValue=true; } return rValue; } public static void deleteByChannelId(int channelId) throws SysException { String sql = "DELETE FROM " + tableName + " WHERE CHANNEL_ID = " + channelId; updateBySql(sql); } public static Timestamp getFreeTime(int channelId){ Connection dbConnection = null; Statement stmt = null; ResultSet rs = null; Timestamp time = null; try{ dbConnection = Database.getConnection(); stmt = dbConnection.createStatement(); String sql = "SELECT BEGIN_DATE FROM WAP_CHANNEL_FEE WHERE CHANNEL_ID = " + channelId + " AND FEE_TYPE = 3"; rs = stmt.executeQuery(sql); if ( rs.next() ) { time = rs.getTimestamp(1); }else{ } return time; }catch(Exception ex){ ex.printStackTrace(); return null; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -