public Integer save(Hotsearch hotsearch, String userName, boolean viewAllDataFunction) { if (!AppUtils.isBlank(hotsearch.getId())) { Hotsearch entity = baseDao.get(Hotsearch.class, hotsearch.getId()); if (entity != null) { if (!viewAllDataFunction && !userName.equals(entity.getUserName())) { throw new RuntimeException("Can't edit Hotsearch does not own to you!"); } entity.setDate(new Date()); entity.setMsg(hotsearch.getMsg()); entity.setTitle(hotsearch.getTitle()); update(entity); return hotsearch.getId(); } return null; } return (Integer) baseDao.save(hotsearch); }
public Hotsearch load(Integer id) { return baseDao.get(Hotsearch.class, id); }