예제 #1
0
 /**
  * 监测用户ID
  *
  * @return
  */
 private boolean noUid() {
   boolean result = TextUtils.isEmpty(uid);
   if (result) {
     log.error(tag, "getCategories 没有传入用户Id!");
   }
   return result;
 }
예제 #2
0
 @Override
 public void updateCategory(Photocategory category) {
   try {
     this.category.update(category);
   } catch (SQLException e) {
     log.setExcetion(tag, e);
   }
 }
예제 #3
0
 public PhotocategoryImpl(Context context) {
   try {
     NfyhCloudDataOpenHelp db = NfyhCloudDataBase.getDataOpenHelp(context);
     this.category = db.getPhotocategory();
   } catch (SQLException e) {
     log.setExcetion(tag, e);
   }
 }
예제 #4
0
 @Override
 public Photocategory getCategory(String id) {
   try {
     return this.category.queryForId(id);
   } catch (SQLException e) {
     log.setExcetion(tag, e);
   }
   return null;
 }
예제 #5
0
 @Override
 public void addCategory(Photocategory category) {
   try {
     // 如果存在则更新
     if (this.category.queryForId(category.getPid()) != null) {
       this.category.update(category);
     } else {
       this.category.create(category);
     }
   } catch (SQLException e) {
     log.setExcetion(tag, e);
   }
 }
예제 #6
0
 @Override
 public List<Photos> getPhotos(String categoryId) {
   if (noUid()) return null;
   try {
     return this.photo
         .queryBuilder()
         .where()
         .eq("_Users_uid", this.uid)
         .and()
         .eq("categoryid", categoryId)
         .query();
   } catch (SQLException e) {
     log.setExcetion(categoryId, e);
     return null;
   }
 }
예제 #7
0
  @Override
  public List<Photocategory> getCategories(String id) {
    if (noUid()) {
      return null;
    }

    Where<Photocategory, String> where = this.category.queryBuilder().where();
    List<Photocategory> datas = null;
    try {

      datas = where.eq("_Users_uid", this.uid).and().eq("parentid", id).query(); // 找子类

      return datas;
    } catch (SQLException e) {
      log.setExcetion(id, e);
      return null;
    }
  }