springboot+mybatis 传入 多个参数

2020-10-09  本文已影响0人  Mr菜头

pom 依赖

            <dependency>
               <groupId>org.mybatis.spring.boot</groupId>
               <artifactId>mybatis-spring-boot-starter</artifactId>
               <version>2.0.1</version>
            </dependency>

1、在dao中加入 @param 注解

  import org.apache.ibatis.annotations.Param;
    public List<Task> getRunningTask(@Param("count")int count,@Param("limit")int limit);

2、 在 mapper 中

<select id="getRunningTask" resultMap="task" >
         SELECT  * FROM wcs.t_task where task_end = 0 limit #{count},#{limit};
    </select>    
上一篇 下一篇

猜你喜欢

热点阅读