예제 #1
0
 @Transactional
 public void updatePostOption(PostOption form) {
   optionsService.updateOptionValue(OptionConstants.MAXSHOW, form.getMaxshow() + "");
   optionsService.updateOptionValue(OptionConstants.ALLOW_COMMENT, form.isAllowComment() + "");
   optionsService.updateOptionValue(
       OptionConstants.DEFAULT_CATEGORY_ID, form.getDefaultCategory());
 }
예제 #2
0
 @Transactional
 public void updateMailOption(EMailSender form) {
   optionsService.updateOptionValue("mail_host", form.getHost());
   optionsService.updateOptionValue("mail_port", form.getPort() + "");
   optionsService.updateOptionValue("mail_username", form.getUsername());
   optionsService.updateOptionValue("mail_password", form.getPassword());
 }
예제 #3
0
 /**
  * 更新网站基础设置,同时更新WebConstants中变量
  *
  * @param form
  */
 @Transactional
 public void updateGeneralOption(GeneralOption form) {
   optionsService.updateOptionValue(OptionConstants.TITLE, form.getTitle());
   optionsService.updateOptionValue(OptionConstants.SUBTITLE, form.getSubtitle());
   optionsService.updateOptionValue(OptionConstants.DESCRIPTION, form.getDescription());
   optionsService.updateOptionValue(OptionConstants.KEYWORDS, form.getKeywords());
 }
예제 #4
0
  /**
   * 获取下一篇文章ID,使用select for update 保证id自增
   *
   * @return
   */
  @Transactional
  public String getNextPostid() {
    String currentid = optionsService.getOptionValueForUpdate(OptionConstants.POSTID);
    int id = NumberUtils.toInteger(currentid, PostConstants.INIT_POST_ID);
    id++;
    optionsService.updateOptionValue(OptionConstants.POSTID, id + "");

    return id + "";
  }