update
This commit is contained in:
parent
90c8cba9c1
commit
3df5aea0a0
108
app/adminapi/controller/works/xzgl/OaCarCateController.php
Normal file
108
app/adminapi/controller/works/xzgl/OaCarCateController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\works\xzgl;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\xzgl\OaCarCateLists;
|
||||
use app\adminapi\logic\works\xzgl\OaCarCateLogic;
|
||||
use app\adminapi\validate\works\xzgl\OaCarCateValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆管理控制器
|
||||
* Class OaCarCateController
|
||||
* @package app\adminapi\controller\works\xzgl
|
||||
*/
|
||||
class OaCarCateController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取车辆管理列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new OaCarCateLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加车辆管理
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new OaCarCateValidate())->post()->goCheck('add');
|
||||
$result = OaCarCateLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(OaCarCateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑车辆管理
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new OaCarCateValidate())->post()->goCheck('edit');
|
||||
$result = OaCarCateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(OaCarCateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除车辆管理
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new OaCarCateValidate())->post()->goCheck('delete');
|
||||
OaCarCateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取车辆管理详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new OaCarCateValidate())->goCheck('detail');
|
||||
$result = OaCarCateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
108
app/adminapi/controller/works/xzgl/OaSealCateController.php
Normal file
108
app/adminapi/controller/works/xzgl/OaSealCateController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\works\xzgl;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\works\xzgl\OaSealCateLists;
|
||||
use app\adminapi\logic\works\xzgl\OaSealCateLogic;
|
||||
use app\adminapi\validate\works\xzgl\OaSealCateValidate;
|
||||
|
||||
|
||||
/**
|
||||
* OaSealCate控制器
|
||||
* Class OaSealCateController
|
||||
* @package app\adminapi\controller\works/xzgl
|
||||
*/
|
||||
class OaSealCateController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new OaSealCateLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new OaSealCateValidate())->post()->goCheck('add');
|
||||
$result = OaSealCateLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(OaSealCateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new OaSealCateValidate())->post()->goCheck('edit');
|
||||
$result = OaSealCateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(OaSealCateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new OaSealCateValidate())->post()->goCheck('delete');
|
||||
OaSealCateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new OaSealCateValidate())->goCheck('detail');
|
||||
$result = OaSealCateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
80
app/adminapi/lists/works/xzgl/OaCarCateLists.php
Normal file
80
app/adminapi/lists/works/xzgl/OaCarCateLists.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\xzgl;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\works\xzgl\OaCarCate;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆管理列表
|
||||
* Class OaCarCateLists
|
||||
* @package app\adminapi\listsworks\xzgl
|
||||
*/
|
||||
class OaCarCateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['status'],
|
||||
'%like%' => ['title', 'name'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取车辆管理列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return OaCarCate::where($this->searchWhere)
|
||||
->field(['id', 'title', 'name', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$data['status_text'] = $data->status_text;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取车辆管理数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return OaCarCate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
80
app/adminapi/lists/works/xzgl/OaSealCateLists.php
Normal file
80
app/adminapi/lists/works/xzgl/OaSealCateLists.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\works\xzgl;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\works\xzgl\OaSealCate;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* OaSealCate列表
|
||||
* Class OaSealCateLists
|
||||
* @package app\adminapi\listsworks/xzgl
|
||||
*/
|
||||
class OaSealCateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['status'],
|
||||
'%like%' => ['title'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return OaSealCate::where($this->searchWhere)
|
||||
->field(['id', 'title', 'status'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($data){
|
||||
$data['status_text'] = $data->status_text;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return OaSealCate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
112
app/adminapi/logic/works/xzgl/OaCarCateLogic.php
Normal file
112
app/adminapi/logic/works/xzgl/OaCarCateLogic.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\works\xzgl;
|
||||
|
||||
|
||||
use app\common\model\works\xzgl\OaCarCate;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆管理逻辑
|
||||
* Class OaCarCateLogic
|
||||
* @package app\adminapi\logic\works\xzgl
|
||||
*/
|
||||
class OaCarCateLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加车辆管理
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
OaCarCate::create([
|
||||
'title' => $params['title'],
|
||||
'name' => $params['name'],
|
||||
'status' => $params['status'] ?? 1
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑车辆管理
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
OaCarCate::where('id', $params['id'])->update([
|
||||
'title' => $params['title'],
|
||||
'name' => $params['name'],
|
||||
'status' => $params['status'] ?? 1
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除车辆管理
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return OaCarCate::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取车辆管理详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = OaCarCate::findOrEmpty($params['id']);
|
||||
$data['status_text'] = $data->status_text;
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
110
app/adminapi/logic/works/xzgl/OaSealCateLogic.php
Normal file
110
app/adminapi/logic/works/xzgl/OaSealCateLogic.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\works\xzgl;
|
||||
|
||||
|
||||
use app\common\model\works\xzgl\OaSealCate;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* OaSealCate逻辑
|
||||
* Class OaSealCateLogic
|
||||
* @package app\adminapi\logic\works/xzgl
|
||||
*/
|
||||
class OaSealCateLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
OaSealCate::create([
|
||||
'title' => $params['title'],
|
||||
'status' => $params['status'] ?? 1
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
OaSealCate::where('id', $params['id'])->update([
|
||||
'title' => $params['title'],
|
||||
'status' => $params['status'] ?? 1
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return OaSealCate::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = OaSealCate::findOrEmpty($params['id']);
|
||||
$data['status_text'] = $data->status_text;
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
107
app/adminapi/validate/works/xzgl/OaCarCateValidate.php
Normal file
107
app/adminapi/validate/works/xzgl/OaCarCateValidate.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\works\xzgl;
|
||||
|
||||
|
||||
use app\common\model\works\xzgl\OaCarCate;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆管理验证器
|
||||
* Class OaCarCateValidate
|
||||
* @package app\adminapi\validate\works\xzgl
|
||||
*/
|
||||
class OaCarCateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|checkData',
|
||||
'title' => 'require',
|
||||
'name' => 'require',
|
||||
'status' => 'integer|in:0,1',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'title' => '车辆名称',
|
||||
'name' => '车辆号码',
|
||||
'status' => '状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return OaCarCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['title','name','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return OaCarCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','title','name','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return OaCarCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return OaCarCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:02
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value,$rule,$data): bool|string
|
||||
{
|
||||
$data = OaCarCate::field('id')->where('id',$value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
}
|
||||
|
||||
}
|
105
app/adminapi/validate/works/xzgl/OaSealCateValidate.php
Normal file
105
app/adminapi/validate/works/xzgl/OaSealCateValidate.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\works\xzgl;
|
||||
|
||||
|
||||
use app\common\model\works\xzgl\OaSealCate;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* OaSealCate验证器
|
||||
* Class OaSealCateValidate
|
||||
* @package app\adminapi\validate\works/xzgl
|
||||
*/
|
||||
class OaSealCateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require|checkData',
|
||||
'title' => 'require',
|
||||
'status' => 'integer|in:0,1',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'title' => '印章类型名称',
|
||||
'status' => '状态',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return OaSealCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['title','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return OaSealCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','title','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return OaSealCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return OaSealCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 11:53
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value,$rule,$data): bool|string
|
||||
{
|
||||
$data = OaSealCate::field('id')->where('id',$value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
}
|
||||
|
||||
}
|
38
app/common/model/works/xzgl/OaCarCate.php
Normal file
38
app/common/model/works/xzgl/OaCarCate.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\works\xzgl;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆管理模型
|
||||
* Class OaCarCate
|
||||
* @package app\common\model\works\xzgl
|
||||
*/
|
||||
class OaCarCate extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'oa_car_cate';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getStatusTextAttr($value,$data): string
|
||||
{
|
||||
$arr = [0=>'禁用', 1=>'启用'];
|
||||
return $arr[$data['status']];
|
||||
}
|
||||
}
|
38
app/common/model/works/xzgl/OaSealCate.php
Normal file
38
app/common/model/works/xzgl/OaSealCate.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\works\xzgl;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* OaSealCate模型
|
||||
* Class OaSealCate
|
||||
* @package app\common\model\works/xzgl
|
||||
*/
|
||||
class OaSealCate extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'oa_seal_cate';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getStatusTextAttr($value,$data): string
|
||||
{
|
||||
$arr = [0=>'禁用', 1=>'启用'];
|
||||
return $arr[$data['status']];
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user