72 98
     public void addPhotoBean(PhotoBean bean){
73
-
99
+        SQLiteDatabase db = null;
100
+        synchronized (DB_LOCK) {
101
+            try {
102
+                db = dbHelper.getWritableDatabase();
103
+                db.beginTransaction();
104
+                db.insertWithOnConflict(DBHelper.PHOTO_INFO_TABLE, null, photoBean2ContentValues(bean),
105
+                        SQLiteDatabase.CONFLICT_REPLACE);
106
+                db.setTransactionSuccessful();
107
+            } catch (Exception e) {
108
+                LogHelper.d(TAG, "dbservice addUploadPhoto error happen " + e);
109
+            } finally {
110
+                try {
111
+                    db.endTransaction();
112
+                } catch (Exception e) {
113
+                    e.printStackTrace();
114
+                }
115
+                closeDB(db);
116
+            }
117
+        }
74 118
     }
75 119
 
76 120
     public void updatePhotoBean(PhotoBean bean){
77
-
121
+        addPhotoBean(bean);
78 122
     }
79 123
 
80 124
     public void deletePhotoBean(PhotoBean bean){
125
+        SQLiteDatabase db = null;
126
+        synchronized (DB_LOCK) {
127
+            try {
128
+                db = dbHelper.getReadableDatabase();
129
+                db.beginTransaction();
130
+                db.execSQL("delete  from " + DBHelper.PHOTO_INFO_TABLE + " where "
131
+                        + DBHelper.PHOTO_INFO_COLUMNS.PHOTO_PATH + " = '" + bean.photoPath + "'");
132
+                db.setTransactionSuccessful();
133
+            } catch (Exception e) {
134
+                LogHelper.d(TAG, "dbservice deleteUploadPhoto error happen " + e);
135
+            } finally {
136
+                try {
137
+                    db.endTransaction();
138
+                } catch (Exception e) {
139
+                    e.printStackTrace();
140
+                }
141
+                closeCursorAndDB(null, db);
142
+            }
143
+        }
144
+    }
145
+
146
+    public ArrayList<SessionBean> getSessionBeanListByDay(){
147
+        ArrayList<SessionBean> sessionBeanArrayList = new ArrayList<>();
148
+        //TODO
81 149
 
150
+        return sessionBeanArrayList;
82 151
     }
83 152
 
84 153
 }

tonglan/adminSystem - Gogs: Go Git Service

1 Commits (e5cdf3254b2e2b3bbece92a66994aef7f62f7a51)

Author SHA1 Message Date
  FFIB 11e3a9652a first 8 years ago