@Override public void updateItem(AppboxItem appboxItem, UploadFile img) { AppboxCategory appboxCategory = findCategoryById(appboxItem.getAppboxCategory().getId()); if (appboxCategory == null) throw new ServiceException("appbox.category.is.not.exist"); if (img != null) appboxItem.setImg(uploadImg(img)); appboxItemDao.update(appboxItem); updateRootTime(); }
@Override public Integer addItem(AppboxItem appboxItem, UploadFile img) { AppboxCategory appboxCategory = findCategoryById(appboxItem.getAppboxCategory().getId()); if (appboxCategory == null) throw new ServiceException("appbox.category.is.not.exist"); appboxItem.setPostTime(System.currentTimeMillis()); appboxItem.setMatchTime(0L); appboxItem.setMatchStatue(-1); appboxItem.setImg(uploadImg(img)); Integer id = (Integer) appboxItemDao.save(appboxItem); updateRootTime(); return id; }