初始化

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
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace app\models;
use core\base\Model;
/**
* 固定资产模型
*/
class Asset extends Model
{
protected $table = 'asset';
public function getAll()
{
return $this->order(['id DESC'])->fetchAll();
}
public function getById($id)
{
return $this->where(['id = :id'], [':id' => $id])->fetch();
}
public function getCount()
{
$sql = 'SELECT COUNT(*) AS cnt, SUM(purchase_price * quantity) AS total_value FROM ' . $this->getTable();
$stmt = $this->pdo->prepare($sql);
$stmt->execute();
return $stmt->fetch();
}
public function getByStatus($status)
{
return $this->where(['status = :st'], [':st' => $status])->order(['id DESC'])->fetchAll();
}
}