📄 usersubdao.java
字号:
+ " WHERE USER_MDN = '" + model.getUserMdn() + "'" + " AND CHANNEL_ID = " + model.getChannelId(); } return sql; } protected static String getDeleteSQL(String userMdn, int channelId) { String sql = ""; if (Database.dbType == DBType.ORACLE) { sql = "DELETE FROM WAP_USER_SUB" + " WHERE USER_MDN = '" + userMdn + "'" + " AND CHANNEL_ID = " + channelId; } else if (Database.dbType == DBType.SQLSERVER) { sql = "DELETE FROM WAP_USER_SUB" + " WHERE USER_MDN = '" + userMdn + "'" + " AND CHANNEL_ID = " + channelId; } else if (Database.dbType == DBType.MYSQL) { sql = "DELETE FROM WAP_USER_SUB" + " WHERE USER_MDN = '" + userMdn + "'" + " AND CHANNEL_ID = " + channelId; } return sql; } protected static String getDeleteSQL(String[] userMdns, int[] channelIds) { String sql = ""; if (Database.dbType == DBType.ORACLE) { sql = "DELETE FROM WAP_USER_SUB WHERE 1 = 2"; for ( int i = 0; i < userMdns.length; i++ ) { sql += " OR (USER_MDN = '" + userMdns[i] + "'" + " AND CHANNEL_ID = " + channelIds[i] + ")"; } } else if (Database.dbType == DBType.SQLSERVER) { sql = "DELETE FROM WAP_USER_SUB WHERE 1 = 2"; for ( int i = 0; i < userMdns.length; i++ ) { sql += " OR (USER_MDN = '" + userMdns[i] + "'" + " AND CHANNEL_ID = " + channelIds[i] + ")"; } } else if (Database.dbType == DBType.MYSQL) { sql = "DELETE FROM WAP_USER_SUB WHERE 1 = 2"; for ( int i = 0; i < userMdns.length; i++ ) { sql += " OR (USER_MDN = '" + userMdns[i] + "'" + " AND CHANNEL_ID = " + channelIds[i] + ")"; } } return sql; } protected static String getFindByPKSQL(String userMdn, int channelId) { String sql = ""; if (Database.dbType == DBType.ORACLE) { sql = "SELECT * FROM WAP_USER_SUB" + " WHERE USER_MDN = '" + userMdn + "'" + " AND CHANNEL_ID = " + channelId; } else if (Database.dbType == DBType.SQLSERVER) { sql = "SELECT * FROM WAP_USER_SUB" + " WHERE USER_MDN = '" + userMdn + "'" + " AND CHANNEL_ID = " + channelId; } else if (Database.dbType == DBType.MYSQL) { sql = "SELECT * FROM WAP_USER_SUB" + " WHERE USER_MDN = '" + userMdn + "'" + " AND CHANNEL_ID = " + channelId; } return sql; } protected static boolean isValidData(UserSubModel 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)) { UserSubModel model=new UserSubModel(); model.setUserMdn("abc"); model.setChannelId(1); model.setSubDate(Function.getCurrTime()); model.setEndDate(Function.getCurrTime()); model.setFeeType(1); model.setFeeCode(1); model.setSubStatus(1); model.setIsCancel(1); UserSubModel userSubModel = UserSubBean.insert(model); }else if ("update".equalsIgnoreCase(action)){ UserSubModel userSubModel = UserSubBean.findByPK("abc", 1); String userMdn = userSubModel.getUserMdn(); int channelId = userSubModel.getChannelId(); Timestamp subDate = userSubModel.getSubDate(); Timestamp endDate = userSubModel.getEndDate(); int feeType = userSubModel.getFeeType(); int feeCode = userSubModel.getFeeCode(); int subStatus = userSubModel.getSubStatus(); int isCancel = userSubModel.getIsCancel(); userSubModel.setUserMdn(userMdn); userSubModel.setChannelId(channelId); userSubModel.setSubDate(subDate); userSubModel.setEndDate(endDate); userSubModel.setFeeType(feeType); userSubModel.setFeeCode(feeCode); userSubModel.setSubStatus(subStatus); userSubModel.setIsCancel(isCancel); update(userSubModel); }else if ("delete".equalsIgnoreCase(action)){ String[] userMdns = new String[3]; userMdns[0] = "abc"; userMdns[1] = "abc"; userMdns[2] = "abc"; int[] channelIds = new int[3]; channelIds[0] = 1; channelIds[1] = 1; channelIds[2] = 1; UserSubBean.delete(userMdns, channelIds); }else if ("findByPK".equalsIgnoreCase(action)){ UserSubModel userSubModel = UserSubBean.findByPK("abc", 1); String userMdn = userSubModel.getUserMdn(); int channelId = userSubModel.getChannelId(); Timestamp subDate = userSubModel.getSubDate(); Timestamp endDate = userSubModel.getEndDate(); int feeType = userSubModel.getFeeType(); int feeCode = userSubModel.getFeeCode(); int subStatus = userSubModel.getSubStatus(); int isCancel = userSubModel.getIsCancel(); System.out.println("userMdn = " + userMdn); System.out.println("channelId = " + channelId); System.out.println("subDate = " + Function.getYYYYMMDDHHMISS(subDate)); System.out.println("endDate = " + Function.getYYYYMMDDHHMISS(endDate)); System.out.println("feeType = " + feeType); System.out.println("feeCode = " + feeCode); System.out.println("subStatus = " + subStatus); System.out.println("isCancel = " + isCancel); }else if ("queryBySql".equalsIgnoreCase(action)){ Collection coll = UserSubBean.queryBySql("SELECT * FROM WAP_USER_SUB"); }else if ("getRowCountBySql".equalsIgnoreCase(action)){ int rowCount = UserSubBean.getRowCountBySql("SELECT COUNT(*) FROM WAP_USER_SUB"); System.out.println("rowCount = " + rowCount); }else if ("queryAll".equalsIgnoreCase(action)){ Collection coll = UserSubBean.queryAll(); Iterator it = coll.iterator(); while ( it.hasNext() ) { Hashtable element = (Hashtable)it.next(); String userMdn = (String)element.get("userMdn"); String channelId = (String)element.get("channelId"); String subDate = Function.getYYYYMMDDHHMISS((Timestamp)element.get("subDate")); String endDate = Function.getYYYYMMDDHHMISS((Timestamp)element.get("endDate")); String feeType = (String)element.get("feeType"); String feeCode = (String)element.get("feeCode"); String subStatus = (String)element.get("subStatus"); String isCancel = (String)element.get("isCancel"); System.out.print("userMdn = " + userMdn + ",\t"); System.out.print("channelId = " + channelId + ",\t"); System.out.print("subDate = " + subDate + ",\t"); System.out.print("endDate = " + endDate + ",\t"); System.out.print("feeType = " + feeType + ",\t"); System.out.print("feeCode = " + feeCode + ",\t"); System.out.print("subStatus = " + subStatus + ",\t"); System.out.print("isCancel = " + isCancel + "\n"); } }else if ("getRowCountOfAll".equalsIgnoreCase(action)){ int rowCount = UserSubBean.getRowCountOfAll(); System.out.println("rowCount = " + rowCount); }else if ("getSequenceNextValue".equalsIgnoreCase(action)){ int sequenceValue = UserSubBean.getSequenceNextValue(); System.out.println("sequenceValue = " + sequenceValue); } }}/*String userMdn = (model==null?"":model.getUserMdn());int channelId = (model==null?0:model.getChannelId());Timestamp subDate = (model==null?null:model.getSubDate());Timestamp endDate = (model==null?null:model.getEndDate());int feeType = (model==null?0:model.getFeeType());int feeCode = (model==null?0:model.getFeeCode());int subStatus = (model==null?0:model.getSubStatus());int isCancel = (model==null?0:model.getIsCancel());String userMdn = PageUtil.parseStringField(request.getParameter("userMdn"), "userMdn", false, 19);int channelId = PageUtil.parseIntField(request.getParameter("channelId"), "channelId", false, 0, 19);int feeType = PageUtil.parseIntField(request.getParameter("feeType"), "feeType", false, 0, 65535);int feeCode = PageUtil.parseIntField(request.getParameter("feeCode"), "feeCode", false, 0, 65535);int subStatus = PageUtil.parseIntField(request.getParameter("subStatus"), "subStatus", false, 0, 65535);int isCancel = PageUtil.parseIntField(request.getParameter("isCancel"), "isCancel", false, 0, 65535);String userMdn = PageUtil.parseStringField(request.getParameter("userMdn"), "userMdn", false, 20);int channelId = PageUtil.parseIntField(request.getParameter("channelId"), "channelId", false, 0, 999999999);Timestamp subDate = PageUtil.parseDateField(request.getParameter("subDate"), "subDate", true);Timestamp endDate = PageUtil.parseDateField(request.getParameter("endDate"), "endDate", true);int feeType = PageUtil.parseIntField(request.getParameter("feeType"), "feeType", true, 0, 99999);int feeCode = PageUtil.parseIntField(request.getParameter("feeCode"), "feeCode", true, 0, 99);int subStatus = PageUtil.parseIntField(request.getParameter("subStatus"), "subStatus", true, 0, 9);int isCancel = PageUtil.parseIntField(request.getParameter("isCancel"), "isCancel", true, 0, 9);String userMdn = (model==null?"":""+model.getUserMdn());String channelId = (model==null?"0":""+model.getChannelId());Timestamp subDate = (model==null?null:model.getSubDate());Timestamp endDate = (model==null?null:model.getEndDate());String feeType = (model==null?"0":""+model.getFeeType());String feeCode = (model==null?"0":""+model.getFeeCode());String subStatus = (model==null?"0":""+model.getSubStatus());String isCancel = (model==null?"0":""+model.getIsCancel());Collection coll = UserSubBean.queryAll((pageNum-1) * pageRow + 1, pageNum * pageRow);Iterator it = coll.iterator();while ( it.hasNext() ) { Hashtable element = (Hashtable)it.next(); UserSubModel userSubModel = UserSubBean.toModel(element); String userMdn = userSubModel.getUserMdn(); int channelId = userSubModel.getChannelId(); Timestamp subDate = userSubModel.getSubDate(); Timestamp endDate = userSubModel.getEndDate(); int feeType = userSubModel.getFeeType(); int feeCode = userSubModel.getFeeCode(); int subStatus = userSubModel.getSubStatus(); int isCancel = userSubModel.getIsCancel(); excel.setCellData(new ExcelCell(ExcelUtil.STRING_CELL_TYTE, currRow, currCol++), userMdn+""); excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE, currRow, currCol++), channelId+""); excel.setCellData(new ExcelCell(ExcelUtil.DATE_CELL_TYTE, currRow, currCol++), subDate); excel.setCellData(new ExcelCell(ExcelUtil.DATE_CELL_TYTE, currRow, currCol++), endDate); 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++), subStatus+""); excel.setCellData(new ExcelCell(ExcelUtil.INT_CELL_TYTE, currRow, currCol++), isCancel+"");*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -