1.pom.xml
<!-- mybatisPlus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>2.3</version>
</dependency>
2.实体类
@Data
@TableName("student")
public class Student {
@TableId(value = "sid", type = IdType.AUTO)
private Integer sid;
@TableField("name")
private String name;
private Integer age;
}
3.mapper
public interface StudentMapper extends BaseMapper<Student> {
}
4.测试类
@SpringBootTest
@RunWith(SpringRunner.class)
public class TestStudent {
@Resource
private StudentMapper studentMapper;
@Test
public void test(){
List<Student> list = studentMapper.selectList(null);
list.forEach(System.out::println);
}
}
标签:基本,studentMapper,private,public,sid,Integer,用法,class
From: https://www.cnblogs.com/lwx11111/p/16847269.html