问答详情
源自:3-1 使用SpringMVC方式开发用户信息

我找不到那些set get 但是每次都是跟着老师来的


package com.miaoshaproject.service.impl;


import com.miaoshaproject.dao.UserDOMapper;
import com.miaoshaproject.dao.UserPasswordDOMapper;
import com.miaoshaproject.dataobject.UserDO;
import com.miaoshaproject.dataobject.UserPasswordDO;
import com.miaoshaproject.service.UserService;
import com.miaoshaproject.service.model.UserModel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDOMapper userDOMapper;
//    private Object UserPasswordDO;
//    private Object UserDO;

    @Autowired
    private UserPasswordDOMapper userPasswordDOMapper;


    @Override
    public UserModel getUserById(Integer id) {
        //调用userDOMapper获取用户的dataobject
        UserDO userDO = userDOMapper.selectByPrimaryKey(id);

        UserPasswordDO userPasswordDO = userPasswordDOMapper.selectByUserId(userDO,getId());
    }

    private UserModel convertFromDataObject(UserDO, UserPasswordDO){
        if (UserDO == null){
            return null;
        }
        UserModel userModel = new UserModel();
        BeanUtils.copyProperties(UserDO,userModel);

        if (UserPasswordDO != null) {
            userModel.setEncrptPassword(UserPasswordDO, userModel.getEncrptPassword());
        }

        return userModel;
    }


提问者:雨啊 2019-12-31 14:06
微课

个回答

  • 慕丝0231718
    2020-03-13 11:17:53

    问题描述可否清晰一点,什么叫找不到get,set?