日常记录

问题 1:

  mybatis拼接多条语句同时执行,报错,想在mapper的一个更新节点进行多条update语句的操作:

  <update id="cleanUserByPhone" parameterType="java.lang.String">
    update user set valid_status = 1 where mobile_phone = #{mobilePhone};
    update user_account set valid_status = 1 where mobile_phone = #{mobilePhone} ;
  </update>

解决:

  mybatis是默认不支持的,需要在数据库配置中配置相关参数:

  propertes 或者yml配置 文件中的jdbc后追加&allowMultiQueries=true

  jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/database?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true

-------------------------------------------------------------------------------------------------------------------------------------------------------------

 

posted @ 2020-06-18 09:51  离散音符  阅读(111)  评论(0编辑  收藏  举报