/** * 根据bookId修改 * * @param model * @return */ public int Update(Book model) { ContentValues values = new ContentValues(); values = InitialContentValues(model, values); int count = db.update(SchemeCreator.BTNAME, values, "bookId=?", new String[] {model.getBookId()}); return count; }
/** * 初始化ContentValues值 * * @param model * @param values * @return ContentValues */ public ContentValues InitialContentValues(Book model, ContentValues values) { values.put("bookId", model.getBookId()); values.put("thumbnail", model.getThumbnail()); values.put("bookName", model.getBookName()); values.put("author", model.getAuthor()); values.put("pubHouse", model.getPubHouse()); values.put("pubYear", model.getPubYear()); values.put("getNum", model.getGetNum()); values.put("storeNum", model.getStoreNum()); values.put("canBorrow", model.getCanBorrow()); values.put("favorite", model.getFavorite()); values.put("imageUrl", model.getImageUrl()); values.put("ISBN", model.getISBN()); values.put("school", model.getSchool()); values.put("bookType", model.getBookType()); values.put("bookDetailURL", model.getBookDetailURL()); return values; }