package com.example.monitorpatientstatus.mapper;

import com.example.monitorpatientstatus.entity.Drug;
import com.example.monitorpatientstatus.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

public class DrugMapperTest {
    @Test
    public void test(){
        //第一步获得sqlSession对象
        SqlSession sqlSession= MybatisUtils.getSqlSession();
        //执行sql
        DrugMapper drugMapper=sqlSession.getMapper(DrugMapper.class);
        List<Drug> drugs=drugMapper.findAll();
        for (Drug drug:drugs){
            System.out.println(drug);
        }
        //关闭session
        sqlSession.close();

    }
}
