示例#1
0
  public static List<Grouptype> getGroup(User user) {

    List<Grouptype> users = new ArrayList<Grouptype>();
    Connection conn = DB.getConn();
    String sql = "";
    if (UserManager.checkPermissions(user, Group.Manger)) {
      sql = "select * from mdgrouptype ";
    } else {
      sql = "select * from mdgrouptype ";
    }

    Statement stmt = DB.getStatement(conn);
    ResultSet rs = DB.getResultSet(stmt, sql);
    try {
      while (rs.next()) {
        Grouptype g = GrouptypeManager.getGroupFromRs(rs);
        users.add(g);
      }
    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      DB.close(rs);
      DB.close(stmt);
      DB.close(conn);
    }
    return users;
  }
示例#2
0
 public static Grouptype getGrouptype(int id) {
   Grouptype g = new Grouptype();
   Connection conn = DB.getConn();
   String sql = "select * from mdgrouptype where id = " + id;
   Statement stmt = DB.getStatement(conn);
   ResultSet rs = DB.getResultSet(stmt, sql);
   try {
     while (rs.next()) {
       g = GrouptypeManager.getGroupFromRs(rs);
     }
   } catch (SQLException e) {
     e.printStackTrace();
   } finally {
     DB.close(rs);
     DB.close(stmt);
     DB.close(conn);
   }
   return g;
 }