其他分享
首页 > 其他分享> > mybatis-plus

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")

标签:Mapper,String,BaseMapper,private,plus,mybatis,public
来源: https://www.cnblogs.com/upupup-999/p/15779837.html