Open uniquejava opened 8 years ago
You do not need to use @Param
with only a single parameter. In your example, you could have used any string you want between the delimiters: #{foo} would produce the same result as #{customerId}.
You only need to use @Param when you have more than one parameter. You can't use the Java parameter name because unfortunately Java introspection doesn't provide parameter names, only types. That's why the @Param annotation was added in the first place.
网站
http://www.mybatis.org/mybatis-3/
https://blog.lanyonm.org/articles/2013/01/19/mybatis-spring-java-config-contribution.html
书
Java Persistence with MyBatis 3.pdf
示例
spring4+SpringMVC4+Mybatis+Gradle j2ee快速开发脚手架ssm-easy-template
Hello
pom.xml
src/main/resources/mybatis-config.xml
src/main/resources/com/mybatis3/mappers/StudentMapper.xml
模型Student.java
Mapper类: StudentMapper.java
服务: StudentService.java
工具类: MyBatisSqlSessionFactory.java
测试类: StudentServiceTest.java <== IDEA插件生成. src/test/java/com/mybatis3/services/