Ejemplo n.º 1
0
 public GenericVO findByPK(GenericVO vo) throws AppException, SysException {
   ProvinceSVO result = null;
   ProvinceSVO province = (ProvinceSVO) vo;
   StringBuffer sql = new StringBuffer("select");
   sql.append(" a.PROV_ID,a.NAME");
   sql.append(" from PROVINCE a where 1=1");
   sql.append(" and PROV_ID=?");
   Connection connection = null;
   PreparedStatement ps = null;
   ResultSet rs = null;
   try {
     connection = ConnectionFactory.getConnection();
     ps = connection.prepareStatement(sql.toString());
     ps.setString(1, province.getProvId());
     rs = ps.executeQuery();
     result = (ProvinceSVO) ResultSetUtil.convertToVo(rs, ProvinceSVO.class);
   } catch (SQLException e) {
     throw new SysException("", "findByPK error..", e);
   } finally {
     try {
       if (rs != null) {
         rs.close();
       }
       if (ps != null) {
         ps.close();
       }
     } catch (SQLException e) {
     }
   }
   return result;
 }
Ejemplo n.º 2
0
 public GenericVO findByPK(GenericVO vo) throws AppException, SysException {
   StaffWorkAreaSVO result = null;
   StaffWorkAreaSVO staffWorkArea = (StaffWorkAreaSVO) vo;
   StringBuffer sql = new StringBuffer("select");
   sql.append(
       " a.STAFF_WORK_AREA_ID,a.STAFF_ID,a.WORK_AREA_ID,a.GRANTOR,a.ADMIN_FLAG,a.STS,a.STS_DATE,a.CREATE_DATE");
   sql.append(" from STAFF_WORK_AREA a where 1=1");
   sql.append(" and STAFF_WORK_AREA_ID=?");
   Connection connection = null;
   PreparedStatement ps = null;
   ResultSet rs = null;
   try {
     connection = ConnectionFactory.getConnection();
     ps = connection.prepareStatement(sql.toString());
     ps.setString(1, staffWorkArea.getStaffWorkAreaId());
     rs = ps.executeQuery();
     result = (StaffWorkAreaSVO) ResultSetUtil.convertToVo(rs, StaffWorkAreaSVO.class);
   } catch (SQLException e) {
     throw new SysException("", "findByPK error..", e);
   } finally {
     try {
       if (rs != null) {
         rs.close();
       }
       if (ps != null) {
         ps.close();
       }
     } catch (SQLException e) {
     }
   }
   return result;
 }
Ejemplo n.º 3
0
 public List findByVO(GenericVO vo) throws AppException, SysException {
   List results = null;
   ProvinceSVO province = (ProvinceSVO) vo;
   StringBuffer sql = new StringBuffer();
   sql.append("select");
   sql.append(" a.PROV_ID,a.NAME");
   sql.append(" from PROVINCE a where 1=1");
   if (province.getProvId() != null) {
     sql.append(" and PROV_ID=?");
   }
   if (province.getName() != null) {
     sql.append(" and NAME=?");
   }
   Connection connection = null;
   PreparedStatement ps = null;
   ResultSet rs = null;
   try {
     connection = ConnectionFactory.getConnection();
     ps = connection.prepareStatement(sql.toString());
     int index = 1;
     if (province.getProvId() != null) {
       ps.setString(index++, province.getProvId());
     }
     if (province.getName() != null) {
       ps.setString(index++, province.getName());
     }
     rs = ps.executeQuery();
     results = (List) ResultSetUtil.convertToList(rs, ProvinceSVO.class);
   } catch (SQLException e) {
     throw new SysException("", "findByVO error..", e);
   } finally {
     try {
       if (rs != null) {
         rs.close();
       }
       if (ps != null) {
         ps.close();
       }
     } catch (SQLException e) {
     }
   }
   return results;
 }
Ejemplo n.º 4
0
 public List findByVO(GenericVO vo) throws AppException, SysException {
   List results = null;
   StaffWorkAreaSVO staffWorkArea = (StaffWorkAreaSVO) vo;
   StringBuffer sql = new StringBuffer();
   sql.append("select");
   sql.append(
       " a.STAFF_WORK_AREA_ID,a.STAFF_ID,a.WORK_AREA_ID,a.GRANTOR,a.ADMIN_FLAG,a.STS,a.STS_DATE,a.CREATE_DATE");
   sql.append(" from STAFF_WORK_AREA a where 1=1");
   if (staffWorkArea.getStaffWorkAreaId() != null) {
     sql.append(" and STAFF_WORK_AREA_ID=?");
   }
   if (staffWorkArea.getStaffId() != null) {
     sql.append(" and STAFF_ID=?");
   }
   if (staffWorkArea.getWorkAreaId() != null) {
     sql.append(" and WORK_AREA_ID=?");
   }
   if (staffWorkArea.getGrantor() != null) {
     sql.append(" and GRANTOR=?");
   }
   if (staffWorkArea.getAdminFlag() != null) {
     sql.append(" and ADMIN_FLAG=?");
   }
   if (staffWorkArea.getSts() != null) {
     sql.append(" and STS=?");
   }
   if (staffWorkArea.getStsDate() != null) {
     sql.append(" and STS_DATE=?");
   }
   if (staffWorkArea.getCreateDate() != null) {
     sql.append(" and CREATE_DATE=?");
   }
   Connection connection = null;
   PreparedStatement ps = null;
   ResultSet rs = null;
   try {
     connection = ConnectionFactory.getConnection();
     ps = connection.prepareStatement(sql.toString());
     int index = 1;
     if (staffWorkArea.getStaffWorkAreaId() != null) {
       ps.setString(index++, staffWorkArea.getStaffWorkAreaId());
     }
     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());
     }
     rs = ps.executeQuery();
     results = (List) ResultSetUtil.convertToList(rs, StaffWorkAreaSVO.class);
   } catch (SQLException e) {
     throw new SysException("", "findByVO error..", e);
   } finally {
     try {
       if (rs != null) {
         rs.close();
       }
       if (ps != null) {
         ps.close();
       }
     } catch (SQLException e) {
     }
   }
   return results;
 }