Пример #1
0
def create_account(session: Session, account: AccountModel):
    """新增用户账户

    :param session:db session
    :param account:账户信息
    :return:None
    """
    session.add(account)
Пример #2
0
def create_address(session: Session, address: AddressModel):
    """新增收货地址

    :param session: db session
    :param address: 收货地址
    :return:None
    """
    session.add(address)
Пример #3
0
def create(session: Session, order: OrderModel, order_details: []):
    """ 创建订单

    :param session: db session
    :param order: 订单
    :param order_details: 订单详情
    :return:
    """
    session.add(order)
    session.add_all(order_details)  # 批量插入
    session.commit()