在这里插入代码片package com.bjsxt.service.impl;
import com.bjsxt.Employee;
import com.bjsxt.controller.UserServlet;
import com.bjsxt.mapper.UserMapper;
import org.apache.ibatis.session.SqlSessionFactory;
public class UserServicelmpl implements UserServlet {
//用户登录
@Override
public Employee empLoginService(String empid,String password){
//获取sqlSession对象 Resources 资源 该方法用于获取mybatis.xml中的数据
InputStream is = Resources.getResourceAsStream("mybatis.xml");
SqlSessionFactory factory = new SqlSessionFactoryBuilder();
//获取Mapper接口实例化对象
UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
return userMapper.empLoginMapper(empid,password);
}
}
返回从数据库查询对应账号的密码