mybatis是我们开发者常用的dao框架,亿轻巧灵活为特征,在crud操作中,动态更新是常用的操作。我搜集了两种动态更新的sql写法,以备日后备用! 方法1: update loan_product product_id = #{productId,jdbcType=VARCHAR}, product_name = #{productName,jdbcType=VARCHAR}, product_source = #{productSource,jdbcType=VARCHAR}, level_one = #{levelOne,jdbcType=VARCHAR}, level_two = #{levelTwo,jdbcType=VARCHAR}, status = #{status,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP}, where id = #{id,jdbcType=INTEGER} 这种方式简单易写,易阅读。 方法2 update loan_borrow status=#{status},borrow_name=#{borrowName}, where borrow_nid = #{borrowNid}