SpringBoot_2_integrate_MyBatis

hayeka發表於2020-03-07
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.1</version>
        </dependency>
mybatis:
  type-aliases-package: cn.boku.pojo
  mapper-locations: classpath:mybatis/mapper/*.xml
package cn.boxku.mapper;

import cn.boxku.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * ————————————————————————————————————————————————
 * CREATED BY since ON 2020/3/6 10:53
 * ————————————————————————————————————————————————
 */
@Mapper//這兩個註解不能丟
@Repository//這兩個註解不能丟
public interface UserMapper {

    List<User> queryUserList();

    User selectUserById(int id);

    int addUser(User user);

    int updateUser(int id);

    int deleteUser(int id);
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結

一個從事軟體開發職業的經濟愛好者