商品、订单部分相关代码生成,下一步先把商品搞完再搞订单
This commit is contained in:
87
app/Service/CodeGeneration/OrderDetailService.php
Normal file
87
app/Service/CodeGeneration/OrderDetailService.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\CodeGeneration;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\OrderDetailModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class OrderDetailService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = ["id", "order_id", "product_id", "quantity", "price", "subtotal", "snapshot", "status", "created_at", "updated_at", "deleted_at"];
|
||||
$this->queryField = ['order_id' => '=','product_id' => '=,status='];
|
||||
$this->model = OrderDetailModel::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option()
|
||||
{
|
||||
$this->optionField = ['id', 'name'];
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单详情
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑订单详情
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单详情
|
||||
* @param $ids
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($ids): mixed
|
||||
{
|
||||
return $this->del($ids);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user