Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 public PageSupport getDataByCriteriaQuery(CriteriaQuery cq) {
   return baseDao.find(cq);
 }
Exemplo n.º 4
0
 public void update(Hotsearch hotsearch) {
   baseDao.update(hotsearch);
 }
Exemplo n.º 5
0
 public void delete(Integer id) {
   baseDao.deleteById(Hotsearch.class, id);
 }
Exemplo n.º 6
0
 public Hotsearch load(Integer id) {
   return baseDao.get(Hotsearch.class, id);
 }
Exemplo n.º 7
0
 public List<Hotsearch> list(String userName) {
   return baseDao.findByHQL("from Hotsearch where userName = ?", new Object[] {userName});
 }