public interface IOneDAO extends IBaseDAO<Void> {
void batchDeleteLoactionInfo(Integer[] ids);
List<Void> queryByFmeId(String fmeId);
}
public class OneDAO extends BaseDAO<Void> implements
IOneDAO {
// 表名
private static final String TABLE_NAME = "ONE";
// 列名
private static final String[] COLUMNS = new String[] { };
public OneDAO(SQLiteDatabase db) {
super(db, TABLE_NAME, COLUMNS, new OneBaseTransition());
}
private static class OneBaseTransition implements
BaseTransition<Void> {
@Override
public ContentValues fromModelToContentValues(Void t) {
ContentValues values = new ContentValues();
// .......
return values;
}
@Override
public List<Void> fromCursorToModel(Cursor cursor) {
List<Void> list = new ArrayList<Void>();
// .......
cursor.close();
return list;
}
@Override
public int getIdFromModel(Void t) {
return 0;
// return t.getId();
}
}
@Override
public void batchDeleteLoactionInfo(Integer[] ids) {
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < ids.length; i++) {
stringBuffer.append(ids[i]).append(",");
}
stringBuffer.deleteCharAt(stringBuffer.length() - 1);
String sql = "delete from ONE where _ID in ("
+ stringBuffer.toString() + ")";
db.execSQL(sql);
}
@Override
public List<Void> queryByFmeId(String fmeId) {
return super.queryForList("USER_NAME = ? ",
new String[] { fmeId });
}
}
baseService.doBusinessWithWritable(new CallBack<Integer>() {
@Override
public Integer doCallBack() {
oneDao = new OneDAO(baseService.getDatabase());
Set<Integer> idSet = new HashSet<Integer>();
for (OneVO temp : oneList) {
idSet.add(temp.getId());
}
if (idSet.size() > 0) {
oneDao.batchDeleteLoactionInfo(idSet
.toArray(new Integer[] {}));
}
return SUCCESS;
}
}, null);