首页 > 编程语言 > 详细

Springboot集成mybatis

时间:2019-09-15 18:00:47      阅读:81      评论:0      收藏:0      [点我收藏+]

1.引入依赖

        <!-- 通用Mapper启动器 -->
        <dependency>
            <groupId>tk.mybatis</groupId>
            <artifactId>mapper-spring-boot-starter</artifactId>
        </dependency>

2.定义mapper接口

public interface CategoryMapper extends Mapper<Category> {
}

3.启动类添加包扫描注解

@MapperScan("com.viuman.item.mapper")

或者在每个mapper接口上都加

@org.apache.ibatis.annotations.Mapper

4.基本查询

        Category category = new Category();
        category.setParentId(pid);
        return categoryMapper.select(category);

 

Springboot集成mybatis

原文:https://www.cnblogs.com/naixin007/p/11523271.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!