:
Parameter ‘after_sale_record_id’ not found. Available parameters are [afterSaleRecordId, param1]
List<AfterSaleRecordEmployee> queryAfterSalesApplicationSheetById(@Param("afterSaleRecordId") Long afterSaleRecordId);
错误:
<select id="queryAfterSalesApplicationSheetById" resultType="com.gaoxiaobo.wms.entity.AfterSaleRecordEmployee">
SELECT
*
FROM
after_sale_record_employee
WHERE
status = '1'
<if test="after_sale_record_id != null and after_sale_record_id != ''">
and after_sale_record_id = #{afterSaleRecordId}
</if>
</select>
刚遇到的问题,if中参数判断应该用afterSaleRecordId,而菜鸟本人选择了after_sale_record_id
正确sql应该为:
<select id="queryAfterSalesApplicationSheetById" resultType="com.gaoxiaobo.wms.entity.AfterSaleRecordEmployee">
SELECT
*
FROM
after_sale_record_employee
WHERE
status = '1'
<if test="afterSaleRecordId != null and afterSaleRecordId != ''">
and after_sale_record_id = #{afterSaleRecordId}
</if>
</select>
after_sale_record_id仅仅是数据库表中的列名。