Пример #1
0
 private void updateAdminRole(Integer id, Set<Role> roles) {
   StringBuilder sql = new StringBuilder("insert into sys_admin_role values ");
   for (Role role : roles) {
     sql.append('(').append(id).append(',').append(role.getId()).append("),");
   }
   String strSql = sql.toString();
   dbo.update(strSql.substring(0, sql.length() - 1));
 }
Пример #2
0
 private void setAdminRoles(Integer id, Admin admin) {
   List<Integer> list = dbo.queryForList(FIND_ADMIN_ROLE, Integer.class, id);
   Set<Role> roles = Sets.newHashSet();
   Role role = null;
   for (Integer roleId : list) {
     role = new Role();
     role.setId(roleId);
     roles.add(role);
   }
   admin.setRoles(roles);
 }