It's a mistake to make a simple change today.
If the transmission mode is not correct, there is usually a problem with the transmission parameters, and there is a mapper writing error. But the author is using the auto generation tool, so did not look carefully, resulting in mapper error.
This is the correct code
<update id="updateSelective" parameterType="com.hxzy.entity.Member"> update member <set> <if test="email != null"> email = #{email,jdbcType=VARCHAR}, </if> <if test="credit != null"> credit = #{credit,jdbcType=INTEGER}, </if> <if test="gold != null"> gold = #{gold,jdbcType=DOUBLE}, </if> <if test="realname != null"> realname = #{realname,jdbcType=VARCHAR}, </if> <if test="mobile != null"> mobile = #{mobile,jdbcType=VARCHAR}, </if> <if test="pwd != null"> pwd = #{pwd,jdbcType=VARCHAR}, </if> <if test="createtime != null"> createtime =#{createtime,jdbcType=INTEGER}, </if> <if test="istemplate != null"> istemplate = #{istemplate,jdbcType=INTEGER}, </if> <if test="status != null"> `status` = #{status,jdbcType=INTEGER}, </if> <if test="experience != null"> experience = #{experience,jdbcType=INTEGER}, </if> <if test="avatar != null"> avatar = #{avatar,jdbcType=VARCHAR}, </if> <if test="outgold != null"> outgold = #{outgold,jdbcType=DOUBLE}, </if> <if test="outgoldinfo != null"> outgoldinfo = #{outgoldinfo,jdbcType=VARCHAR}, </if> <if test="weixinOpenid != null"> weixin_openid = #{weixinOpenid,jdbcType=VARCHAR}, </if> <if test="alipayOpenid != null"> alipay_openid = #{alipayOpenid,jdbcType=VARCHAR}, </if> </set> where openid = #{openid,jdbcType=VARCHAR} </update>
This is the wrong code
<update id="updateSelective" parameterType="com.hxzy.entity.Member"> update member <set> <if test="email != null"> email = #{email,jdbcType=VARCHAR}, </if> <if test="credit != null"> credit = #{credit,jdbcType=INTEGER}, </if> <if test="gold != null"> gold = #{gold,jdbcType=DOUBLE}, </if> <if test="realname != null"> realname = #{realname,jdbcType=VARCHAR}, </if> <if test="mobile != null"> mobile = #{mobile,jdbcType=VARCHAR}, </if> <if test="pwd != null"> pwd = #{pwd,jdbcType=VARCHAR}, </if> createtime =#{createtime,jdbcType=INTEGER}, <if test="istemplate != null"> istemplate = #{istemplate,jdbcType=INTEGER}, </if> <if test="status != null"> `status` = #{status,jdbcType=INTEGER}, </if> <if test="experience != null"> experience = #{experience,jdbcType=INTEGER}, </if> <if test="avatar != null"> avatar = #{avatar,jdbcType=VARCHAR}, </if> <if test="outgold != null"> outgold = #{outgold,jdbcType=DOUBLE}, </if> <if test="outgoldinfo != null"> outgoldinfo = #{outgoldinfo,jdbcType=VARCHAR}, </if> <if test="weixinOpenid != null"> weixin_openid = #{weixinOpenid,jdbcType=VARCHAR}, </if> <if test="alipayOpenid != null"> alipay_openid = #{alipayOpenid,jdbcType=VARCHAR}, </if> </set> where openid = #{openid,jdbcType=VARCHAR} </update>
Yes, the code generation tool did not determine if createtime is null, resulting in an error.