package com.bjsxt.service.impl;

import com.bjsxt.exception.UsersException;
import com.bjsxt.mapper.UsersMapper;
import com.bjsxt.pojo.Users;
import com.bjsxt.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UsersServiceImpl implements UsersService {
    @Autowired
    private UsersMapper usersMapper;
    @Override
    public Users usersLogin(String username, String userpwd) {
        Users users=this.usersMapper.selectUserByName(username);
        if(users==null){
            throw  new UsersException("用户不存在或密码不正确");
        }else  if(!users.getUsername().equals(userpwd)){
            throw new UsersException("用户不存在或密码不正确");
        }
        return users;
    }
}
