diff --git a/dist.zip b/dist.zip deleted file mode 100644 index c64b605..0000000 Binary files a/dist.zip and /dev/null differ diff --git a/generate/php/app/adminapi/controller/oa/FlowTypeController.php b/generate/php/app/adminapi/controller/oa/FlowTypeController.php new file mode 100644 index 0000000..35cbcce --- /dev/null +++ b/generate/php/app/adminapi/controller/oa/FlowTypeController.php @@ -0,0 +1,108 @@ +dataLists(new FlowTypeLists()); + } + + + /** + * @notes 添加审批类型 + * @return \think\response\Json + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function add() + { + $params = (new FlowTypeValidate())->post()->goCheck('add'); + $result = FlowTypeLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(FlowTypeLogic::getError()); + } + + + /** + * @notes 编辑审批类型 + * @return \think\response\Json + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function edit() + { + $params = (new FlowTypeValidate())->post()->goCheck('edit'); + $result = FlowTypeLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(FlowTypeLogic::getError()); + } + + + /** + * @notes 删除审批类型 + * @return \think\response\Json + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function delete() + { + $params = (new FlowTypeValidate())->post()->goCheck('delete'); + FlowTypeLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取审批类型详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function detail() + { + $params = (new FlowTypeValidate())->goCheck('detail'); + $result = FlowTypeLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/generate/php/app/adminapi/lists/oa/FlowTypeLists.php b/generate/php/app/adminapi/lists/oa/FlowTypeLists.php new file mode 100644 index 0000000..8f376d8 --- /dev/null +++ b/generate/php/app/adminapi/lists/oa/FlowTypeLists.php @@ -0,0 +1,78 @@ + ['type'], + '%like%' => ['title'], + ]; + } + + + /** + * @notes 获取审批类型列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function lists(): array + { + return FlowType::where($this->searchWhere) + ->field(['id', 'type', 'title', 'name', 'department_ids', 'status']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取审批类型数量 + * @return int + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function count(): int + { + return FlowType::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/generate/php/app/adminapi/logic/oa/FlowTypeLogic.php b/generate/php/app/adminapi/logic/oa/FlowTypeLogic.php new file mode 100644 index 0000000..e6e2f18 --- /dev/null +++ b/generate/php/app/adminapi/logic/oa/FlowTypeLogic.php @@ -0,0 +1,114 @@ + $params['type'], + 'title' => $params['title'], + 'name' => $params['name'], + 'department_ids' => $params['department_ids'], + 'status' => $params['status'] + ]); + + 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/01/31 14:15 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + FlowType::where('id', $params['id'])->update([ + 'type' => $params['type'], + 'title' => $params['title'], + 'name' => $params['name'], + 'department_ids' => $params['department_ids'], + 'status' => $params['status'] + ]); + + 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/01/31 14:15 + */ + public static function delete(array $params): bool + { + return FlowType::destroy($params['id']); + } + + + /** + * @notes 获取审批类型详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public static function detail($params): array + { + return FlowType::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/generate/php/app/adminapi/validate/oa/FlowTypeValidate.php b/generate/php/app/adminapi/validate/oa/FlowTypeValidate.php new file mode 100644 index 0000000..f401d9e --- /dev/null +++ b/generate/php/app/adminapi/validate/oa/FlowTypeValidate.php @@ -0,0 +1,104 @@ + 'require', + 'type' => 'require', + 'title' => 'require', + 'name' => 'require', + 'department_ids' => 'require', + 'status' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'type' => '所属分类', + 'title' => '审批名称', + 'name' => '审批标识', + 'department_ids' => '应用部门', + 'status' => '状态', + ]; + + + /** + * @notes 添加场景 + * @return FlowTypeValidate + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function sceneAdd() + { + return $this->only(['type','title','name','department_ids','status']); + } + + + /** + * @notes 编辑场景 + * @return FlowTypeValidate + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function sceneEdit() + { + return $this->only(['id','type','title','name','department_ids','status']); + } + + + /** + * @notes 删除场景 + * @return FlowTypeValidate + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return FlowTypeValidate + * @author likeadmin + * @date 2024/01/31 14:15 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/generate/php/app/common/model/oa/FlowType.php b/generate/php/app/common/model/oa/FlowType.php new file mode 100644 index 0000000..f45b5a4 --- /dev/null +++ b/generate/php/app/common/model/oa/FlowType.php @@ -0,0 +1,34 @@ + +