【发布时间】:2020-11-02 06:48:21
【问题描述】:
我在/getAppInfo的URL中定义了一个API,它的参数只得到了这样一个ID:
@ResponseBody
@RequestMapping("/getAppInfo")
public ResultResponse getAppInfo(String id) {
ResultResponse result = new ResultResponse();
String appName = uploadedFile.getAppInfo(id);
result.setResult(appName);
return result;
}
uploadedFile 是接口IUploadedFileMapper 的一个对象,这个映射器反映了一个名为UploadedFileMapper.xml 的MyBatis 映射器。
然后我把下面的代码写到IUploadedFileMapper.java:
public String getAppInfo(String id);
之后我写了如下代码给UploadedFileMapper.xml:
<select id="getAppInfo" parameterType="java.lang.String" resultType="java.lang.String">
select tb.name from table tb where tb.id = #{id} and tb.business_sub_type = 'APP';
</select>
当我测试这个 WebAPI 时,spring-boot 告诉我:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): example.cn.dao.IUploadedFileMapper.getAppInfo
【问题讨论】:
-
你可以从查询中删除分号并尝试
-
亲爱的 Anish B.:数据库正在使用 MySQL,分号似乎不会影响程序报告
Invalid bound statement (not found),对吗? -
好的!查询看起来没问题。我认为问题可能出在 Mapper 上。
-
怎么说?有什么细节吗,伙计?
-
请添加更多详细信息。添加您的 Mapper 类。
标签: java spring spring-boot mybatis