Пример #1
0
 @Override
 public DataGrid datagrid(Role role) {
   DataGrid dg = new DataGrid();
   String hql = "from Trole t ";
   Map<String, Object> params = new HashMap<String, Object>();
   hql = addWhere(role, hql, params);
   String totalHql = "select count(*) " + hql;
   hql = addOrder(role, hql);
   List<Trole> l = roleDao.find(hql, params, role.getPage(), role.getRows());
   List<Role> nl = new ArrayList<Role>();
   changeModel(l, nl);
   dg.setTotal(roleDao.count(totalHql, params));
   dg.setRows(nl);
   return dg;
 }
Пример #2
0
 @Override
 public DataGrid datagrid(User user) {
   DataGrid dg = new DataGrid();
   String hql = "from Tuser t ";
   Map<String, Object> params = new HashMap<String, Object>();
   hql = addWhere(user, hql, params);
   String totalHql = "select count(*) " + hql;
   hql = addOrder(user, hql);
   List<Tuser> l = userDao.find(hql, params, user.getPage(), user.getRows());
   List<User> nl = new ArrayList<User>();
   changeModel(l, nl);
   dg.setTotal(userDao.count(totalHql, params));
   dg.setRows(nl);
   return dg;
 }