@Override public Smsuser getUserByMoblie(Connection conn, Smsuser smsuser) { Smsuser user = null; String sql = "select * from Smsuser where moblie='" + smsuser.getMoblie() + "' and bugtype=" + smsuser.getBugtype() + " and solvetime=" + smsuser.getSolvetime(); logger.info(sql); try { ResultSet rs = conn.createStatement().executeQuery(sql); while (rs.next()) { user = new Smsuser(); user.setMoblie(rs.getString("moblie")); user.setMoblie_old(rs.getString("moblie")); user.setName(rs.getString("name")); user.setAtmids(rs.getString("atmids")); user.setBugtype(String.valueOf(rs.getInt("bugtype"))); user.setStatus(String.valueOf(rs.getInt("status"))); user.setSolvetime(String.valueOf(rs.getInt("solvetime"))); } } catch (Exception e) { logger.error(e.getLocalizedMessage(), e); user = null; } return user; }
@Override public void modifyUser(Connection conn, Smsuser user) { String sql = "update Smsuser set moblie='" + user.getMoblie() + "',name='" + user.getName() + "',atmids='" + user.getAtmids() + "',bugtype=" + user.getBugtype() + ",status=" + user.getStatus() + ",solvetime=" + user.getSolvetime() + " where moblie='" + user.getMoblie_old() + "' and bugtype=" + user.getBugtype() + " and solvetime=" + user.getSolvetime_old(); // logger.info(sql); try { conn.createStatement().executeUpdate(sql); } catch (Exception e) { logger.error(e.getLocalizedMessage(), e); } }
@Override public void deleteMoblie(Connection conn, Smsuser user) { String sql = "delete from Smsuser where moblie='" + user.getMoblie() + "' and bugtype=" + user.getBugtype() + " and solvetime=" + user.getSolvetime(); logger.info(sql); try { conn.createStatement().executeUpdate(sql); } catch (Exception e) { logger.error(e.getLocalizedMessage(), e); } }
@Override public void createSms(Connection conn, Smsuser smsuser) { String sql = "insert into smsuser values('" + smsuser.getMoblie() + "','" + smsuser.getName() + "','" + smsuser.getAtmids() + "'," + smsuser.getBugtype() + "," + smsuser.getStatus() + "," + smsuser.getSolvetime() + ")"; // logger.info(sql); try { conn.createStatement().executeUpdate(sql); } catch (Exception e) { logger.error(e.getLocalizedMessage(), e); } }