Parameter ‘xxx‘ not found. Available parameters are [param, param1]

When passing in the Map collection parameter, an error is reported: Parameter 'xxx' not found. Available parameters are [param, param1]

The mapper layer statement is as follows:

List<Map<String,Object>> findEntityAll(@Param("param") Map<String, Object> param);

The SQL statement is as follows:

select * from table1 where x1 = #{x1} and x2 = #{x2}

Solution:

Type 1, remove @Param("param") in the Mapper interface

List<Map<String,Object>> findEntityAll(Map<String, Object> param);

Type 2, written as #{param.xxx} in the .xml file

select * from table1 where x1 = #{param.x1} and x2 = #{param.x2}

Detailed explanation

Explanation: This problem is due to the parameter setting problem of the mapper layer and the xml layer.
The scene: the mapper layer method passes 2 parameters, and @Param is not required for one parameter by default, but @Param("alias") must be specified for multiple parameters

Guess you like

Origin blog.csdn.net/qq_39236283/article/details/126384295