Mybaits中session的应用一


        获取一级缓存session
        SqlSession session = this.yangchebaoDbManagerImpl.getSqlSessionFactory().openSession(false)
  MaintainOrderMapper maintainOrderMapper = session.getMapper(MaintainOrderMapper.class);
        MaintainOrderPayMapper maintainOrderPayMapper = session.getMapper(MaintainOrderPayMapper.class);
        try {
            order.setIspay(EnumUUStatusDesc.IS_PAY_ONLINE.getIntegerValue());// 付款状态
            order.setIspayName(EnumUUStatusDesc.IS_PAY_ONLINE.getText());// 支付方式描述
            order.setPayChannelId(payChannelId);
            
            // 订单支付记录
            MaintainOrderPay orderPay = new MaintainOrderPay();
            orderPay.setMaintainOrderId(orderId);// 上门保养订单ID
            orderPay.setPayChannelId(payChannelId);// 支付渠道ID
            orderPay.setTradeNo(tradeNo);// 第三方支付交易号
            orderPay.setRedeemCode(null);// 抵用券/优惠券信息
            orderPay.setPayment(order.getPayment());// 通过该支付渠道支付的金额
            orderPay.setDiscount(0.0);// 抵扣金额
            orderPay.setTradeDate(now);// 交易完成时间
            orderPay.setStatus(SwitchStatus.YES.getCode());// 交易状态  0:失败  1:成功
            orderPay.setCreateDate(now);// 记录创建时间
            
            // 更新订单的相关信息
            maintainOrderMapper.updateByPrimaryKey(order);
            
            // 添加订单支付记录
            maintainOrderPayMapper.insert(orderPay);
            
            session.commit();
            this.loadOnlinePaySuccessOrder(orderId, now);
        } catch (Exception e) {
            session.rollback();
            logger.error(e.getMessage(), e);
            throw new InternalErrorException(e);
        } finally {
            session.close();
        }

优质内容筛选与推荐>>
1、Tcc学习笔记(一) 开篇
2、django中csrftoken跨站请求伪造的几种方式
3、Android 自己定义控件实现刮刮卡效果 真的就仅仅是刮刮卡么
4、JavaScript 屏蔽退格键
5、对VS2019进行32位汇编环境配置


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号





    联系我们

    欢迎来到TinyMind。

    关于TinyMind的内容或商务合作、网站建议,举报不良信息等均可联系我们。

    TinyMind客服邮箱:support@tinymind.net.cn