package com.sf.mapperTest;


import com.sf.entity.User;
import com.sf.entity.UserProfile;
import com.sf.mapper.UserMapper;
import com.sf.mapper.UserProfileMapper;
import com.sf.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

/**
 * @author WanJl
 * @version 1.0
 * @title UserMapperTest
 * @description
 * @create 2025/11/9
 */
public class UserMapperTest {
    @Test
    public void selectAllTest(){
        SqlSession sqlSession = SqlSessionFactoryUtils.getSqlSession();
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
        List<User> users = userMapper.selectAll();
        users.forEach(System.out::println);
    }
    @Test
    public void selectAllTest2(){
        SqlSession sqlSession = SqlSessionFactoryUtils.getSqlSession();
        UserProfileMapper userProfileMapper = sqlSession.getMapper(UserProfileMapper.class);
        UserProfile userProfile = userProfileMapper.selectByUserId(1);
        System.out.println(userProfile);

    }
}
