package com.xpx.service.impl;

import com.xpx.exception.UsersException;
import com.xpx.mapper.UserMapper;
import com.xpx.pojo.Users;
import com.xpx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Administrator
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public Users userLogin(String username, String pwd) {
        Users users = userMapper.selUserByName(username);
        if(users==null){
            throw new UsersException("用户不存在");
        }else if(!(users.getUserpwd().equals(pwd))){
            throw new UsersException("用户名或密码不正确");
        }
        return users;
    }
}
