MybatisPlus的使用步骤

MybatisPlus使用步骤

1.导入MybatisPlus坐标

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

2.在配置文件中配置mapper映射路径

# 应用名称
spring.application.name=springboot_test03
# 应用服务 WEB 访问端口
server.port=18082
#下面这些内容是为了让MyBatis映射
#指定Mybatis的Mapper文件
#mybatis.mapper-locations=classpath:mappers/*xml
mybatis-plus.mapper-locations=classpath:mappers/*xml

#指定Mybatis的实体目录
mybatis.type-aliases-package=com.xyh.mybatis.entity
# 数据库驱动:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# 数据源名称
spring.datasource.name=defaultDataSource
# 数据库连接地址
spring.datasource.url=jdbc:mysql://localhost:3306/springboot?serverTimezone=UTC
# 数据库用户名&密码:
spring.datasource.username=root
spring.datasource.password=xyh123

#pagehelper分页插件配置
pagehelper.helper-dialect=mysql
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true
pagehelper.params=count=countSql

logging.level.com.xyh:debug

3.在dao层去继承BaseMapper

@Mapper
public interface QuotationDao extends BaseMapper<QuotationQueryPageFansVo> {
//    分页查询
    List<QuotationQueryPageFansVo> queryPage(QuotationQueryPageVo quotationQueryPageVo);

}

4.内部提供了很多简单的sql语句,复杂的还是需要我们手动写

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值