mybatis bug之resultmap缺少object-relation匹配参数password,造成设置密码不成功
2024-08-26 23:11:54
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>
最新文章
- Duilib源码分析(三)XML解析器—CMarkup
- smack 4.1创建群聊
- CentOS 系统安装
- spring+ibatis+多数据源
- hdu 1348 Wall (凸包)
- Linq分组功能
- WebService之Axis2
- c#引用web.config中的ConnectionString
- 大话PROFINET
- BZOJ2431_逆序对数列_KEY
- Log4j2 HelloWorld
- 1.1 Django起步
- 规则引擎 drools
- 14. pt-kill
- testMk
- 安装mysql时包冲突解决方法
- Jquery ajax回调函数不执行
- Qt编写密钥生成器+使用demo(开源)
- Android Studio打开React Native创建的项目
- Intellij IDEA《十分钟,配置struts2》by me
热门文章
- oracle 安装,启动 ,plsql 连接
- Java语法基础-异常处理
- [经典面试题]包含T全部元素的最小子窗口
- iOS----轻松掌握AFN网络顶级框架
- jQuery的属性与样式之样式操作.css()
- C/C++ 数组、字符串、string
- tf.app.run() got unexpected keyword argument &#39;argv&#39;
- Java 类执行顺序
- CAD交互绘制直线(com接口)
- 前端工程化与webpack