Parameter 'list1' not found. Available parameters are [list] 解析

 

When using the foreach statement will often report Parameter 'ordersList' not found Available parameters are [list] resolve this error, this error caused the main reason for your writing error: See error examples
mapper interface

List <Orders> selectKeyList (List <Integer> ordersList);


in the wording mapper.xml you are

<Collection the foreach = "ordersList" Item = "Item" = Open "and ID in (" Separator = "," Close = ")">
        # {} Item
</ foreach>



by the following piece of code you can know the collection = "ordersList" not so write

Private Object wrapCollection (Object Object) {
        DefaultSqlSession.StrictMap the Map;
       // if its argument is a set of
        IF (Object instanceof collection) {
            / / create a the Map
            the Map = new new DefaultSqlSession.StrictMap ();

            map.put ( "Collection",Object);
            // Note that if the argument is a list
            IF (Object instanceof List) {
                // Then came the argument, the default should be written collection = collection "List"
                map.put ( "List", Object);
            }

            return the Map;
        !} the else IF (Object Object = null && . .getClass () the isArray ()) {
            Map DefaultSqlSession.StrictMap new new = ();
            default array is written // = Collection "array"
            map.put ( "array", Object);
            return Map;
        } the else {
            return Object ;
        }
    }

so your collection = "ordersList" should be changed to collection = "list" so that we can correct the mistake, of course, if you do not change, only the methods defined in the interface mapper changes as follows:

List <the Orders> selectKeyList (@ param ( "ordersList") List < Integer>ordersList);

   

this error can be effectively addressed.
---------------------
Author: qq_21863565
Original: https: //blog.csdn.net/qq_21863565/article/details/81262834

Guess you like

Origin www.cnblogs.com/xiaoshen666/p/11087854.html