feat: 新增采购订单列表及详情模型与控制器

This commit is contained in:
mkm 2024-07-30 17:19:09 +08:00
parent d9bb85651e
commit ddaef44baf
4 changed files with 119 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<?php
namespace app\admin\controller\purchase_order;
use app\admin\controller\BaseAdminController;
use app\admin\lists\purchase_order\PurchaseOrderLists;
class PurchaseOrderController extends BaseAdminController{
public function lists()
{
return $this->dataLists(new PurchaseOrderLists());
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace app\admin\lists\purchase_order;
use app\admin\lists\BaseAdminDataLists;
use app\common\lists\ListsSearchInterface;
use app\common\model\purchase_order\PurchaseOrder;
/**
* 采购订单列表
* Class PurchaseOrderLists
* @package app\admin\lists\purchase_order
*/
class PurchaseOrderLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author admin
* @date 2024/05/31 17:09
*/
public function setSearch(): array
{
return [
'=' => ['store_id', 'order_id'],
];
}
/**
* @notes 获取采购订单列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author admin
* @date 2024/05/31 17:09
*/
public function lists(): array
{
return PurchaseOrder::where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select();
}
/**
* @notes 获取采购订单数量
* @return int
* @author admin
* @date 2024/05/31 17:09
*/
public function count(): int
{
return PurchaseOrder::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\purchase_order;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 采购订单
* Class PurchaseOrder
* @package app\common\model\purchase_order
*/
class PurchaseOrder extends BaseModel
{
use SoftDelete;
protected $name = 'purchase_order';
protected $deleteTime = 'delete_time';
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\common\model\purchase_order_info;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* 采购订单详情
* Class PurchaseOrderInfo
* @package app\common\model\purchase_order_info
*/
class PurchaseOrderInfo extends BaseModel
{
use SoftDelete;
protected $name = 'purchase_order_info';
protected $deleteTime = 'delete_time';
}