public void add(GenericVO vo) throws AppException, SysException { StaffWorkAreaSVO staffWorkArea = (StaffWorkAreaSVO) vo; StringBuffer sql = new StringBuffer("insert into"); sql.append( " STAFF_WORK_AREA(STAFF_WORK_AREA_ID,STAFF_ID,WORK_AREA_ID,GRANTOR,ADMIN_FLAG,STS,STS_DATE,CREATE_DATE) values(?,?,?,?,?,?,?,?)"); Connection connection = null; PreparedStatement ps = null; try { connection = ConnectionFactory.getConnection(); ps = connection.prepareStatement(sql.toString()); ps.setString(1, staffWorkArea.getStaffWorkAreaId()); ps.setString(2, staffWorkArea.getStaffId()); ps.setString(3, staffWorkArea.getWorkAreaId()); ps.setString(4, staffWorkArea.getGrantor()); ps.setString(5, staffWorkArea.getAdminFlag()); ps.setString(6, staffWorkArea.getSts()); ps.setDate(7, staffWorkArea.getStsDate()); ps.setDate(8, staffWorkArea.getCreateDate()); ps.execute(); connection.commit(); } catch (SQLException e) { throw new SysException("", "add error..", e); } finally { try { if (ps != null) { ps.close(); } } catch (SQLException e) { } } }
public void delete(GenericVO vo) throws AppException, SysException { StaffWorkAreaSVO staffWorkArea = (StaffWorkAreaSVO) vo; if (vo == null) { throw new RuntimeException(); } StringBuffer sql = new StringBuffer("delete from STAFF_WORK_AREA where 1=1"); sql.append(" and STAFF_WORK_AREA_ID=?"); Connection connection = null; PreparedStatement ps = null; try { connection = ConnectionFactory.getConnection(); ps = connection.prepareStatement(sql.toString()); ps.setString(1, staffWorkArea.getStaffWorkAreaId()); ps.execute(); } catch (SQLException e) { throw new SysException("", "delete error..", e); } finally { try { if (ps != null) { ps.close(); } } catch (SQLException e) { } } }
public void delete(GenericVO vo) throws AppException, SysException { ProvinceSVO province = (ProvinceSVO) vo; if (vo == null) { throw new RuntimeException(); } StringBuffer sql = new StringBuffer("delete from PROVINCE where 1=1"); sql.append(" and PROV_ID=?"); Connection connection = null; PreparedStatement ps = null; try { connection = ConnectionFactory.getConnection(); ps = connection.prepareStatement(sql.toString()); ps.setString(1, province.getProvId()); ps.execute(); } catch (SQLException e) { throw new SysException("", "delete error..", e); } finally { try { if (ps != null) { ps.close(); } } catch (SQLException e) { } } }
public void update(GenericVO vo) throws AppException, SysException { ProvinceSVO province = (ProvinceSVO) vo; StringBuffer sql = new StringBuffer("update PROVINCE set"); if (province.getName() != null) { sql.append(" NAME=?,"); } sql = sql.delete(sql.length() - 1, sql.length()); sql.append(" where 1=1"); sql.append(" and PROV_ID=?"); Connection connection = null; PreparedStatement ps = null; try { connection = ConnectionFactory.getConnection(); ps = connection.prepareStatement(sql.toString()); int index = 1; if (province.getName() != null) { ps.setString(index++, province.getName()); } ps.setString(index++, province.getProvId()); ps.execute(); } catch (SQLException e) { throw new SysException("", "update error..", e); } finally { try { if (ps != null) { ps.close(); } } catch (SQLException e) { } } }
public void add(GenericVO vo) throws AppException, SysException { ProvinceSVO province = (ProvinceSVO) vo; StringBuffer sql = new StringBuffer("insert into"); sql.append(" PROVINCE(PROV_ID,NAME) values(?,?)"); Connection connection = null; PreparedStatement ps = null; try { connection = ConnectionFactory.getConnection(); ps = connection.prepareStatement(sql.toString()); ps.setString(1, province.getProvId()); ps.setString(2, province.getName()); ps.execute(); } catch (SQLException e) { throw new SysException("", "add error..", e); } finally { try { if (ps != null) { ps.close(); } } catch (SQLException e) { } } }
public void update(GenericVO vo) throws AppException, SysException { StaffWorkAreaSVO staffWorkArea = (StaffWorkAreaSVO) vo; StringBuffer sql = new StringBuffer("update STAFF_WORK_AREA set"); if (staffWorkArea.getStaffId() != null) { sql.append(" STAFF_ID=?,"); } if (staffWorkArea.getWorkAreaId() != null) { sql.append(" WORK_AREA_ID=?,"); } if (staffWorkArea.getGrantor() != null) { sql.append(" GRANTOR=?,"); } if (staffWorkArea.getAdminFlag() != null) { sql.append(" ADMIN_FLAG=?,"); } if (staffWorkArea.getSts() != null) { sql.append(" STS=?,"); } if (staffWorkArea.getStsDate() != null) { sql.append(" STS_DATE=?,"); } if (staffWorkArea.getCreateDate() != null) { sql.append(" CREATE_DATE=?,"); } sql = sql.delete(sql.length() - 1, sql.length()); sql.append(" where 1=1"); sql.append(" and STAFF_WORK_AREA_ID=?"); Connection connection = null; PreparedStatement ps = null; try { connection = ConnectionFactory.getConnection(); ps = connection.prepareStatement(sql.toString()); int index = 1; if (staffWorkArea.getStaffId() != null) { ps.setString(index++, staffWorkArea.getStaffId()); } if (staffWorkArea.getWorkAreaId() != null) { ps.setString(index++, staffWorkArea.getWorkAreaId()); } if (staffWorkArea.getGrantor() != null) { ps.setString(index++, staffWorkArea.getGrantor()); } if (staffWorkArea.getAdminFlag() != null) { ps.setString(index++, staffWorkArea.getAdminFlag()); } if (staffWorkArea.getSts() != null) { ps.setString(index++, staffWorkArea.getSts()); } if (staffWorkArea.getStsDate() != null) { ps.setDate(index++, staffWorkArea.getStsDate()); } if (staffWorkArea.getCreateDate() != null) { ps.setDate(index++, staffWorkArea.getCreateDate()); } ps.setString(index++, staffWorkArea.getStaffWorkAreaId()); ps.execute(); } catch (SQLException e) { throw new SysException("", "update error..", e); } finally { try { if (ps != null) { ps.close(); } } catch (SQLException e) { } } }