2023-03-05 23:35:41 +07:00
|
|
|
-- name: CreatePurchaseOrder :one
|
|
|
|
INSERT INTO purchase_order (
|
|
|
|
merchant_id,
|
|
|
|
supplier_id,
|
|
|
|
code,
|
|
|
|
is_paid,
|
|
|
|
total,
|
|
|
|
paid_nominal,
|
2023-03-21 13:15:14 +07:00
|
|
|
note,
|
|
|
|
created_by
|
2023-03-05 23:35:41 +07:00
|
|
|
) VALUES (
|
2023-03-21 13:15:14 +07:00
|
|
|
$1, $2, $3, $4, $5, $6, $7, $8
|
2023-03-05 23:35:41 +07:00
|
|
|
)
|
2023-03-16 16:55:45 +07:00
|
|
|
RETURNING *;
|
|
|
|
|
|
|
|
-- name: GetPurchaseOrderById :one
|
|
|
|
SELECT *
|
|
|
|
FROM purchase_order
|
|
|
|
WHERE id = $1;
|
|
|
|
|
|
|
|
-- name: ListPurchaseOrderByMerchantId :many
|
|
|
|
SELECT *
|
|
|
|
FROM purchase_order
|
|
|
|
WHERE merchant_id = $1;
|