欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mybatis同时传入对象与普通参数

程序员文章站 2022-07-15 14:30:16
...
int updateDefByUidAndDef(@Param("uid") int uid,@Param("defaddress") int defaddress);
<update id="edit">
        update address
      set uid=#{address.uid},
      province = #{address.province},
      city = #{address.city},
      county = #{address.county},
      fulladdress = #{address.fulladdress},
      telphone = #{address.telphone},
      name = #{address.name},
      defaddress=#{address.defaddress}
      where id = #{id}
    </update>

注意:
1.多参数需要加上@Param注解
2.数据库里应使用别名.变量名
3.不要加parameterType