初识Mybatis-Plus

本文介绍了Mybatis-Plus的环境配置,包括pom.xml、spring配置和数据库设置,展示了如何进行插入、更新、查询、分页和逻辑删除等基本操作。同时,提到了日志打印、条件构造器、时间填充以及代码生成器的使用,帮助读者快速上手Mybatis-Plus。
摘要由CSDN通过智能技术生成

Mybatis-plus

Mybatis-plus不是官方的,而是别人扩展的
官网

而且是有中国人开发的,所以文档什么很容易看,下面的内容都可以查看官网,有更详细的解答。

(在个人练习中,version也就是乐观锁那一块起不了效果,如果以后解决了再回来更改)

环境配置

因为mybatis-plus是数据库的操作,所以我们需要先配置以下mysql的环境:

CREATE TABLE USER(
id INT NOT NULL,
NAME VARCHAR(20) DEFAULT NULL
)

然后就是往里面添加一些数据。

然后结合Springboot一起使用,所以引入springboot web场景。

pom.xml环境配置

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    
    <dependencies>
        <!--mysql-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <!--lombok-->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

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

        <!--springboot web环境-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值