Example #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);
 }
Example #2
0
 public Hotsearch load(Integer id) {
   return baseDao.get(Hotsearch.class, id);
 }