类 UpadateWrapper
java.lang.Object
top.lingkang.mm.orm.UpadateWrapper
更新包装对象,例1 :
UpadateWrapper update = mapperManage.createUpdate("update t_user set password=#{p} where id=#{id}");
update.addParam("p", System.currentTimeMillis()).addParam("id", 1);
int execute = update.execute();
log.info("受影响行数: {}", execute);
例2:
UpadateWrapper update = mapperManage.createUpdate("insert into t_user(id,username) values (2,#{un})");
update.addParam("un", "lk");
int execute = update.execute();
log.info("受影响行数: {}", execute);
- 作者:
- lingkang
-
构造器概要
构造器 -
方法概要
-
构造器详细资料
-
UpadateWrapper
-
-
方法详细资料
-
addParam
添加参数,sql中的参数只能用 #{paramName}
代码例子:UpadateWrapper update = mapperManage.createUpdate("update t_user set password=#{p} where id=#{id}"); update.addParam("p", System.currentTimeMillis()).addParam("id", 1); int execute = update.execute(); log.info("受影响行数: {}", execute);- 参数:
name- 参数名value- 参数值- 返回:
- 查询包装对象
-
addParam
添加 map 参数- 参数:
params- map参数- 返回:
- 查询包装对象
-
getParams
获取参数- 返回:
- map 参数
-
execute
public int execute()执行更新操作- 返回:
- 受影响行数
-