private List<String> getAdminPrivs(String companyId) { String privSql = "select priv_id from cp_priv_tab where cp_id=? and is_del='N'"; List<Map<String, Object>> privList = jdbcDao.queryForList(privSql, new Object[] {companyId}); ArrayList<String> privs = new ArrayList<String>(); for (Map<String, Object> map : privList) { privs.add(MapUtils.getString(map, "priv_id")); } privs.add(Environment.ADMIN_PRIV); // admin权限 privs.add(Environment.LOGIN_NO_PRIV); // 登录后可访问 return privs; }
/** * 获取登录用户的权限 * * @param userId * @return */ private List<String> getUserPrivs(String userId) { String privSql = "select priv_id from cp_role_priv_tab where ROLE_ID in(SELECT role_id from cp_user_role_tab where user_id=?)"; List<Map<String, Object>> privList = jdbcDao.queryForList(privSql, new Object[] {userId}); ArrayList<String> privs = new ArrayList<String>(); for (Map<String, Object> map : privList) { privs.add(MapUtils.getString(map, "priv_id")); } privs.add(Environment.LOGIN_NO_PRIV); // 登录后可访问 return privs; }