package com.lotus.mybatis.mapper;
import com.lotus.mybatis.pojo.User;
import com.lotus.mybatis.utils.SqlSessionUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Administrator
* 2024/6/11
*/
public class ParamemterTest {
@Test
public void test1() throws IOException {
SqlSession sqlSession = SqlSessionUtils.getSqlSession();
ParameterMapper mapper = sqlSession.getMapper(ParameterMapper.class);
//UserMapper mapper = sqlSession.getMapper(UserMapper.class);
List<User> allUser = mapper.getAllUser();
allUser.forEach(user-> System.out.println(user));
}
@Test
public void testGetUserByUsername() throws IOException {
SqlSession sqlSession = SqlSessionUtils.getSqlSession();
ParameterMapper mapper = sqlSession.getMapper(ParameterMapper.class);
User user = mapper.getUserByUsername("dizzy");
System.out.println(user);
}
@Test
public void testCheckLogin() throws IOException {
SqlSession sqlSession = SqlSessionUtils.getSqlSession();
ParameterMapper mapper = sqlSession.getMapper(ParameterMapper.class);
User user = mapper.checkLogin("dizzy","12345");
System.out.println(user);
}
@Test
public void testCheckLoginByMap() throws IOException {
SqlSession sqlSession = SqlSessionUtils.getSqlSession();
ParameterMapper mapper = sqlSession.getMapper(ParameterMapper.class);
Map<String,Object> map = new HashMap<>();
map.put("arg0","dizzy");
map.put("arg1","12345");
map.put("param1","dizzy");
map.put("param2","12345");
map.put("username","dizzy");
map.put("password","12345");
User user = mapper.checkLoginByMap(map);
System.out.println(user);
}
@Test
public void testInsertUser() throws IOException {
SqlSession sqlSession = SqlSessionUtils.getSqlSession();
ParameterMapper mapper = sqlSession.getMapper(ParameterMapper.class);
int res = mapper.insertUser(new User(null,"water","123456",11,"男","[email protected]"));
System.out.println(res);
}
@Test
public void testCheckLoginByParam() throws IOException {
SqlSession sqlSession = SqlSessionUtils.getSqlSession();
ParameterMapper mapper = sqlSession.getMapper(ParameterMapper.class);
User user = mapper.checkLoginByParam("water","123456");
System.out.println(user);
}
}

丢爸
- 粉丝: 1342
最新资源
- 真的醉了,为什么大厂面试官这么喜欢-剑指-offer!-LeetCode-它不香吗?.docx
- 真香警告!Alibaba珍藏版Android框架体系架构手写文档,刷起来.docx
- 直接拿来用!最火的Android开源项目(一).docx
- 基于Matlab实现牛顿拉夫逊法解潮流计算(源码+详细注释).rar
- 如何在 Vue.config.js 中配置处理 static 文件夹静态文件
- 高速内核引擎的桌面浏览器!简洁/干净/安全/保护隐私/好用的浏览器
- 如何为图腾柱PFC减少AC过零点上的电流尖峰
- 基于热管理优化的双充电器系统设计:便携式电子设备高效充电方案
- ESP8266 ESP-01单路继电器模块Arduino程序烧录
- sentinel-dashboard-1.8.6-nacos.jar 规则持久化到nacos配置中心
- 录屏软件国内最好用的录屏工具 操作简单 功能强大 一键录制高清视频
- 两款不同版SEO超级外链工具PHP源码.zip
- 双色球随机生成器.zip
- 文字点选验证码数据集(图片和json标注文件).rar
- 域名展示.zip
- 在线客服系统.rar