mybatis-plus

1.导入依赖

<!--mybatis-plus-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.0.5</version>
        </dependency>

2.实体类

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {


        private Long id;

        private String name;

        private Integer age;

        private String email;

}

 

 

 

3.写一个继承了 BaseMapper  的类

@Repository
@Mapper
public interface UserMapper extends BaseMapper<User> {


}

4.可以在mapper类上加@Mapper注解或者在主启动类上加扫描包

@MapperScan("com.wang.dao")

上一篇:mybatis plus条件构造器


下一篇:【Mybatis-Plus进阶学习(八)】SQL注入器