|
@@ -55,13 +55,14 @@ public class MtCompanyUserService extends ServiceImpl<MtCompanyUserMapper, MtCom
|
|
|
//保存用户角色关联信息
|
|
|
Long roleId = mtCompanyUserRequest.getRoleId();
|
|
|
Long userId = mtCompanyUser.getUserId();
|
|
|
+ Long companyId = mtCompanyUser.getMtCompanyId();
|
|
|
if(roleId != null){
|
|
|
UserRole userRole = userRoleService.getOne(new QueryWrapper<UserRole>()
|
|
|
- .eq("role_id", roleId)
|
|
|
+ .eq("company_id", companyId)
|
|
|
.eq("user_id", userId)
|
|
|
);
|
|
|
if (userRole != null) {
|
|
|
- //1.删除原有的关联关系
|
|
|
+ //删除原有的关联关系
|
|
|
boolean deleteUserRoleFlag = userRoleService.removeById(userRole.getId());
|
|
|
if (!deleteUserRoleFlag) {
|
|
|
return RestResponse.fail(ApiConstants.RESULT_ERROR, "删除原有关联关系失败");
|
|
@@ -69,7 +70,7 @@ public class MtCompanyUserService extends ServiceImpl<MtCompanyUserMapper, MtCom
|
|
|
}
|
|
|
//保存新的关联关系
|
|
|
userRole = new UserRole();
|
|
|
- userRole.setCompanyId(mtCompanyUser.getMtCompanyId());
|
|
|
+ userRole.setCompanyId(companyId);
|
|
|
userRole.setRoleId(roleId);
|
|
|
userRole.setUserId(userId);
|
|
|
userRoleService.save(userRole);
|