Ejemplo n.º 1
0
 public String viewGovernmentFile(Long id) throws SQLException {
   PreparedStatement stet =
       DBConnUtil.getPrepareStatement("SELECT SOURCE_CODE FROM GOVERNMENT_FILE WHERE ID = ?");
   stet.setLong(1, id);
   ResultSet result = stet.executeQuery();
   String sourceCode = "";
   while (result.next()) {
     sourceCode = result.getString("SOURCE_CODE");
   }
   return sourceCode;
 }
Ejemplo n.º 2
0
 public void importGovernmentFile(GovernmentFile data) throws SQLException {
   PreparedStatement stet =
       DBConnUtil.getPrepareStatement(
           "INSERT INTO GOVERNMENT_FILE(FILE_TITLE, FILE_TYPE, FILE_SUB_TYPE, AREA, SOURCE_CODE, FILE_PUBLISH_DATE, FILE_EFFECTIVE_DATE, EFFECTIVE)VALUES(?,?,?,?,?,?,?,?)");
   stet.setString(1, data.getFileTitle());
   stet.setString(2, data.getFileType());
   stet.setString(3, data.getFileSubType());
   stet.setString(4, data.getArea());
   stet.setString(5, data.getSourceCode());
   stet.setTimestamp(6, data.getFilePublishDate());
   stet.setTimestamp(7, data.getFileEffectiveDate());
   stet.setBoolean(8, data.getEffective());
   stet.execute();
 }
Ejemplo n.º 3
0
 private ResultSet getQueryResult(String sql, SearchDataCondition condition, boolean isQuery)
     throws SQLException {
   PreparedStatement stat = DBConnUtil.getPrepareStatement(sql);
   int i = 1;
   if (condition.getFilePublishDateFrom() != null) {
     stat.setTimestamp(i, condition.getFilePublishDateFrom());
     i++;
   }
   if (condition.getFilePublishDateTo() != null) {
     stat.setTimestamp(i, condition.getFilePublishDateTo());
     i++;
   }
   if (condition.getFileEffectiveDateFrom() != null) {
     stat.setTimestamp(i, condition.getFileEffectiveDateFrom());
     i++;
   }
   if (condition.getFileEffectiveDateTo() != null) {
     stat.setTimestamp(i, condition.getFileEffectiveDateTo());
     i++;
   }
   if (condition.getFileSubType() != null && !"0".equals(condition.getFileSubType())) {
     stat.setString(i, condition.getFileSubType());
     i++;
   }
   if (condition.getFileType() != null && !"0".equals(condition.getFileType())) {
     stat.setString(i, condition.getFileType());
     i++;
   }
   if (condition.getKeyword() != null) {
     stat.setString(i, "%" + condition.getKeyword() + "%");
     i++;
   }
   if (condition.getFileName() != null) {
     stat.setString(i, "%" + condition.getFileName() + "%");
     i++;
   }
   if (isQuery) {
     stat.setInt(i, condition.getStartRow());
     i++;
     stat.setInt(i, condition.getPageSize());
   }
   return stat.executeQuery();
 }