Parameter ‘gradeName’ not found. Available parameters are [gradeConfigBean, param1
这个异常来自dao层
GradeConfigBean 是个实例对象
public List<GradeConfigBean> findList(@Param("gradeConfigBean") GradeConfigBean gradeConfigBean);
对应的xml文件中的sql
<select id="findList" resultType="com.xwtec.gradeConfig.entity.GradeConfigBean"
parameterType="com.xwtec.gradeConfig.entity.GradeConfigBean">
SELECT gradeId,
gradeName,
eventId,
eventName,
groupLimitCount,
maxCount,
minCount,
remark,
usable,
GRADEALIAS as gradeallas,
gradeSort
FROM T_ORIENT_GRADEINFO
WHERE 1=1
<if test="gradeName != '' and gradeName != null">
AND gradeName LIKE
<if test="dbName == 'oracle'">'%'||#{gradeName}||'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{gradeName}, '%')</if>
</if>
<if test="eventName != '' and eventName != null">
AND eventName = #{eventName}
</if>
<if test="usable != '' and usable != null">
AND usable = #{usable}
</if>
ORDER BY usable , gradeSort
</select>
显然在xml中找不到gradeName
这个变量 因为它以为传一个参数 但在xml中多个参数 而且名字不对应 所以报错
解法方法:
把@Param("gradeConfigBean")
去掉就完事了