Bootstrap

Mapper.update(entity,wrapper)方法避坑

    LambdaUpdateWrapper<OrderMatchRecord> updateWapper = new LambdaUpdateWrapper<>();
    updateWapper.eq(OrderMatchRecord::getIsDelete, BaseConstant.FLAG_NO);
    updateWapper.eq(OrderMatchRecord::getOrderNo, orderNo);
    updateWapper.eq(OrderMatchRecord::getMatchTradeId, matchTradeId);
    updateWapper.eq(OrderMatchRecord::getMatchStatus, BaseConstant.FLAG_YES);
    OrderMatchRecord orderMatchRecord = new OrderMatchRecord();
    orderMatchRecord.setMatchStatus(BaseConstant.FLAG_NO);
    orderMatchRecordMapper.update(orderMatchRecord,updateWapper);

update方法如果OrderMatchRecord 实体类设置了某个字段默认值,除了update状态字段后,还会重置默认值字段,如果表上设置了默认值0,也会被重置为0,需注意使用

;