1、一个10W+数据比对,用单个操作需要耗时几个小时优化到秒级。
# 1、批量插入操作
insert into ah_day_table(orderPersonName,orderPhone,orderTime,orderCode,orderCount,orderContent,orderMark,orderAddress,orderIP,orderPrice) values
(
'${ahDayTable.orderPersonName}', '${ahDayTable.orderPhone}',
'${ahDayTable.orderTimeAnother}','${ahDayTable.orderCode}',
'${ahDayTable.orderCount}','${ahDayTable.orderContent}',
'${ahDayTable.orderMark}','${ahDayTable.orderAddress}',
'${ahDayTable.orderIP}','${ahDayTable.orderPrice}'
)
# 2、分页查询操作
select * from ah_day_table
order by ${ahDayTable.orderBy}
order by id asc
limit ${ahDayTable.startItem},${ahDayTable.endItem};
ah_day_table.id= '${ahDayTable.idChoose}'
or
ah_day_table.orderPersonName= '${ahDayTable.orderPersonNameChoose}'
or
ah_day_table.orderPhone= '${ahDayTable.orderPhoneChoose}'
# 3、批量删除操作
delete from ah_day_table where id in
#{item}
# 4、数据库比对操作
select
ah_day_table.id 'ah_day_table_id',
GROUP_CONCAT('系统订单',ah_order_table.id,'',ah_order_table.orderStatus)
as
table_need_data
from ah_day_table join ah_order_table
ON
ah_day_table.orderPersonName=ah_order_table.orderPersonName
GROUP BY ah_day_table.id;
# 5、批量修改操作
update ah_day_table
when ah_day_table.id=#{item.ah_day_table_id}
then #{item.table_need_data}
where id in
#{item.ah_day_table_id}
# 6、批量追加操作
update ah_day_table
when ah_day_table.id=#{item.ah_day_table_id}
then CONCAT(ah_day_table.repeatContent,#{item.table_need_data})
where id in
#{item.ah_day_table_id}