use of com.dimple.project.system.domain.UserRole in project DimpleBlog by martin-chips.
the class UserServiceImpl method insertUserRole.
public void insertUserRole(SysUser user) {
Long[] roles = user.getRoleIds();
if (StringUtils.isNotNull(roles)) {
// 新增用户与角色管理
List<UserRole> list = new ArrayList<>();
for (Long roleId : roles) {
UserRole ur = new UserRole();
ur.setUserId(user.getId());
ur.setRoleId(roleId);
list.add(ur);
}
if (!list.isEmpty()) {
userRoleMapper.batchUserRole(list);
}
}
}