public AnimaQuery < T > where ( T model ) { Field [ ] declaredFields = model . getClass ( ) . getDeclaredFields ( ) ; for ( Field declaredField : declaredFields ) { Object value = AnimaUtils . invokeMethod ( model , getGetterName ( declaredField . getName ( ) ) , AnimaUtils . EMPTY_ARG ) ; if ( null == value ) { continue ; } if ( declaredField . getType ( ) . equals ( String . class ) && AnimaUtils . isEmpty ( value . toString ( ) ) ) { continue ; } String columnName = AnimaCache . getColumnName ( declaredField ) ; this . where ( columnName , value ) ; } return this ; }
Set the where parameter according to model and generate sql like where where age = ? and name = ?