org.jeecg.common.util.ReflectHelper Java Examples

The following examples show how to use org.jeecg.common.util.ReflectHelper. 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: DynamicDBUtil.java    From jeecg-cloud with Apache License 2.0 2 votes vote down vote up
/**
 * 直接sql查询 根据clazz返回单个实例
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句
 * @param clazz 返回实例的Class
 * @param param
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Object findOne(final String dbKey, String sql, Class<T> clazz, Object... param) {
    Map<String, Object> map = (Map<String, Object>) findOne(dbKey, sql, param);
    return ReflectHelper.setAll(clazz, map);
}
 
Example #2
Source File: DynamicDBUtil.java    From jeecg-cloud with Apache License 2.0 2 votes vote down vote up
/**
 * 支持miniDao语法操作的查询 返回单个实例
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持minidao语法逻辑
 * @param clazz 返回实例的Class
 * @param data  sql语法中需要判断的数据及sql拼接注入中需要的数据
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Object findOneByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
    Map<String, Object> map = (Map<String, Object>) findOneByHash(dbKey, sql, data);
    return ReflectHelper.setAll(clazz, map);
}
 
Example #3
Source File: DynamicDBUtil.java    From jeecg-cloud with Apache License 2.0 2 votes vote down vote up
/**
 * 直接sql查询 返回实体类列表
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持 minidao 语法逻辑
 * @param clazz 返回实体类列表的class
 * @param param sql拼接注入中需要的数据
 * @return
 */
public static <T> List<T> findListEntities(final String dbKey, String sql, Class<T> clazz, Object... param) {
    List<Map<String, Object>> queryList = findList(dbKey, sql, param);
    return ReflectHelper.transList2Entrys(queryList, clazz);
}
 
Example #4
Source File: DynamicDBUtil.java    From jeecg-cloud with Apache License 2.0 2 votes vote down vote up
/**
 * 支持miniDao语法操作的查询 返回实体类列表
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持minidao语法逻辑
 * @param clazz 返回实体类列表的class
 * @param data  sql语法中需要判断的数据及sql拼接注入中需要的数据
 * @return
 */
public static <T> List<T> findListEntitiesByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
    List<Map<String, Object>> queryList = findListByHash(dbKey, sql, data);
    return ReflectHelper.transList2Entrys(queryList, clazz);
}
 
Example #5
Source File: DynamicDBUtil.java    From teaching with Apache License 2.0 2 votes vote down vote up
/**
 * 直接sql查询 根据clazz返回单个实例
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句
 * @param clazz 返回实例的Class
 * @param param
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Object findOne(final String dbKey, String sql, Class<T> clazz, Object... param) {
    Map<String, Object> map = (Map<String, Object>) findOne(dbKey, sql, param);
    return ReflectHelper.setAll(clazz, map);
}
 
Example #6
Source File: DynamicDBUtil.java    From teaching with Apache License 2.0 2 votes vote down vote up
/**
 * 支持miniDao语法操作的查询 返回单个实例
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持minidao语法逻辑
 * @param clazz 返回实例的Class
 * @param data  sql语法中需要判断的数据及sql拼接注入中需要的数据
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Object findOneByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
    Map<String, Object> map = (Map<String, Object>) findOneByHash(dbKey, sql, data);
    return ReflectHelper.setAll(clazz, map);
}
 
Example #7
Source File: DynamicDBUtil.java    From teaching with Apache License 2.0 2 votes vote down vote up
/**
 * 直接sql查询 返回实体类列表
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持 minidao 语法逻辑
 * @param clazz 返回实体类列表的class
 * @param param sql拼接注入中需要的数据
 * @return
 */
public static <T> List<T> findListEntities(final String dbKey, String sql, Class<T> clazz, Object... param) {
    List<Map<String, Object>> queryList = findList(dbKey, sql, param);
    return ReflectHelper.transList2Entrys(queryList, clazz);
}
 
Example #8
Source File: DynamicDBUtil.java    From teaching with Apache License 2.0 2 votes vote down vote up
/**
 * 支持miniDao语法操作的查询 返回实体类列表
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持minidao语法逻辑
 * @param clazz 返回实体类列表的class
 * @param data  sql语法中需要判断的数据及sql拼接注入中需要的数据
 * @return
 */
public static <T> List<T> findListEntitiesByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
    List<Map<String, Object>> queryList = findListByHash(dbKey, sql, data);
    return ReflectHelper.transList2Entrys(queryList, clazz);
}
 
Example #9
Source File: DynamicDBUtil.java    From jeecg-boot with Apache License 2.0 2 votes vote down vote up
/**
 * 直接sql查询 根据clazz返回单个实例
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句
 * @param clazz 返回实例的Class
 * @param param
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Object findOne(final String dbKey, String sql, Class<T> clazz, Object... param) {
    Map<String, Object> map = (Map<String, Object>) findOne(dbKey, sql, param);
    return ReflectHelper.setAll(clazz, map);
}
 
Example #10
Source File: DynamicDBUtil.java    From jeecg-boot with Apache License 2.0 2 votes vote down vote up
/**
 * 支持miniDao语法操作的查询 返回单个实例
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持minidao语法逻辑
 * @param clazz 返回实例的Class
 * @param data  sql语法中需要判断的数据及sql拼接注入中需要的数据
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Object findOneByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
    Map<String, Object> map = (Map<String, Object>) findOneByHash(dbKey, sql, data);
    return ReflectHelper.setAll(clazz, map);
}
 
Example #11
Source File: DynamicDBUtil.java    From jeecg-boot with Apache License 2.0 2 votes vote down vote up
/**
 * 直接sql查询 返回实体类列表
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持 minidao 语法逻辑
 * @param clazz 返回实体类列表的class
 * @param param sql拼接注入中需要的数据
 * @return
 */
public static <T> List<T> findListEntities(final String dbKey, String sql, Class<T> clazz, Object... param) {
    List<Map<String, Object>> queryList = findList(dbKey, sql, param);
    return ReflectHelper.transList2Entrys(queryList, clazz);
}
 
Example #12
Source File: DynamicDBUtil.java    From jeecg-boot with Apache License 2.0 2 votes vote down vote up
/**
 * 支持miniDao语法操作的查询 返回实体类列表
 *
 * @param dbKey 数据源标识
 * @param sql   执行sql语句,sql支持minidao语法逻辑
 * @param clazz 返回实体类列表的class
 * @param data  sql语法中需要判断的数据及sql拼接注入中需要的数据
 * @return
 */
public static <T> List<T> findListEntitiesByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
    List<Map<String, Object>> queryList = findListByHash(dbKey, sql, data);
    return ReflectHelper.transList2Entrys(queryList, clazz);
}