Java Code Examples for com.jfinal.plugin.activerecord.Record#getStr()
The following examples show how to use
com.jfinal.plugin.activerecord.Record#getStr() .
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: TreeTableUtils.java From my_curd with Apache License 2.0 | 6 votes |
/** * 查询某节点子孙树节点 * @param rootId 根id * @param tableName 数据表名 * @param idFieldName id 字段 * @param pidFieldName pid 字段名 * @return */ public static String getSonTreeIds(String rootId, String tableName, String idFieldName, String pidFieldName) { String sTemp = "$"; String sTempChd = rootId; Record recordTemp; while (sTempChd != null) { sTemp = sTemp.concat(",").concat(sTempChd); recordTemp = Db.findFirst("SELECT group_concat(" + idFieldName + ") as sTempChd FROM " + tableName + " where FIND_IN_SET(" + pidFieldName + ",'" + sTempChd + "')>0;"); if (recordTemp == null) { sTempChd = null; } else { sTempChd = recordTemp.getStr("sTempChd"); } } return sTemp.replaceAll("\\$,", ""); }
Example 2
Source File: SysUserRole.java From my_curd with Apache License 2.0 | 5 votes |
/** * 通过用户id 查询 角色id * * @param userId * @return */ public String findRoleIdsByUserId(String userId) { String sql = " select GROUP_CONCAT(c.id) as roleIds" + " from sys_user a, sys_user_role b,sys_role c " + " where a.id = b.sysUserId and b.sysRoleId = c.id and a.id = ? "; Record record = Db.findFirst(sql, userId); return record.getStr("roleIds"); }
Example 3
Source File: SysUserRole.java From my_curd with Apache License 2.0 | 5 votes |
/** * 通过用户查询角色编码 * * @param userId * @return */ public String findRoleCodesByUserId(String userId) { String sql = "select GROUP_CONCAT(c.roleCode) as roleCodes" + " from sys_user a, sys_user_role b,sys_role c " + " where a.id = b.sysUserId and b.sysRoleId = c.id and a.id = ? "; Record record = Db.findFirst(sql, userId); return record.getStr("roleCodes"); }