How can I pass multiple parameters and use them?

前端 未结 3 1924
执笔经年
执笔经年 2021-02-07 05:41

Hi I\'m new to myBatis.

I\'m using MyBatis and Spring with mybatis-spring.

How can I pass two different types of objects as parameters, and how can I use their p

3条回答
  •  时光取名叫无心
    2021-02-07 06:23

    Do not specify parameterType but use @Param annotation on parameters in mapper:

    @Mapper
    public interface MyMapper {
    
        void update(@Param("a") A a, @Param("b") B b);
    
        ...
    }
    

    Then reference them in mapping:

     
       UPDATE SOME WHERE x=#{a.x} AND y=#{b.y}
    
    

提交回复
热议问题