diff --git a/app/adminapi/controller/project_process_management/ApplyWithSealController.php b/app/adminapi/controller/project_process_management/ApplyWithSealController.php new file mode 100644 index 000000000..2852e3f7c --- /dev/null +++ b/app/adminapi/controller/project_process_management/ApplyWithSealController.php @@ -0,0 +1,108 @@ +dataLists(new ApplyWithSealLists()); + } + + + /** + * @notes 添加 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function add() + { + $params = (new ApplyWithSealValidate())->post()->goCheck('add'); + $result = ApplyWithSealLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(ApplyWithSealLogic::getError()); + } + + + /** + * @notes 编辑 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function edit() + { + $params = (new ApplyWithSealValidate())->post()->goCheck('edit'); + $result = ApplyWithSealLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(ApplyWithSealLogic::getError()); + } + + + /** + * @notes 删除 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function delete() + { + $params = (new ApplyWithSealValidate())->post()->goCheck('delete'); + ApplyWithSealLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取详情 + * @return \think\response\Json + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function detail() + { + $params = (new ApplyWithSealValidate())->goCheck('detail'); + $result = ApplyWithSealLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/adminapi/lists/project_process_management/ApplyWithSealLists.php b/app/adminapi/lists/project_process_management/ApplyWithSealLists.php new file mode 100644 index 000000000..9283bd8b3 --- /dev/null +++ b/app/adminapi/lists/project_process_management/ApplyWithSealLists.php @@ -0,0 +1,77 @@ + ['num'], + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function lists(): array + { + return ApplyWithSeal::where($this->searchWhere) + ->field(['id', 'dataid', 'num', 'types', 'filetype', 'ridingseam', 'name', 'frequency', 'limit', 'depar', 'stampman', 'project', 'principal', 'content', 'loan', 'borrow', 'returndate', 'applicant', 'date', 'sjborrow', 'sjborrower', 'sjreturn', 'returnee', 'annex']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function count(): int + { + return ApplyWithSeal::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/adminapi/logic/project_process_management/ApplyWithSealLogic.php b/app/adminapi/logic/project_process_management/ApplyWithSealLogic.php new file mode 100644 index 000000000..ea0b4c85c --- /dev/null +++ b/app/adminapi/logic/project_process_management/ApplyWithSealLogic.php @@ -0,0 +1,150 @@ + $params['dataid'], + 'num' => $params['num'], + 'types' => $params['types'], + 'filetype' => $params['filetype'], + 'ridingseam' => $params['ridingseam'], + 'name' => $params['name'], + 'frequency' => $params['frequency'], + 'limit' => $params['limit'], + 'depar' => $params['depar'], + 'stampman' => $params['stampman'], + 'project' => $params['project'], + 'principal' => $params['principal'], + 'content' => $params['content'], + 'loan' => $params['loan'], + 'borrow' => $params['borrow'], + 'returndate' => $params['returndate'], + 'applicant' => $params['applicant'], + 'date' => $params['date'], + 'sjborrow' => $params['sjborrow'], + 'sjborrower' => $params['sjborrower'], + 'sjreturn' => $params['sjreturn'], + 'returnee' => $params['returnee'], + 'annex' => $params['annex'], + ]); + + 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/02/23 15:05 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + ApplyWithSeal::where('id', $params['id'])->update([ + 'dataid' => $params['dataid'], + 'num' => $params['num'], + 'types' => $params['types'], + 'filetype' => $params['filetype'], + 'ridingseam' => $params['ridingseam'], + 'name' => $params['name'], + 'frequency' => $params['frequency'], + 'limit' => $params['limit'], + 'depar' => $params['depar'], + 'stampman' => $params['stampman'], + 'project' => $params['project'], + 'principal' => $params['principal'], + 'content' => $params['content'], + 'loan' => $params['loan'], + 'borrow' => $params['borrow'], + 'returndate' => $params['returndate'], + 'applicant' => $params['applicant'], + 'date' => $params['date'], + 'sjborrow' => $params['sjborrow'], + 'sjborrower' => $params['sjborrower'], + 'sjreturn' => $params['sjreturn'], + 'returnee' => $params['returnee'], + 'annex' => $params['annex'], + ]); + + 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/02/23 15:05 + */ + public static function delete(array $params): bool + { + return ApplyWithSeal::destroy($params['id']); + } + + + /** + * @notes 获取详情 + * @param $params + * @return array + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public static function detail($params): array + { + return ApplyWithSeal::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/adminapi/validate/project_process_management/ApplyWithSealValidate.php b/app/adminapi/validate/project_process_management/ApplyWithSealValidate.php new file mode 100644 index 000000000..c16cd06c1 --- /dev/null +++ b/app/adminapi/validate/project_process_management/ApplyWithSealValidate.php @@ -0,0 +1,94 @@ + 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + ]; + + + /** + * @notes 添加场景 + * @return ApplyWithSealValidate + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return ApplyWithSealValidate + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return ApplyWithSealValidate + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return ApplyWithSealValidate + * @author likeadmin + * @date 2024/02/23 15:05 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/common/model/project_process_management/ApplyWithSeal.php b/app/common/model/project_process_management/ApplyWithSeal.php new file mode 100644 index 000000000..8bad52a94 --- /dev/null +++ b/app/common/model/project_process_management/ApplyWithSeal.php @@ -0,0 +1,34 @@ +