MyBatis-【1】配置

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}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值