public void update(NotificationData notificationData) {
   // 开启事务
   db.beginTransaction();
   try {
     ContentValues values = new ContentValues();
     values.put("isread", notificationData.getIsead());
     db.update(
         "stutb",
         values,
         "AlarmId=?",
         new String[] {notificationData.getAlarmId()}); // 将全部id>3的人的性别改成女
     db.setTransactionSuccessful();
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     db.endTransaction();
   }
 }
  public void delete(NotificationData notificationData) {

    // 开启事务
    db.beginTransaction();
    try {
      db.delete("stutb", "AlarmId=?", new String[] {notificationData.getAlarmId()}); // 删除所有名字中带有丰的人
      db.setTransactionSuccessful();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      db.endTransaction();
    }
  }
 public ArrayList<NotificationData> query() {
   ArrayList<NotificationData> array = new ArrayList<NotificationData>();
   Cursor c = db.query("stutb", null, null, null, null, null, null);
   if (c != null) {
     while (c.moveToNext()) {
       NotificationData a = new NotificationData();
       a.setAlarmId(c.getString(c.getColumnIndex("AlarmId")));
       a.setUserName(c.getString(c.getColumnIndex("UserName")));
       a.setAlarmType(Integer.parseInt(c.getString(c.getColumnIndex("AlarmType"))));
       a.setPriorityLevel(Integer.parseInt(c.getString(c.getColumnIndex("PriorityLevel"))));
       a.setArea(c.getString(c.getColumnIndex("Area")));
       a.setCreateTime(c.getString(c.getColumnIndex("CreateTime")));
       a.setIsead(c.getString(c.getColumnIndex("isRead")));
       array.add(a);
     }
     c.close();
   }
   return array;
 }
 public void insert(NotificationData notificationData) {
   // 开启事务
   db.beginTransaction();
   try {
     ContentValues values = new ContentValues();
     values.put("AlarmId", notificationData.getAlarmId());
     values.put("UserName", notificationData.getUserName());
     values.put("AlarmType", String.valueOf(notificationData.getAlarmType()));
     values.put("PriorityLevel", String.valueOf(notificationData.getPriorityLevel()));
     values.put("Area", notificationData.getArea());
     values.put("CreateTime", notificationData.getCreateTime());
     values.put("isRead", notificationData.getIsead());
     db.insert("stutb", null, values);
     db.setTransactionSuccessful();
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     db.endTransaction();
   }
 }