mybatis 插入一條記錄 參數為map的寫法
阿新 • • 發佈:2019-03-29
map rtu dex obj word pan batch doc span
xml:
<insert id="insertUser" parameterType="java.util.Map"> insert into user ( id, <foreach collection="columnMap" item="value" index="key" separator=","> ${key} </foreach> ) values ( SEQ_USER.NEXTVAL,<foreach collection="columnMap" item="value" index="key" separator=","> #{value} </foreach> ) </insert>
代碼:
Map<String, Object> columnMap = new HashMap<>(); columnMap.put("name", "xiaoming"); columnMap.put("password", "123"); columnMap.put("columnMap", columnMap); userService.insertProvBatchDoc(columnMap);
mybatis 插入一條記錄 參數為map的寫法