12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- /*
- * @Descripttion:
- * @version: 1.0.0
- * @Author: likang
- * @Date: 2022-05-27 13:34:31
- * @LastEditors: likang
- * @LastEditTime: 2022-08-05 09:26:09
- */
- namespace catchAdmin\hydraulic\controller;
- use catcher\base\CatchRequest as Request;
- use catcher\CatchResponse;
- use catcher\base\CatchController;
- use catchAdmin\hydraulic\model\DeviceMold as deviceMoldModel;
- class DeviceMold extends CatchController
- {
- protected $deviceMoldModel;
- public function __construct(DeviceMoldModel $deviceMoldModel)
- {
- $this->deviceMoldModel = $deviceMoldModel;
- }
- /**
- * 列表
- * @time 2022年05月06日 10:22
- * @param Request $request
- */
- public function index(Request $request): \think\Response
- {
- return CatchResponse::paginate($this->deviceMoldModel->getList());
- }
- /**
- * 保存信息
- * @time 2022年05月06日 10:22
- * @param Request $request
- */
- public function save(Request $request): \think\Response
- {
- return CatchResponse::success($this->deviceMoldModel->storeBy($request->post()));
- }
- /**
- * 读取
- * @time 2022年05月06日 10:22
- * @param $id
- */
- public function read($id): \think\Response
- {
- return CatchResponse::success($this->deviceMoldModel->findBy($id));
- }
- /**
- * 更新
- * @time 2022年05月06日 10:22
- * @param Request $request
- * @param $id
- */
- public function update(Request $request, $id): \think\Response
- {
- return CatchResponse::success($this->deviceMoldModel->updateBy($id, $request->post()));
- }
- /**
- * 删除
- * @time 2022年05月06日 10:22
- * @param $id
- */
- public function delete($id): \think\Response
- {
- return CatchResponse::success($this->deviceMoldModel->deleteBy($id, true));
- }
- /**
- * 根据设备类型获取设备型号
- * @time 2022年05月06日 10:22
- * @param $id
- */
- public function getDeviceMold(Request $request): \think\Response
- {
- $type = $request->get('type');
- return CatchResponse::success($this->deviceMoldModel->where('device_type', $type)->field('id as value,name as text')->select());
- }
- }
|