Java Code Examples for com.jfinal.plugin.activerecord.Record#get()

The following examples show how to use com.jfinal.plugin.activerecord.Record#get() . 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: JsonUtils.java    From my_curd with Apache License 2.0 6 votes vote down vote up
/**
 * Record转为Map,驼峰命名
 *
 * @param record
 * @return
 */
public static Map<String, Object> recordToCamelCaseMap(Record record) {
    if (null == record) {
        return null;
    }
    String[] keys = record.getColumnNames();
    Map<String, Object> map = new HashMap<>();
    for (String key : keys) {
        Object value = record.get(key);
        key = StrKit.toCamelCase(key.toLowerCase());
        if (null != value) {
            map.put(key, value);
        }
    }
    return map;
}
 
Example 2
Source File: ModelExt.java    From jfinal-ext3 with Apache License 2.0 5 votes vote down vote up
/**
 * Data Count
 */
public Long dataCount() {
	SqlPara sql = SqlpKit.select(this, "count(*) AS cnt");
	Record record = Db.findFirst(sql);
	if (null != record) {
		return record.get("cnt");
	}
	return 0L;
}
 
Example 3
Source File: SysUserDao.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
public List<String> queryAllPerms(Long userId) {
    SqlPara sqlPara = Db.getSqlPara("sysUser.queryAllPerms", Kv.by("userId", userId));
    List<Record> sysUserList = Db.find(sqlPara);
    List<String> perms = new ArrayList<>();
    for (Record r:sysUserList
         ) {
        if(r == null || r.get("perms") == null) {
            continue;
        }
        perms.add(r.get("perms"));
    }

    return perms;
}
 
Example 4
Source File: SysUserDao.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
public List<Long> queryAllMenuId(Long userId) {
    SqlPara sqlPara = Db.getSqlPara("sysUser.queryAllMenuId", Kv.by("userId", userId));
    List<Record> sysMenuList = Db.find(sqlPara);
    List<Long> menuIds = new ArrayList<>();
    for (Record r:sysMenuList
         ) {
        if(r == null || r.get("menu_id") == null) {
            continue;
        }
        menuIds.add(r.get("menu_id"));
    }

    return menuIds;
}