亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

mybatis 修改關聯表報錯

mybatis 修改關聯表報錯

LEATH 2019-04-17 18:15:13
軟件環境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}

肯定就行了!

查看完整回答
反對 回復 2019-05-16
?
慕森卡

TA貢獻1806條經驗 獲得超8個贊

那就有可能是參數類型不匹配的問題了,你memberPermissionDao.updateMemberLoginPermission這個的方法改成直接四個參數看下是否有問題

還有就是檢查下數據庫的類型和代碼是否一致,是否都是字符串類型(varchar2)

查看完整回答
反對 回復 2019-05-16
  • 3 回答
  • 0 關注
  • 819 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號