コード例 #1
0
 /**
  * @param userid
  * @return 根据id获取对象
  */
 public Object getById(String userid) {
   String hql = "from Org_User where id = " + userid;
   List<Object> objects = baseDao.listObjectsByHql(hql, null);
   if (objects != null && objects.size() > 0) {
     return objects.get(0);
   }
   return null;
 }
コード例 #2
0
  /**
   * @param args
   * @return 列出查询信息
   */
  public List<Org_User> listUsers(Map<String, String> map) {

    List<Object> objects = new ArrayList<Object>();
    List<Org_User> list = new ArrayList<Org_User>();
    String hql = "from " + map.get("model").toString() + " where 1=1";
    if (map.containsKey("orgId")) {
      hql += " and orgId = " + map.get("orgId").toString();
    }
    objects = baseDao.listObjectsByHql(hql, map);
    for (Object object : objects) {
      Org_User org_User = (Org_User) object;
      list.add(org_User);
    }
    return list;
  }