初始化

This commit is contained in:
2026-08-08 18:28:49 +08:00
parent 9bef4420e0
commit f082037a6e
854 changed files with 217171 additions and 11 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace app\models;
use core\base\Model;
/**
* 采购订单模型
*/
class PurchaseOrder extends Model
{
protected $table = 'purchase_order';
public function getAll()
{
return $this->order(['id DESC'])->fetchAll();
}
public function getById($id)
{
return $this->where(['id = :id'], [':id' => $id])->fetch();
}
public function getBySupplier($supplierId)
{
return $this->where(['supplier_id = :sid'], [':sid' => $supplierId])->order(['id DESC'])->fetchAll();
}
public function getCount()
{
$sql = 'SELECT COUNT(*) AS cnt FROM ' . $this->getTable();
$stmt = $this->pdo->prepare($sql);
$stmt->execute();
$row = $stmt->fetch();
return (int)($row['cnt'] ?? 0);
}
}