use of com.vip.saturn.job.console.mybatis.entity.Role in project Saturn by vipshop.
the class AuthorizationManageServiceImpl method addUserRole.
@Transactional(rollbackFor = Exception.class)
@Override
public void addUserRole(UserRole userRole) throws SaturnJobConsoleException {
validateUser(userRole);
// check role is existing
String roleKey = userRole.getRoleKey();
Role role = roleRepository.selectByKey(roleKey);
if (role == null) {
throw new SaturnJobConsoleException(String.format("角色key(%s)不存在", roleKey));
}
// insert or update userRole
UserRole pre = userRoleRepository.selectWithNotFilterDeleted(userRole);
if (pre == null) {
userRoleRepository.insert(userRole);
} else {
userRoleRepository.update(pre, userRole);
}
}
Aggregations