Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ArrayList<domainMasterPelamar> tampilDataPelamar(int limitBawah, int limitAtas, domainMasterPelamarAll dMA ){
- connectDb dbMysql = new connectDb();
- try {
- dbMysql.connectDbMysql();
- String sql = null;
- PreparedStatement ps;
- ResultSet rs = null;
- if (dMA.isLanjut()){
- sql = "select id, nama, jenis_kelamin,status_pelamar, jabatan, no_telphone, tanggal_dibuat, user_created, user_updated "
- + "from payroll_master_pelamar where id like '%?%' and nama like '%?%' and jabatan like '%?%' order by tanggal_dibuat desc limit ?,? ";
- ps = dbMysql.koneksi.prepareStatement(sql);
- ps.setString(1, dMA.getfId() );
- ps.setString(2, dMA.getfNama());
- ps.setString(3, dMA.getfJabatan() );
- ps.setInt(4, limitBawah);
- ps.setInt(5, limitAtas);
- rs = ps.executeQuery();
- }
- else{
- sql = "select id, nama, jenis_kelamin,status_pelamar, jabatan, no_telphone, tanggal_dibuat, user_created, user_updated "
- + "from payroll_master_pelamar order by tanggal_dibuat desc limit ?,? ";
- ps = dbMysql.koneksi.prepareStatement(sql);
- ps.setInt(1, limitBawah);
- ps.setInt(2, limitAtas);
- rs = ps.executeQuery();
- }
- ArrayList<domainMasterPelamar> listHasil = new ArrayList<domainMasterPelamar>();
- while(rs.next()){
- domainMasterPelamar p = konversiResultSet(rs);
- listHasil.add(p);
- }
- ps.clearParameters();
- ps.close();
- rs.close();
- dbMysql.disconnectDbMysql();
- return listHasil;
- } catch (SQLException ex) {
- Logger.getLogger(daoLogin.class.getName()).log(Level.SEVERE, null, ex);
- new com.sistem.loggerError(daoLogin.class.getName(), ex);
- }
- return null;
- }
- private domainMasterPelamar konversiResultSet(ResultSet rs) {
- try {
- domainMasterPelamar p = new domainMasterPelamar();
- com.sistem.convertAll convertAll = new com.sistem.convertAll();
- p.setRefCode(rs.getString("id"));
- p.setNama(rs.getString("nama"));
- p.setJenisKelamin(convertAll.convertJenisKelaminString(rs.getInt("jenis_kelamin")));
- p.setStatusPelamar(convertAll.convertStatusPelamarString(rs.getInt("status_pelamar")));
- p.setJabatan(rs.getString("jabatan"));
- p.setNoHP(rs.getString("no_telphone"));
- p.setTanggal(rs.getDate("tanggal_dibuat"));
- p.setUserCreated(rs.getString("user_created"));
- p.setUserUpdated(rs.getString("user_updated"));
- return p;
- } catch (SQLException ex) {
- Logger.getLogger(daoLogin.class.getName()).log(Level.SEVERE, null, ex);
- new com.sistem.loggerError(daoLogin.class.getName(), ex);
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement