Теперь мне нужен метод, который вставит в таблицу Sqllite
CREATE TABLE IF NOT EXISTS bakery (
order_id INTEGER PRIMARY KEY AUTOINCREMENT,
bun_id INTEGER NOT NULL,
bun_name TEXT NOT NULL,
bun_price REAL NOT NULL,
category_id INTEGER,
category_name TEXT NOT NULL,
ingredient_id INTEGER,
ingredient_name TEXT NOT NULL,
ingredient_quantity REAL NOT NULL,
order_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
customer_name TEXT NOT NULL,
order_quantity INTEGER NOT NULL
);";
Данные из json:
[
{
"orderId": 1,
"bunId": 1,
"bunName": "Круассан",
"bunPrice": 2.50,
"categoryId": 1,
"categoryName": "Сладкие",
"ingredientId": 1,
"ingredientName": "Мука",
"ingredientQuantity": 200.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Анна Смирнова",
"orderQuantity": 3
},
{
"orderId": 1,
"bunId": 1,
"bunName": "Круассан",
"bunPrice": 2.50,
"categoryId": 1,
"categoryName": "Сладкие",
"ingredientId": 2,
"ingredientName": "Сахар",
"ingredientQuantity": 30.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Анна Смирнова",
"orderQuantity": 3
},
{
"orderId": 1,
"bunId": 1,
"bunName": "Круассан",
"bunPrice": 2.50,
"categoryId": 1,
"categoryName": "Сладкие",
"ingredientId": 3,
"ingredientName": "Соль",
"ingredientQuantity": 5.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Анна Смирнова",
"orderQuantity": 3
},
{
"orderId": 2,
"bunId": 2,
"bunName": "Багет",
"bunPrice": 1.80,
"categoryId": 2,
"categoryName": "Солёные",
"ingredientId": 1,
"ingredientName": "Мука",
"ingredientQuantity": 300.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Иван Петров",
"orderQuantity": 1
},
{
"orderId": 2,
"bunId": 2,
"bunName": "Багет",
"bunPrice": 1.80,
"categoryId": 2,
"categoryName": "Солёные",
"ingredientId": 3,
"ingredientName": "Соль",
"ingredientQuantity": 7.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Иван Петров",
"orderQuantity": 1
},
{
"orderId": 2,
"bunId": 2,
"bunName": "Багет",
"bunPrice": 1.80,
"categoryId": 2,
"categoryName": "Солёные",
"ingredientId": 4,
"ingredientName": "Дрожжи",
"ingredientQuantity": 10.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Иван Петров",
"orderQuantity": 1
},
{
"orderId": 3,
"bunId": 3,
"bunName": "Макарон",
"bunPrice": 3.00,
"categoryId": 1,
"categoryName": "Сладкие",
"ingredientId": 1,
"ingredientName": "Мука",
"ingredientQuantity": 150.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Ольга Сидорова",
"orderQuantity": 5
},
{
"orderId": 3,
"bunId": 3,
"bunName": "Макарон",
"bunPrice": 3.00,
"categoryId": 1,
"categoryName": "Сладкие",
"ingredientId": 2,
"ingredientName": "Сахар",
"ingredientQuantity": 100.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Ольга Сидорова",
"orderQuantity": 5
},
{
"orderId": 4,
"bunId": 4,
"bunName": "Сэндвич",
"bunPrice": 4.50,
"categoryId": 2,
"categoryName": "Солёные",
"ingredientId": 1,
"ingredientName": "Мука",
"ingredientQuantity": 250.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Дмитрий Кузнецов",
"orderQuantity": 2
},
{
"orderId": 4,
"bunId": 4,
"bunName": "Сэндвич",
"bunPrice": 4.50,
"categoryId": 2,
"categoryName": "Солёные",
"ingredientId": 5,
"ingredientName": "Киевское молоко",
"ingredientQuantity": 100.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Дмитрий Кузнецов",
"orderQuantity": 2
},
{
"orderId": 5,
"bunId": 5,
"bunName": "Диетическая булочка",
"bunPrice": 2.00,
"categoryId": 3,
"categoryName": "Диетические",
"ingredientId": 1,
"ingredientName": "Мука",
"ingredientQuantity": 200.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Екатерина Волкова",
"orderQuantity": 4
},
{
"orderId": 5,
"bunId": 5,
"bunName": "Диетическая булочка",
"bunPrice": 2.00,
"categoryId": 3,
"categoryName": "Диетические",
"ingredientId": 6,
"ingredientName": "Яйцо",
"ingredientQuantity": 1.00,
"orderDate": "2025-03-02 13:36:31.518",
"customerName": "Екатерина Волкова",
"orderQuantity": 4
}
]