MyBatis-Simple selectOne不工作

MyBatis-Simple selectOne不工作,mybatis,Mybatis,迈巴蒂斯: 不知道出了什么问题。。但基本的SelectOne不会返回结果 制图员: <select id="getBackLog" parameterType="string" resultType="string"> select data_key from yfs_task_q where task_q_key = #{value} </select> <select id="getBackLog" parameterType="string" re

迈巴蒂斯:

不知道出了什么问题。。但基本的SelectOne不会返回结果

制图员:

<select id="getBackLog" parameterType="string"
    resultType="string">
select data_key from yfs_task_q where task_q_key = #{value}
</select>
<select id="getBackLog" parameterType="string"  resultType="string">
select data_key from yfs_task_q where task_q_key = '201101070640191548867209'
</select>
此记录存在于数据库中

select data_key from yfs_task_q where task_q_key = '201101070640191548867209';

DATA_KEY               
------------------------
201101070636011548866830 
如果我将映射器更改为直接添加参数,它将返回结果

制图员:

<select id="getBackLog" parameterType="string"
    resultType="string">
select data_key from yfs_task_q where task_q_key = #{value}
</select>
<select id="getBackLog" parameterType="string"  resultType="string">
select data_key from yfs_task_q where task_q_key = '201101070640191548867209'
</select>

我这里缺少一些基本的东西。如果您能帮忙指出,我们将不胜感激

确保方法中的代理实际上是一个字符串。

发现了问题。。DB列是CHAR30,我将String对象传递给Mybatis。WHERE子句比较失败

ColValue[201101070640191548867209]输入[201101070640191548867209]

将查询更改为

从yfs_task_q中选择数据_key,其中trimtask_q_key={value}

仍然需要做更多的研究,看看是否有任何标志/配置可以设置为强制MyBatis忽略col值中的填充空格

如果有人知道mybatis coig,请发布相同的信息。但对于发布的此问题,原因已找到,我可以继续:

注意:我不确定为什么这些列是CHAR而不是VARCHAR。。这是一个第三方应用程序表。

作为id.trim传递,适用于基于字符的where子句列