update
This commit is contained in:
parent
3df5aea0a0
commit
1fd96738aa
108
app/adminapi/controller/works/xzgl/OaMeetingCateController.php
Normal file
108
app/adminapi/controller/works/xzgl/OaMeetingCateController.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\OaMeetingCateLists;
|
||||
use app\adminapi\logic\works\xzgl\OaMeetingCateLogic;
|
||||
use app\adminapi\validate\works\xzgl\OaMeetingCateValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 会议室管理控制器
|
||||
* Class OaMeetingCateController
|
||||
* @package app\adminapi\controller\works\xzgl
|
||||
*/
|
||||
class OaMeetingCateController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取会议室管理列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new OaMeetingCateLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加会议室管理
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new OaMeetingCateValidate())->post()->goCheck('add');
|
||||
$result = OaMeetingCateLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(OaMeetingCateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑会议室管理
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new OaMeetingCateValidate())->post()->goCheck('edit');
|
||||
$result = OaMeetingCateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(OaMeetingCateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除会议室管理
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new OaMeetingCateValidate())->post()->goCheck('delete');
|
||||
OaMeetingCateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取会议室管理详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new OaMeetingCateValidate())->goCheck('detail');
|
||||
$result = OaMeetingCateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
80
app/adminapi/lists/works/xzgl/OaMeetingCateLists.php
Normal file
80
app/adminapi/lists/works/xzgl/OaMeetingCateLists.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\OaMeetingCate;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 会议室管理列表
|
||||
* Class OaMeetingCateLists
|
||||
* @package app\adminapi\listsworks\xzgl
|
||||
*/
|
||||
class OaMeetingCateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
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 14:24
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return OaMeetingCate::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 14:24
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return OaMeetingCate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
110
app/adminapi/logic/works/xzgl/OaMeetingCateLogic.php
Normal file
110
app/adminapi/logic/works/xzgl/OaMeetingCateLogic.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\OaMeetingCate;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 会议室管理逻辑
|
||||
* Class OaMeetingCateLogic
|
||||
* @package app\adminapi\logic\works\xzgl
|
||||
*/
|
||||
class OaMeetingCateLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加会议室管理
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
OaMeetingCate::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 14:24
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
OaMeetingCate::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 14:24
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return OaMeetingCate::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取会议室管理详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = OaMeetingCate::findOrEmpty($params['id']);
|
||||
$data['status_text'] = $data->status_text;
|
||||
return $data->toArray();
|
||||
}
|
||||
}
|
@ -98,7 +98,7 @@ class OaCarCateValidate extends BaseValidate
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value,$rule,$data): bool|string
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = OaCarCate::field('id')->where('id',$value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
|
105
app/adminapi/validate/works/xzgl/OaMeetingCateValidate.php
Normal file
105
app/adminapi/validate/works/xzgl/OaMeetingCateValidate.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\OaMeetingCate;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 会议室管理验证器
|
||||
* Class OaMeetingCateValidate
|
||||
* @package app\adminapi\validate\works\xzgl
|
||||
*/
|
||||
class OaMeetingCateValidate 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 OaMeetingCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['title','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return OaMeetingCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','title','status']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return OaMeetingCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return OaMeetingCateValidate
|
||||
* @author likeadmin
|
||||
* @date 2024/05/22 14:24
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = OaMeetingCate::field('id')->where('id',$value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
}
|
||||
|
||||
}
|
@ -96,7 +96,7 @@ class OaSealCateValidate extends BaseValidate
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
public function checkData($value,$rule,$data): bool|string
|
||||
public function checkData($value): bool|string
|
||||
{
|
||||
$data = OaSealCate::field('id')->where('id',$value)->findOrEmpty();
|
||||
return $data->isEmpty() ? '数据不存在' : true;
|
||||
|
38
app/common/model/works/xzgl/OaMeetingCate.php
Normal file
38
app/common/model/works/xzgl/OaMeetingCate.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 OaMeetingCate
|
||||
* @package app\common\model\works\xzgl
|
||||
*/
|
||||
class OaMeetingCate extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'oa_meeting_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