diff --git a/app/adminapi/lists/ApprovalIssuanceAchievementDocumentsLists.php b/app/adminapi/lists/ApprovalIssuanceAchievementDocumentsLists.php index cf7f50d32..2bc9179b2 100644 --- a/app/adminapi/lists/ApprovalIssuanceAchievementDocumentsLists.php +++ b/app/adminapi/lists/ApprovalIssuanceAchievementDocumentsLists.php @@ -1,77 +1,78 @@ -<?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; - - -use app\adminapi\lists\BaseAdminDataLists; -use app\common\model\ApprovalIssuanceAchievementDocuments; -use app\common\lists\ListsSearchInterface; - - -/** - * ApprovalIssuanceAchievementDocuments列表 - * Class ApprovalIssuanceAchievementDocumentsLists - * @package app\adminapi\lists - */ -class ApprovalIssuanceAchievementDocumentsLists extends BaseAdminDataLists implements ListsSearchInterface -{ - - - /** - * @notes 设置搜索条件 - * @return \string[][] - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function setSearch(): array - { - return [ - '=' => ['project', 'project_num'], - ]; - } - - - /** - * @notes 获取列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function lists(): array - { - return ApprovalIssuanceAchievementDocuments::where($this->searchWhere) - ->field(['id', 'dataid', 'num', 'project', 'project_num', 'task', 'processes', 'number', 'apptime', 'person', 'tips', 'fd_1', 'fd_2', 'fd_3']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取数量 - * @return int - * @author likeadmin - * @date 2024/02/22 17:57 - */ - public function count(): int - { - return ApprovalIssuanceAchievementDocuments::where($this->searchWhere)->count(); - } - +<?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; + + +use app\adminapi\lists\BaseAdminDataLists; +use app\common\model\ApprovalIssuanceAchievementDocuments; +use app\common\lists\ListsSearchInterface; + + +/** + * ApprovalIssuanceAchievementDocuments列表 + * Class ApprovalIssuanceAchievementDocumentsLists + * @package app\adminapi\lists + */ +class ApprovalIssuanceAchievementDocumentsLists extends BaseAdminDataLists implements ListsSearchInterface +{ + + + /** + * @notes 设置搜索条件 + * @return \string[][] + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function setSearch(): array + { + return [ + '=' => ['project', 'project_num'], + + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function lists(): array + { + return ApprovalIssuanceAchievementDocuments::where($this->searchWhere) + ->with(['projectInfo']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author likeadmin + * @date 2024/02/22 17:57 + */ + public function count(): int + { + return ApprovalIssuanceAchievementDocuments::where($this->searchWhere)->count(); + } + } \ No newline at end of file diff --git a/app/adminapi/logic/ApprovalIssuanceAchievementDocumentsLogic.php b/app/adminapi/logic/ApprovalIssuanceAchievementDocumentsLogic.php index 0206a90f1..41a1d0b08 100644 --- a/app/adminapi/logic/ApprovalIssuanceAchievementDocumentsLogic.php +++ b/app/adminapi/logic/ApprovalIssuanceAchievementDocumentsLogic.php @@ -41,10 +41,9 @@ class ApprovalIssuanceAchievementDocumentsLogic extends BaseLogic Db::startTrans(); try { ApprovalIssuanceAchievementDocuments::create([ - 'dataid' => $params['dataid'], - 'num' => $params['num'], - 'project' => $params['project'], - 'project_num' => $params['project_num'], + 'dataid' => generate_sn(ApprovalIssuanceAchievementDocuments::class, 'dataid'), + 'num' => generate_sn(ApprovalIssuanceAchievementDocuments::class, 'num'), + 'project_id' => $params['project'], 'task' => $params['task'], 'processes' => $params['processes'], 'number' => $params['number'], @@ -78,10 +77,7 @@ class ApprovalIssuanceAchievementDocumentsLogic extends BaseLogic Db::startTrans(); try { ApprovalIssuanceAchievementDocuments::where('id', $params['id'])->update([ - 'dataid' => $params['dataid'], - 'num' => $params['num'], - 'project' => $params['project'], - 'project_num' => $params['project_num'], + 'project_id' => $params['project'], 'task' => $params['task'], 'processes' => $params['processes'], 'number' => $params['number'], diff --git a/app/common/model/ApprovalIssuanceAchievementDocuments.php b/app/common/model/ApprovalIssuanceAchievementDocuments.php index aec1bcd24..82c7c083f 100644 --- a/app/common/model/ApprovalIssuanceAchievementDocuments.php +++ b/app/common/model/ApprovalIssuanceAchievementDocuments.php @@ -16,6 +16,7 @@ namespace app\common\model; use app\common\model\BaseModel; +use app\common\model\cost_project\CostProject; use think\model\concern\SoftDelete; @@ -30,5 +31,8 @@ class ApprovalIssuanceAchievementDocuments extends BaseModel protected $name = 'approval_issuance_achievement_documents'; protected $deleteTime = 'delete_time'; - + public function projectInfo() + { + return $this->hasOne(CostProject::class, 'id', 'project_id'); + } } \ No newline at end of file