1.mybatis bug之resultmap缺少object-relation匹配参数password,造成设置密码不成功

在resultmap里没有设置user类中password属性和数据库表tbl_user的password字段的匹配,造成在执行update的操作时候,无法把user中的password更新到数据库表中。

解:userMapper.xml

<resultMap id="BaseResultMap" type="User" extends="SimpleResultMap">
<id property="uid" column="uid" /> <result property="unionid" column="unionid"/>
<result property="openid" column="openid"/>
<result property="age" column="age"/>
<result property="birthday" column="birthday"/>
<result property="sex" column="sex"/>
<result property="phone" column="phone"/>
<result property="email" column="email"/>
<result property="qq" column="qq"/>
<result property="wechat" column="wechat"/>
<result property="province" column="province"/>
<result property="city" column="city"/>
<result property="country" column="country"/>
<result property="channel" column="channel"/>
<result property="password" column="password"/> <!-- SimpleResultMap 中已经有
<result property="nickname" column="nickname"/>
<result property="headimgurl" column="headimgurl"/>
<result property="appid" column="appid"/>
<result property="password" column="password"/>
-->
<result property="backgroundimg" column="backgroundimg"/>
<result property="description" column="description"/>
<result property="createTime" column="create_time"/> </resultMap> <resultMap id="SimpleResultMap" type="User">
<id property="uid" column="uid" />
<result property="nickname" column="nickname"/>
<result property="headimgurl" column="headimgurl"/>
</resultMap>
<update id="update">
update tbl_user
<set>
<trim suffixOverrides=",">
<if test="phone != null">
phone = #{phone},
</if>
<if test="age != null">
age = #{age},
</if>
<if test="birthday != null">
birthday = #{birthday},
</if>
<if test="email != null">
email = #{email},
</if>
<if test="qq != null">
qq = #{qq},
</if>
<if test="wechat != null">
wechat = #{wechat},
</if>
<if test="sex != null">
sex = #{sex},
</if>
<if test="nickname != null">
nickname = #{nickname},
</if>
<if test="province != null">
province = #{province},
</if>
<if test="headimgurl != null">
headimgurl = #{headimgurl},
</if>
<if test="city != null">
city = #{city},
</if>
<if test="password != null">
password = #{password},
</if>
<if test="backgroundimg != null">
backgroundimg = #{backgroundimg},
</if>
<if test="description != null">
description = #{description},
</if>
</trim>
</set>
<where>
uid = #{uid}
</where> </update>

最新文章

  1. Duilib源码分析(三)XML解析器—CMarkup
  2. smack 4.1创建群聊
  3. CentOS 系统安装
  4. spring+ibatis+多数据源
  5. hdu 1348 Wall (凸包)
  6. Linq分组功能
  7. WebService之Axis2
  8. c#引用web.config中的ConnectionString
  9. 大话PROFINET
  10. BZOJ2431_逆序对数列_KEY
  11. Log4j2 HelloWorld
  12. 1.1 Django起步
  13. 规则引擎 drools
  14. 14. pt-kill
  15. testMk
  16. 安装mysql时包冲突解决方法
  17. Jquery ajax回调函数不执行
  18. Qt编写密钥生成器+使用demo(开源)
  19. Android Studio打开React Native创建的项目
  20. Intellij IDEA《十分钟,配置struts2》by me

热门文章

  1. oracle 安装,启动 ,plsql 连接
  2. Java语法基础-异常处理
  3. [经典面试题]包含T全部元素的最小子窗口
  4. iOS----轻松掌握AFN网络顶级框架
  5. jQuery的属性与样式之样式操作.css()
  6. C/C++ 数组、字符串、string
  7. tf.app.run() got unexpected keyword argument &#39;argv&#39;
  8. Java 类执行顺序
  9. CAD交互绘制直线(com接口)
  10. 前端工程化与webpack