mysql文如下,传入参数为‘parentCategoryId’,运行报错为:There is no getter for property named 'parentCategoryId' in 'class java.lang.String
<select id="selectCategoryList" parameterType="java.lang.String" resultType="MstCategoryBean">
SELECT
category_id AS categoryId,
category_name AS categoryName,
view_orderby AS viewOrderby
FROM
mst_category
WHERE
del_flg =0
<if test="parentCategoryId!=null and parentCategoryId!=''">
and
parent_category_id = #{parentCategoryId}
</if>
</select>
发现不能将参数设为bean里的名称,如果传入类型为String类型,则参数需统一修改为[_parameter],修改后的sql语句如下(不管你的参数是什么,都要改成"_parameter")
SELECT
category_id AS categoryId,
category_name AS categoryName,
view_orderby AS viewOrderby
FROM
mst_category
WHERE
del_flg =0
and
parent_category_id = #{_parameter}