| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.core.domain.entity.sysUserInfo; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | |
| | | user.setCreateBy(getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | //写入到 新建立的信息表里面 |
| | | |
| | | ZfFamily zfFamily = zfFamilyService.getByFamId(userAll.getFamilyId()); |
| | | ZInfoUser infoUser = new ZInfoUser(); |
| | | infoUser.setUserId(user.getUserId()); |
| | |
| | | infoUser.setIsMyFamily(userAll.getIsMyFamily()); |
| | | if(userAll.getSpouseId()==0) |
| | | infoUser.setSpouseId(null); |
| | | else |
| | | else { |
| | | infoUser.setSpouseId(userAll.getSpouseId()); |
| | | |
| | | } |
| | | //前端保证了角色不为空 |
| | | if(user.getRoleIds()[0]==102) |
| | | infoUser.setRoleId(3L); |
| | | // infoUser.setRoleName(user.g); |
| | | if(userAll.getFamilyId()!=-1) { |
| | | zInfoUserService.saveOrUpdate(infoUser); |
| | | LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(ZInfoUser::getSpouseId, userAll.getSpouseId()); |
| | | List<ZInfoUser> lis = zInfoUserService.list(lqw); |
| | | if(lis.size()>0) { |
| | | // ZInfoUser zi = new ZInfoUser(); |
| | | // zi.setUserId(userAll.getSpouseId()); |
| | | // // UpdateWrapper wrapper = new UpdateWrapper(); |
| | | // zi.setSpouseId(lis.get(0).getUserId()); |
| | | // System.out.println(userAll.getSpouseId()); |
| | | // System.out.println(lis.get(0).getUserId()); |
| | | zInfoUserService.lambdaUpdate().eq(ZInfoUser::getUserId, userAll.getSpouseId()) |
| | | .set(ZInfoUser::getSpouseId, lis.get(0).getUserId()) |
| | | .update(); |
| | | } |
| | | } |
| | | return toAjax(userService.insertUser(user)); |
| | | } |