@Override public int addReadNumsByOne(String id) throws ServiceException { // TODO Auto-generated method stub NoticeModel notice = noticeDAO.get(id); if (notice.getStatus() != 0) { notice.setReadNums(notice.getReadNums() + 1); noticeDAO.saveOrUpdate(notice); } return notice.getReadNums(); }
@Override public void saveNotice(NoticeModel model, String attachmentIds) throws ServiceException { if (StringUtils.isEmpty(model.getId())) model.setPostTime(new Date()); if (model.getLastEditorId() != null) model.setLastEditTime(new Date()); noticeDAO.saveOrUpdate(model); if (StringUtils.isNotEmpty(attachmentIds)) { String[] ids = attachmentIds.split(";"); for (int i = 0; i < ids.length; i++) { AttachmentModel attachment = attachmentDAO.get(ids[i]); attachment.setBelongObject(NoticeModel.class.getSimpleName()); attachment.setBelongObjectId(model.getId()); attachmentDAO.saveOrUpdate(attachment); } } NoticeModel newModel = noticeDAO.get(model.getId()); noticeDAO.merge(newModel); }