📄 channelfeedao.java
字号:
sql = "UPDATE WAP_CHANNEL_FEE SET FEE_CODE = " + model.getFeeCode() + ", FEE_TIMES = " + model.getFeeTimes() + ", BEGIN_DATE = '" + Function.DateToString(model.getBeginDate()) + "', END_DATE = '" + Function.DateToString(model.getEndDate()) + "', CENT = " + model.getCent() + "" + " WHERE CHANNEL_ID = " + model.getChannelId() + " AND FEE_TYPE = " + model.getFeeType(); } return sql; } protected static String getDeleteSQL(int channelId, int feeType) { String sql = ""; if (Database.dbType == DBType.ORACLE) { sql = "DELETE FROM WAP_CHANNEL_FEE" + " WHERE CHANNEL_ID = " + channelId + " AND FEE_TYPE = " + feeType; } else if (Database.dbType == DBType.SQLSERVER) { sql = "DELETE FROM WAP_CHANNEL_FEE" + " WHERE CHANNEL_ID = " + channelId + " AND FEE_TYPE = " + feeType; } else if (Database.dbType == DBType.MYSQL) { sql = "DELETE FROM WAP_CHANNEL_FEE" + " WHERE CHANNEL_ID = " + channelId + " AND FEE_TYPE = " + feeType; } return sql; } protected static String getDeleteSQL(int[] channelIds, int[] feeTypes) { String sql = ""; if (Database.dbType == DBType.ORACLE) { sql = "DELETE FROM WAP_CHANNEL_FEE WHERE 1 = 2"; for ( int i = 0; i < channelIds.length; i++ ) { sql += " OR (CHANNEL_ID = " + channelIds[i] + " AND FEE_TYPE = " + feeTypes[i] + ")"; } } else if (Database.dbType == DBType.SQLSERVER) { sql = "DELETE FROM WAP_CHANNEL_FEE WHERE 1 = 2"; for ( int i = 0; i < channelIds.length; i++ ) { sql += " OR (CHANNEL_ID = " + channelIds[i] + " AND FEE_TYPE = " + feeTypes[i] + ")"; } } else if (Database.dbType == DBType.MYSQL) { sql = "DELETE FROM WAP_CHANNEL_FEE WHERE 1 = 2"; for ( int i = 0; i < channelIds.length; i++ ) { sql += " OR (CHANNEL_ID = " + channelIds[i] + " AND FEE_TYPE = " + feeTypes[i] + ")"; } } return sql; } protected static String getFindByPKSQL(int channelId, int feeType) { String sql = ""; if (Database.dbType == DBType.ORACLE) { sql = "SELECT * FROM WAP_CHANNEL_FEE" + " WHERE CHANNEL_ID = " + channelId + " AND FEE_TYPE = " + feeType; } else if (Database.dbType == DBType.SQLSERVER) { sql = "SELECT * FROM WAP_CHANNEL_FEE" + " WHERE CHANNEL_ID = " + channelId + " AND FEE_TYPE = " + feeType; } else if (Database.dbType == DBType.MYSQL) { sql = "SELECT * FROM WAP_CHANNEL_FEE" + " WHERE CHANNEL_ID = " + channelId + " AND FEE_TYPE = " + feeType; } return sql; } protected static boolean isValidData(ChannelFeeModel model) { return true; } private static Connection getDBConnection() throws SysException { return Database.getConnection(); } private static void closeConnection(Connection dbConnection) throws SysException { try { if (dbConnection != null && !dbConnection.isClosed()) { dbConnection.close(); dbConnection = null; } } catch (SQLException se) { //throw new SysException("SQL Exception while closing DB connection : \n" + se); } } private static void closeResultSet(ResultSet result) throws SysException { try { if (result != null) { result.close(); } } catch (SQLException se) { //throw new SysException("SQL Exception while closing Result Set : \n" + se); } } private static void closeStatement(Statement stmt) throws SysException { try { if (stmt != null) { stmt.close(); } } catch (SQLException se) { //throw new SysException("SQL Exception while closing Statement : \n" + se); } } public static void main(String[] args) throws Exception{ String action = ""; if (args.length == 1) { action = args[0]; } if (action == null || "".equals(action)) { } else if ("insert".equalsIgnoreCase(action)) { ChannelFeeModel model=new ChannelFeeModel(); model.setChannelId(1); model.setFeeType(1); model.setFeeCode(1); model.setFeeTimes(1); model.setBeginDate(Function.getCurrTime()); model.setEndDate(Function.getCurrTime()); model.setCent(1); ChannelFeeModel channelFeeModel = ChannelFeeBean.insert(model); }else if ("update".equalsIgnoreCase(action)){ ChannelFeeModel channelFeeModel = ChannelFeeBean.findByPK(1, 1); int channelId = channelFeeModel.getChannelId(); int feeType = channelFeeModel.getFeeType(); int feeCode = channelFeeModel.getFeeCode(); int feeTimes = channelFeeModel.getFeeTimes(); Timestamp beginDate = channelFeeModel.getBeginDate(); Timestamp endDate = channelFeeModel.getEndDate(); int cent = channelFeeModel.getCent(); channelFeeModel.setChannelId(channelId); channelFeeModel.setFeeType(feeType); channelFeeModel.setFeeCode(feeCode); channelFeeModel.setFeeTimes(feeTimes); channelFeeModel.setBeginDate(beginDate); channelFeeModel.setEndDate(endDate); channelFeeModel.setCent(cent); update(channelFeeModel); }else if ("delete".equalsIgnoreCase(action)){ int[] channelIds = new int[3]; channelIds[0] = 1; channelIds[1] = 1; channelIds[2] = 1; int[] feeTypes = new int[3]; feeTypes[0] = 1; feeTypes[1] = 1; feeTypes[2] = 1; ChannelFeeBean.delete(channelIds, feeTypes); }else if ("findByPK".equalsIgnoreCase(action)){ ChannelFeeModel channelFeeModel = ChannelFeeBean.findByPK(1, 1); int channelId = channelFeeModel.getChannelId(); int feeType = channelFeeModel.getFeeType(); int feeCode = channelFeeModel.getFeeCode(); int feeTimes = channelFeeModel.getFeeTimes(); Timestamp beginDate = channelFeeModel.getBeginDate(); Timestamp endDate = channelFeeModel.getEndDate(); int cent = channelFeeModel.getCent(); System.out.println("channelId = " + channelId); System.out.println("feeType = " + feeType); System.out.println("feeCode = " + feeCode); System.out.println("feeTimes = " + feeTimes); System.out.println("beginDate = " + Function.getYYYYMMDDHHMISS(beginDate)); System.out.println("endDate = " + Function.getYYYYMMDDHHMISS(endDate)); System.out.println("cent = " + cent); }else if ("queryBySql".equalsIgnoreCase(action)){ Collection coll = ChannelFeeBean.queryBySql("SELECT * FROM WAP_CHANNEL_FEE"); }else if ("getRowCountBySql".equalsIgnoreCase(action)){ int rowCount = ChannelFeeBean.getRowCountBySql("SELECT COUNT(*) FROM WAP_CHANNEL_FEE"); System.out.println("rowCount = " + rowCount); }else if ("queryAll".equalsIgnoreCase(action)){ Collection coll = ChannelFeeBean.queryAll(); Iterator it = coll.iterator(); while ( it.hasNext() ) { Hashtable element = (Hashtable)it.next(); String channelId = (String)element.get("channelId"); String feeType = (String)element.get("feeType"); String feeCode = (String)element.get("feeCode"); String feeTimes = (String)element.get("feeTimes"); String beginDate = Function.getYYYYMMDDHHMISS((Timestamp)element.get("beginDate")); String endDate = Function.getYYYYMMDDHHMISS((Timestamp)element.get("endDate")); String cent = (String)element.get("cent"); System.out.print("channelId = " + channelId + ",\t"); System.out.print("feeType = " + feeType + ",\t"); System.out.print("feeCode = " + feeCode + ",\t"); System.out.print("feeTimes = " + feeTimes + ",\t"); System.out.print("beginDate = " + beginDate + ",\t"); System.out.print("endDate = " + endDate + ",\t"); System.out.print("cent = " + cent + "\n"); } }else if ("getRowCountOfAll".equalsIgnoreCase(action)){ int rowCount = ChannelFeeBean.getRowCountOfAll(); System.out.println("rowCount = " + rowCount); }else if ("getSequenceNextValue".equalsIgnoreCase(action)){ int sequenceValue = ChannelFeeBean.getSequenceNextValue(); System.out.println("sequenceValue = " + sequenceValue); } }}/*int channelId = (model==null?0:model.getChannelId());int feeType = (model==null?0:model.getFeeType());int feeCode = (model==null?0:model.getFeeCode());int feeTimes = (model==null?0:model.getFeeTimes());Timestamp beginDate = (model==null?null:model.getBeginDate());Timestamp endDate = (model==null?null:model.getEndDate());int cent = (model==null?0:model.getCent());int channelId = PageUtil.parseIntField(request.getParameter("channelId"), "channelId", false, 0, *);int feeType = PageUtil.parseIntField(request.getParameter("feeType"), "feeType", false, 0, *);int feeCode = PageUtil.parseIntField(request.getParameter("feeCode"), "feeCode", false, 0, 65535);int feeTimes = PageUtil.parseIntField(request.getParameter("feeTimes"), "feeTimes", false, 0, 65535);int cent = PageUtil.parseIntField(request.getParameter("cent"), "cent", false, 0, 255);int channelId = PageUtil.parseIntField(request.getParameter("channelId"), "channelId", false, 0, 999999999);int feeType = PageUtil.parseIntField(request.getParameter("feeType"), "feeType", false, 0, 99);int feeCode = PageUtil.parseIntField(request.getParameter("feeCode"), "feeCode", true, 0, 99999);int feeTimes = PageUtil.parseIntField(request.getParameter("feeTimes"), "feeTimes", true, 0, 9999);Timestamp beginDate = PageUtil.parseDateField(request.getParameter("beginDate"), "beginDate", true);Timestamp endDate = PageUtil.parseDateField(request.getParameter("endDate"), "endDate", true);int cent = PageUtil.parseIntField(request.getParameter("cent"), "cent", true, 0, 999);String channelId = (model==null?"0":""+model.getChannelId());String feeType = (model==null?"0":""+model.getFeeType());String feeCode = (model==null?"0":""+model.getFeeCode());String feeTimes = (model==null?"0":""+model.getFeeTimes());Timestamp beginDate = (model==null?null:model.getBeginDate());Timestamp endDate = (model==null?null:model.getEndDate());String cent = (model==null?"0":""+model.getCent());Collection coll = ChannelFeeBean.queryAll((pageNum-1) * pageRow + 1, pageNum * pageRow);Iterator it = coll.iterator();while ( it.hasNext() ) { Hashtable element = (Hashtable)it.next(); ChannelFeeModel channelFeeModel = ChannelFeeBean.toModel(element); int channelId = channelFeeModel.getChannelId(); int feeType = channelFeeModel.getFeeType(); int feeCode = channelFeeModel.getFeeCode(); int feeTimes = channelFeeModel.getFeeTimes(); Timestamp beginDate = channelFeeModel.getBeginDate(); Timestamp endDate = channelFeeModel.getEndDate(); int cent = channelFeeModel.getCent(); excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE, currRow, currCol++), channelId+""); excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE, currRow, currCol++), feeType+""); excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE, currRow, currCol++), feeCode+""); excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE, currRow, currCol++), feeTimes+""); excel.setCellData(new ExcelCell(ExcelUtil.DATE_CELL_TYTE, currRow, currCol++), beginDate); excel.setCellData(new ExcelCell(ExcelUtil.DATE_CELL_TYTE, currRow, currCol++), endDate); excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE, currRow, currCol++), cent+"");*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -