mybatis bug之resultmap缺少object-relation匹配参数password,造成设置密码不成功
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>
mybatis bug之resultmap缺少object-relation匹配参数password,造成设置密码不成功的更多相关文章
- 解决 Mybatis 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminat
在配置 mybatis mapper.xml文件时, 一不小心就会报如下类似的异常: Caused by: org.springframework.beans.factory.BeanCreation ...
- ORM(Object/Relation Mapping)框架简介
ORM 框架简介 对象-关系映射(Object/Relation Mapping,简称ORM),是随着面向对象的软件开发方法发展而产生的.面向对象的开发方法是当今企业级应用开发环境中的主流开发方法,关 ...
- Mybatis映射文件中#取值时指定参数相关规则
Mybatis映射文件中#取值时指定参数相关规则 在#{}中,除了需要的数值外,还可以规定参数的一些其他规则. 例如:javaType,jdbcType,mode(存储过程),numericScale ...
- wx.navigateBack(OBJECT)怎么携带参数呢?
wx.navigateBack(OBJECT) 关闭当前页面,返回上一页面或多级页面.可通过 getCurrentPages() 获取当前的页面栈,决定需要返回几层. OBJECT 参数说明: 参数 ...
- swagger 接口文档,控制器 和 object类型的参数与返回值 的 注释不显示问题
一.控制器的注释不显示:是因为配置swagger的时候没有将includeControllerXmlComments参数配置为true,因为其默认值为false 二.object 类型的参数和返回值 ...
- mybatis+mysql返回插入的主键,参数只是提供部分参数
mybatis+mysql返回插入的主键,参数只是提供部分参数 <insert id="insertByChannelIdOpenid" useGeneratedKeys=& ...
- spring和mybatis整合时Access denied for user '***'@'localhost' (using password: YES)错误的解决方案
参考文章:博客园文章 参考解决办法: 将数据库配置文件格式 key=value 改为 jdbc.key=value 以下为问题分析 使用Spring + Mybatis + Mysql整合时,测试报错 ...
- 错误Mybatis 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminat
今天算是见识了什么事顺序的重要性. 在使用mybatis时由于联合了其他的表,用到了resultMap,之后外加association这一项.可是在替换对应字段的位置上加上association总是报 ...
- Mybatis 元素类型为 "resultMap" 的内容必须匹配 "(constructor?,id*,result*,association*,collection*,discriminat
<resultMap id="BaseResultMap" type="com.youotech.tl_cons_credit_rating.entity.TL_C ...
随机推荐
- Scala基础篇-02函数与代码块
1.block 代码块也是表达式,其最终求得的值是最后一个表达式的值. {exp1;exp2} { exp1 exp2 } 2.function def funtionName(param:Param ...
- 重构30-Return ASAP(尽快返回)
该话题实际上是诞生于移除箭头反模式重构之中.在移除箭头时,它被认为是重构产生的副作用.为了消除箭头,你需要尽快地return. ) { orderTotal = sum(products)) { or ...
- window下phpstudy开启redis扩展
注:一定要注意自己PHP的版本结构是64还是32位的!其次查看PHP Extension Build是NTS or TS! 1.使用phpinfo()函数查看PHP的版本信息,这会决定扩展文件版本(特 ...
- laravel学习:模块化caffeinated
# Modules Extract and modularize your code for maintainability. Essentially creates "mini-larav ...
- scrapy增加爬取效率
增加并发: 默认scrapy开启的并发线程为32个,可以适当进行增加.在settings配置文件中修改CONCURRENT_REQUESTS = 100值为100,并发设置成了为100. 降低日志级别 ...
- java.util.MissingResourceException: Can't find bundle for base name db, locale zh_CN
在使用Bundle来加载配置文件的时候, 爆出了这个错误: 原因? 没有找到需要加载的配置文件,因为配置文件必须放在src目录下面, 如果放进了com.bj186.crm的包下面,就必须添加包的名称到 ...
- vue中滚动页面,改变样式&&导航栏滚动时,样式透明度修改
vue中滚动页面,改变样式&&导航栏滚动时,样式透明度修改.vue <div class="commonHeader" v-bind:class=" ...
- QT5:先导篇 数据类型
一.简介 二.字符串类(QString) 三.日期类(QData) 四.时间类(QTime) 五.顺序容器类 Qt的顺序容器类有QList QLinkedList QVector QStack QQ ...
- Ubuntu中update-grub2与update-grub的区别
没有区别. Ubuntu 9.10及更高版本已安装GRUB2,但sudo update-grub仍然以标准命令为准. sudo update-grub和sudo update-grub2是等同的,所以 ...
- Linux从入门到适应(一):VSCode C++环境配置
作为在Windows环境下习惯使用Visual Studio IDE的人,对于Linux环境下的Vim编辑使用十分难受,虽然网上很多人说vim非常牛逼和强大,但是我更加习惯于使用VS code的界面, ...