コード例 #1
0
  /**
   * 메일템플릿 수정
   *
   * @param mailTemplate
   * @return
   * @throws DataAccessException
   */
  public int updateMailTemplate(MailTemplate mailTemplate) throws DataAccessException {
    String sql = QueryUtil.getStringQuery("content_sql", "content.mailtemplate.update");
    Map<String, Object> param = new HashMap<String, Object>();
    param.put("templateName", mailTemplate.getTemplateName());
    param.put("templateContent", mailTemplate.getTemplateContent());
    param.put("shareGroupID", mailTemplate.getShareGroupID());
    param.put("userID", mailTemplate.getUserID());
    param.put("useYN", mailTemplate.getUseYN());
    param.put("templateID", mailTemplate.getTemplateID());
    param.put("templateType", mailTemplate.getTemplateType());

    return getSimpleJdbcTemplate().update(sql, param);
  }
コード例 #2
0
  /**
   * 메일템플릿보기
   *
   * @param templateID
   * @return
   * @throws DataAccessException
   */
  public MailTemplate viewMailTemplate(int templateID) throws DataAccessException {
    MailTemplate mailTemplate = new MailTemplate();
    Map<String, Object> resultMap = null;
    String sql =
        QueryUtil.getStringQuery(
            "content_sql", "content.mailtemplate.view"); // 쿼리 프로퍼티파일의 키값에 해당되는 sql문을 읽어온다.
    Map<String, Object> param = new HashMap<String, Object>();
    param.put("templateID", new Integer(templateID));

    // SQL문이 실행된다.
    try {
      resultMap = getSimpleJdbcTemplate().queryForMap(sql, param);
    } catch (EmptyResultDataAccessException e1) {
    }

    if (resultMap != null) {
      mailTemplate.setTemplateID(Integer.parseInt(String.valueOf(resultMap.get("templateID"))));
      mailTemplate.setTemplateName((String) resultMap.get("templateName"));
      mailTemplate.setTemplateContent((String) resultMap.get("templateContent"));
      mailTemplate.setShareGroupID((String) resultMap.get("shareGroupID"));
      mailTemplate.setUserID((String) resultMap.get("userID"));
      mailTemplate.setUserName((String) resultMap.get("userName"));
      mailTemplate.setUseYN((String) resultMap.get("useYN"));
      mailTemplate.setGroupName((String) resultMap.get("groupName"));
      mailTemplate.setRegistDate(String.valueOf(resultMap.get("registDate")));
      mailTemplate.setTemplateType((String) resultMap.get("templateType"));
    }

    return mailTemplate;
  }