日期:2014-05-16 浏览次数:20492 次
参考:http://luoyu-ds.iteye.com/blog/1517607
?
如果要动态传入表名,字段名之类的参数替换SQL语句中的占位副,需要将SQL语句执行改成非预编译的,即:
<update id="editIssuedData" parameterType="map" statementType="STATEMENT" > <![DATA[ updata user_info_t set ${field} = ${value} where id= ${id} ]]> </update>
?同时参数Map中需做下面处理:
Map<String, Object> map = new HashMap<String, Object>();
map.put("field", Constant.ISSUED_PLAN_COLUMN_NAME.get(field));
map.put("value", "'"+value+"'");
map.put("id", id);
?