软件环境spring springmvc mybatis数据库:mysql报错信息:mybatis 修改关联表报错Parameter 'key_dm' not found. Available parameters are [0, member, param1, param2]代码提示://mybatis.xml代码<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.app.dao.mapper.MemberPermissionMapper">
<resultMap type="MemberPermission" id="MemberPermission">
<id column="id" property="id"/>
<result column="member_id" property="member_id"/>
<result column="ttys" property="ttys"/>
<result column="key_dm" property="key_dm"/>
<result column="lose_time" property="lose_time"/>
<result column="note" property="note"/>
<result column="update_time" property="update_time"/>
<!-- 关联member表 -->
<association property="member" javaType="com.app.bean.Member">
<id column="member_id" property="id"/>
<result column="phone" property="phone"/>
<result column="name" property="name"/>
<result column="password" property="password"/>
</association>
</resultMap>
<update id="updateMemberLoginPermission" parameterType="MemberPermission">
UPDATE dt_member_permission AS t1
LEFT JOIN dt_member AS t2 ON t1.member_id=t2.id
<set>
<if test="key_dm!=null and key_dm !=''">t1.key_dm=#{_key_dm},
</if>
</set>
WHERE t1.ttys=#{ttys}
AND t2.phone=#{phone}
AND t2.password=#{password}
</update>
3 回答
动漫人物
TA贡献1815条经验 获得超10个赞
你别用实体类传参,使用map。
Map map = new HashMap();
map.put("ttys",ttys);
map.put("phone",phone);
map.put("key_dm",key_dm);
map.put("password",password);
xml中的update语句修改成:
UPDATE dt_member_permission AS t1
LEFT JOIN dt_member AS t2 ON t1.member_id=t2.id
t1.key_dm=#{key_dm}
WHERE t1.ttys=#{ttys}
AND t2.phone=#{phone}
AND t2.password=#{password}
肯定就行了!
慕森卡
TA贡献1806条经验 获得超8个赞
那就有可能是参数类型不匹配的问题了,你memberPermissionDao.updateMemberLoginPermission这个的方法改成直接四个参数看下是否有问题
还有就是检查下数据库的类型和代码是否一致,是否都是字符串类型(varchar2)
添加回答
举报
0/150
提交
取消