public < S extends Model > int updateByModel ( S model ) { this . beforeCheck ( ) ; Object primaryKey = AnimaUtils . getAndRemovePrimaryKey ( model ) ; StringBuilder sql = new StringBuilder ( this . buildUpdateSQL ( model , null ) ) ; List < Object > columnValueList = AnimaUtils . toColumnValues ( model , false ) ; ifNotNullThen ( primaryKey , ( ) -> { sql . append ( " WHERE " ) . append ( this . primaryKeyColumn ) . append ( " = ?" ) ; columnValueList . add ( primaryKey ) ; } ) ; return this . execute ( sql . toString ( ) , columnValueList ) ; }
Update a model