Java Code Examples for org.apache.ibatis.reflection.MetaObject#getGetterNames()

The following examples show how to use org.apache.ibatis.reflection.MetaObject#getGetterNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Example.java    From tk-mybatis with MIT License 6 votes vote down vote up
/**
 * 将此对象的不为空的字段参数作为相等查询条件
 *
 * @param param 参数对象
 * @author Bob {@link}[email protected]
 * @Date 2015年7月17日 下午12:48:08
 */
public Criteria andEqualTo(Object param) {
    MetaObject metaObject = SystemMetaObject.forObject(param);
    String[] properties = metaObject.getGetterNames();
    for (String property : properties) {
        //属性和列对应Map中有此属性
        if (propertyMap.get(property) != null) {
            Object value = metaObject.getValue(property);
            //属性值不为空
            if (value != null) {
                andEqualTo(property, value);
            }
        }
    }
    return (Criteria) this;
}
 
Example 2
Source File: Example.java    From tk-mybatis with MIT License 6 votes vote down vote up
/**
 * 将此对象的所有字段参数作为相等查询条件,如果字段为 null,则为 is null
 *
 * @param param 参数对象
 */
public Criteria andAllEqualTo(Object param) {
    MetaObject metaObject = SystemMetaObject.forObject(param);
    String[] properties = metaObject.getGetterNames();
    for (String property : properties) {
        //属性和列对应Map中有此属性
        if (propertyMap.get(property) != null) {
            Object value = metaObject.getValue(property);
            //属性值不为空
            if (value != null) {
                andEqualTo(property, value);
            } else {
                andIsNull(property);
            }
        }
    }
    return (Criteria) this;
}
 
Example 3
Source File: Example.java    From Mapper with MIT License 6 votes vote down vote up
/**
 * 将此对象的不为空的字段参数作为相等查询条件
 *
 * @param param 参数对象
 * @author Bob {@link}[email protected]
 * @Date 2015年7月17日 下午12:48:08
 */
public Criteria andEqualTo(Object param) {
    if(param == null){
        return (Criteria) this;
    }
    MetaObject metaObject = MetaObjectUtil.forObject(param);
    String[] properties = metaObject.getGetterNames();
    for (String property : properties) {
        //属性和列对应Map中有此属性
        if (propertyMap.get(property) != null) {
            Object value = metaObject.getValue(property);
            //属性值不为空
            if (value != null) {
                andEqualTo(property, value);
            }
        }
    }
    return (Criteria) this;
}
 
Example 4
Source File: Example.java    From Mapper with MIT License 6 votes vote down vote up
/**
 * 将此对象的所有字段参数作为相等查询条件,如果字段为 null,则为 is null
 *
 * @param param 参数对象
 */
public Criteria andAllEqualTo(Object param) {
    MetaObject metaObject = MetaObjectUtil.forObject(param);
    String[] properties = metaObject.getGetterNames();
    for (String property : properties) {
        //属性和列对应Map中有此属性
        if (propertyMap.get(property) != null) {
            Object value = metaObject.getValue(property);
            //属性值不为空
            if (value != null) {
                andEqualTo(property, value);
            } else {
                andIsNull(property);
            }
        }
    }
    return (Criteria) this;
}
 
Example 5
Source File: Example.java    From Mapper with MIT License 6 votes vote down vote up
/**
 * 将此对象的不为空的字段参数作为相等查询条件
 *
 * @param param 参数对象
 * @author Bob {@link}[email protected]
 * @Date 2015年7月17日 下午12:48:08
 */
public Criteria orEqualTo(Object param) {
    MetaObject metaObject = MetaObjectUtil.forObject(param);
    String[] properties = metaObject.getGetterNames();
    for (String property : properties) {
        //属性和列对应Map中有此属性
        if (propertyMap.get(property) != null) {
            Object value = metaObject.getValue(property);
            //属性值不为空
            if (value != null) {
                orEqualTo(property, value);
            }
        }
    }
    return (Criteria) this;
}
 
Example 6
Source File: Example.java    From Mapper with MIT License 6 votes vote down vote up
/**
 * 将此对象的所有字段参数作为相等查询条件,如果字段为 null,则为 is null
 *
 * @param param 参数对象
 */
public Criteria orAllEqualTo(Object param) {
    MetaObject metaObject = MetaObjectUtil.forObject(param);
    String[] properties = metaObject.getGetterNames();
    for (String property : properties) {
        //属性和列对应Map中有此属性
        if (propertyMap.get(property) != null) {
            Object value = metaObject.getValue(property);
            //属性值不为空
            if (value != null) {
                orEqualTo(property, value);
            } else {
                orIsNull(property);
            }
        }
    }
    return (Criteria) this;
}