// 对象
public class Entity {
private String id = null;
private int value = null;
private Timestamp createTime = null;
// getter and setter ...
}
// 数据表
CREATE TABLE qai_entity (
id CHAR(10) NOT NULL,
value INT NOT NULL DEFAULT 0,
create_time TIMESTAMP NOT NULL,
PRIMARY KEY (id)
)
// MyBatis 配置
mysql没有提供直接的方法来实现批量,但可以使用case when语法来实现这个功能。
update course
set name = case id
when 1 then 'name1'
when 2 then 'name2'
when 3 then 'name3'
end,
title = case id
when 1 then 'new title 1'
when 2 then 'new title 2'
when 3 then 'new title 3'
end
where id in (1,2,3)
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....