由于mybaties的saveOrUpdateBatch不能基于唯一联合索引工作,故而自定义sql处理:
其中
site
,data_time
,lot_id
,pos
作为联合唯一索引存在
sql
INSERT INTO loader_zk_wide
(`site`, `data_time`, `lot_id`, `pos`, `operator`, `device`, `remarks`)
VALUES
('CP', '2024-09-05', '13C23002', 'Y5', '赵文芳', 'MM800', '啊啊啊'),
('CP', '2024-09-05', '13C23002', 'Y99', '赵文芳', 'MM800', '啊啊啊')
AS a
ON DUPLICATE KEY UPDATE
operator = a.operator,
device = a.device,
remarks = a.remarks;