mybatis - 未找到参数“updateBy”。可用参数为 [0, createBy, param1, param2]
问题描述
我想执行一个只有一个参数的“SELECT”命令:createBy(实际上我不知道dao.xml是如何管理第一个泛型参数的,所以在我看来,只有一个参数),为什么Mybatis 抛出异常:找不到参数'updateBy'?使用 if 条件:<if test="updateBy != null and updateBy.id != null and updateBy.id != ''">
dao.java 是:
public List<T> findList(T entity, @Param("createBy") User createBy);
而dao.xml中的select sql为:
<select id="findList" resultType="ChenminIndicator">
SELECT
<include refid="chenminIndicatorColumns"/>
FROM chenmin_indicator a
<include refid="chenminIndicatorJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test="createBy != null and createBy.id != null and createBy.id != ''">
AND a.create_by = #{createBy.id}
</if>
<if test="updateBy != null and updateBy.id != null and updateBy.id != ''">
AND a.update_by = #{updateBy.id}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
解决方案
推荐阅读
- css - 来自 html 模板电子邮件的图像未显示在 Gmail 移动版中
- oracle - MINUS 在 Snowflake 中不适用相同的值
- javascript - 如何检查是否在 html 中的表单上单击了按钮并在 nodejs 中运行一些代码
- reactjs - React:尝试在迭代组件中动态渲染来自公共文件夹的图像
- java - 运行测试用例 ClientHttpResponse 时抛出 401 错误
- python - Python matlib text on bar chart
- apache - .htaccess 下 ipv6 子网的 RewriteCond
- c# - 如何替换文本文件中以特定单词开头并以 C# 中的特殊字符结尾的字符串?
- angular - Angular HttpClient TypeError: Object(...) is not a function
- python - xlrd.biffh.XLRDError:Excel xlsx 文件;不支持