This commit is contained in:
chenbo 2024-02-27 15:25:11 +08:00
parent 59239952d1
commit d7652ed93d
3 changed files with 86 additions and 85 deletions

View File

@ -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();
}
}

View File

@ -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'],

View File

@ -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');
}
}