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;
}