码迷,mamicode.com
首页 > 编程语言 > 详细

Springboot集成mybatis

时间:2019-09-15 17:04:27      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:ota   接口   mapper   tis   map   man   查询   start   pac   

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

标签:ota   接口   mapper   tis   map   man   查询   start   pac   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!