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