问答详情
源自:3-11 用户模型管理--用户注册功能实现02

user_info表不能获取到user_passworrd表的id值

https://img2.mukewang.com/5c6a79910001768508880156.jpghttps://img1.mukewang.com/5c6a799d00012d4404920225.jpghttps://img.mukewang.com/5c6a79ac0001d5fa07970310.jpg

user_info表不能获取到user_passworrd表的id值

提问者:qq_罪名_1 2019-02-18 17:25

个回答

  • 慕后端8268368
    2019-07-06 20:12:28

    查看是不是在

    参看是不是在public void register(UserModel userModel) throws BusinessException {方法中缺少userModel.setId(userDO.getId());


  • weixin_慕村3424678
    2019-05-30 12:20:04

    我的代码也是写成了:

    private UserPasswordDO convertPasswordFromModel(UserModel userModel){

            if (userModel == null) {

                return null;

            }

            UserPasswordDO userPasswordDO = new UserPasswordDO();

            userPasswordDO.setEncrptPassword(userModel.getEncrptPassword());

            userPasswordDO.setUserId(userModel.getId());

            return userPasswordDO;

        }


    具体应该是改写成什么样的?多谢你。


  • qq_survival_13158323
    2019-03-09 16:09:47

    //UserPasswordModel转成dataobject
    private UserPasswordDO convertPasswordFromModel(UserModel userModel){
        if (userModel == null){
            return null;
        }
        UserPasswordDO userPasswordDO = new UserPasswordDO();
        userPasswordDO.setEncrptPassword(userModel.getEncrptPassword());
        
        return userPasswordDO;
    }

    检查下这一句,setUserId给密码模型   我原来也是无法将两者id关联,最后发现是把那句代码写成了

    userPasswordDO.setId(userModel.getId());


  • qq_罪名_1
    2019-02-18 17:25:25

    注册没问题