Search in sources :

Example 1 with UserRoleEntity

use of com.hb0730.boot.admin.project.system.user.model.entity.UserRoleEntity in project boot-admin by hb0730.

the class UserRoleServiceImpl method saveBatch.

private void saveBatch(@Nonnull Long userId, @Nonnull Collection<Long> roleIds) {
    Assert.notNull(userId, "用户id为空");
    Assert.notEmpty(roleIds, "角色id为空");
    List<UserRoleEntity> entities = new ArrayList<>(roleIds.size());
    for (Long roleId : roleIds) {
        UserRoleEntity entity = new UserRoleEntity();
        entity.setUserId(userId);
        entity.setRoleId(roleId);
        entities.add(entity);
    }
    saveBatch(entities);
}
Also used : UserRoleEntity(com.hb0730.boot.admin.project.system.user.model.entity.UserRoleEntity) ArrayList(java.util.ArrayList)

Aggregations

UserRoleEntity (com.hb0730.boot.admin.project.system.user.model.entity.UserRoleEntity)1 ArrayList (java.util.ArrayList)1