@Select("SELECT * FROM USERS WHERE NAME = #{name}")
User findByName(@Param("name") String name);
@Insert("INSERT INTO USERS(NAME, AGE) VALUES(#{name}, #{age})")
int insert(@Param("name") String name, @Param("age") Integer age);
}
4.2.4、启动方式
@SpringBootApplication @MapperScan("com.mayikt.mapper") public class AppMybatis { public static void main(String[] args) { SpringApplication.run(AppMybatis.class); } }