mybatis 动态 sql

mybatis 动态 sql <update id="updateAuthorIfNecessary"> update Author <set> <if test="username != null">username=#{username},</if> <if test="password != null">password=#{password},</if> <if test="email != null">email=#{email},</if> <if test="bio != null">bio=#{bio}</if> </set> where id=#{id} </update> http://mybatis.github.io/mybatis-3/zh/dynamic-sql.html

2014-05-27 · 1 min · 29 words · -

MyBatis_当实体属性与表字段名不一致

MyBatis_当实体属性与表字段名不一致 http://m.blog.csdn.net/blog/wuqinfei_cs/12873135 映射 /*

2014-05-07 · 1 min · 4 words · -

spring mvc + mybatis

spring mvc + mybatis

2014-05-06 · 1 min · 4 words · -

MyBatis动态传入表名,字段名的解决办法

MyBatis动态传入表名,字段名的解决办法 http://springsfeng.iteye.com/blog/1634234 参考: http://luoyu-ds.iteye.com/blog/1517607 如果要动态传入表名,字段名之类的参数替换SQL语句中的占位副,需要将SQL语句执行改成非预编译的,即: Xml代码 <img alt="收藏代码" src="http://springsfeng.iteye.com/images/icon_star.png" /> statementType="STATEMENT" > <![DATA[ updata user_info_t set ${field} = ${value} where id= ${id} ]]> </update> 同时参数Map中需做下面处理: Java代码 <img alt="收藏代码" src="http://springsfeng.iteye.com/images/icon_star.png" /> 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);

2013-01-24 · 1 min · 43 words · -