@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()); }
@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()); }
/** * 更新网站基础设置,同时更新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()); }
/** * 获取下一篇文章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 + ""; }