private Account createAccount(ResultSet rs) throws Exception { Account a = new Account(); a.setId(rs.getInt("id")); a.setRecommenderId(rs.getInt("recommender_id")); a.setLoginName(rs.getString("login_name")); a.setLoginPassword(rs.getString("login_passwd")); a.setStatus(rs.getString("status")); a.setCreateDate(rs.getDate("create_date")); a.setPauseDate(rs.getDate("pause_date")); a.setCloseDate(rs.getDate("close_date")); a.setRealName(rs.getString("real_name")); a.setIdcardNo(rs.getString("idcard_no")); a.setBirthdate(rs.getDate("birthdate")); a.setGender(rs.getString("gender")); a.setOccupation(rs.getString("occupation")); a.setTelephone(rs.getString("telephone")); a.setEmail(rs.getString("email")); a.setMailaddress(rs.getString("mailaddress")); a.setZipcode(rs.getString("zipcode")); a.setQq(rs.getString("qq")); a.setLastLoginTime(rs.getDate("last_login_time")); a.setLastLoginIp(rs.getString("last_login_ip")); return a; }
public static void main(String[] args) throws Exception { IAccountDAO dao = new AccountDAOImpl(); // List<Account> accs = // dao.findByCondition(null, null, null, null,2,5); // for(Account acc : accs){ // System.out.println(acc.getId()+","+acc.getIdcardNo()+","+acc.getRealName()); // } // int totalPage = dao.findTotalPage(null, null, null, null, 5); // System.out.println(totalPage); // dao.startAccount(1018); // Account account = dao.findById(1018); // System.out.println(account.getStatus()); // Account acc = dao.findByIdcardNo("330682196903190613"); // System.out.println(acc.getId()); Account account = new Account(); account.setEmail("*****@*****.**"); account.setLoginName("dkfj"); account.setIdcardNo("130281199207271123"); account.setLoginPassword("dfad"); account.setRealName("小米"); account.setTelephone("41551"); dao.addAccount(account); }