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, String userName) { List<Hotsearch> list = baseDao .getHibernateTemplate() .find("from Hotsearch where id = ? and userName = ?", id, userName); if (AppUtils.isBlank(list)) { throw new RuntimeException("no record"); } return list.get(0); }
public PageSupport getDataByCriteriaQuery(CriteriaQuery cq) { return baseDao.find(cq); }
public void update(Hotsearch hotsearch) { baseDao.update(hotsearch); }
public void delete(Integer id) { baseDao.deleteById(Hotsearch.class, id); }
public Hotsearch load(Integer id) { return baseDao.get(Hotsearch.class, id); }
public List<Hotsearch> list(String userName) { return baseDao.findByHQL("from Hotsearch where userName = ?", new Object[] {userName}); }