出现如下报错:
2021-09-19 09:20:36.722 [main] ERROR org.mybat.sprin.mappe.MapperFactoryBean:[82]: Error while adding the mapper 'interface com.TestTunnel' to configuration.
org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 134; XML 文档结构必须从头至尾包含在同一个实体内。
请检查SQL标签是否正确
正确应该为:
@Mapper
@Repository
public interface TestTunnel {
@Select("<script>"+
"SELECT name FROM student t1 WHERE t1.sid = #{sid}"+
"</script>")
String getStudentName(@Param("sid") String sid);
}