This commit is contained in:
chenbo 2024-02-28 11:07:33 +08:00
parent d1c85499ba
commit fa330ad525
3 changed files with 87 additions and 86 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\project_process_management;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\project_process_management\ProjectRectification;
use app\common\lists\ListsSearchInterface;
/**
* ProjectRectification列表
* Class ProjectRectificationLists
* @package app\adminapi\listsproject_process_management
*/
class ProjectRectificationLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/23 11:22
*/
public function setSearch(): array
{
return [
'=' => ['num', '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/23 11:22
*/
public function lists(): array
{
return ProjectRectification::where($this->searchWhere)
->field(['id', 'dataid', 'num', 'project', 'project_num', 'wt_unit', 'xm_master', 'zx_type', 'zg_master', 'dj_person', 'apptime', 'problem', 'deal_desc'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2024/02/23 11:22
*/
public function count(): int
{
return ProjectRectification::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\project_process_management;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\project_process_management\ProjectRectification;
use app\common\lists\ListsSearchInterface;
/**
* ProjectRectification列表
* Class ProjectRectificationLists
* @package app\adminapi\listsproject_process_management
*/
class ProjectRectificationLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/23 11:22
*/
public function setSearch(): array
{
return [
'=' => ['num', '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/23 11:22
*/
public function lists(): array
{
return ProjectRectification::with(['projectInfo'])
->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2024/02/23 11:22
*/
public function count(): int
{
return ProjectRectification::where($this->searchWhere)->count();
}
}

View File

@ -41,10 +41,9 @@ class ProjectRectificationLogic extends BaseLogic
Db::startTrans();
try {
ProjectRectification::create([
'dataid' => $params['dataid'],
'num' => $params['num'],
'project' => $params['project'],
'project_num' => $params['project_num'],
'dataid' => generate_sn(ProjectRectification::class, 'dataid'),
'num' => generate_sn(ProjectRectification::class, 'num'),
'project_id' => $params['project_id'],
'wt_unit' => $params['wt_unit'],
'xm_master' => $params['xm_master'],
'zx_type' => $params['zx_type'],
@ -79,10 +78,7 @@ class ProjectRectificationLogic extends BaseLogic
Db::startTrans();
try {
ProjectRectification::where('id', $params['id'])->update([
'dataid' => $params['dataid'],
'num' => $params['num'],
'project' => $params['project'],
'project_num' => $params['project_num'],
'project_id' => $params['project_id'],
'wt_unit' => $params['wt_unit'],
'xm_master' => $params['xm_master'],
'zx_type' => $params['zx_type'],
@ -127,6 +123,6 @@ class ProjectRectificationLogic extends BaseLogic
*/
public static function detail($params): array
{
return ProjectRectification::findOrEmpty($params['id'])->toArray();
return ProjectRectification::with(['projectInfo'])->findOrEmpty($params['id'])->toArray();
}
}

View File

@ -16,6 +16,7 @@ namespace app\common\model\project_process_management;
use app\common\model\BaseModel;
use app\common\model\cost_project\CostProject;
use think\model\concern\SoftDelete;
@ -30,5 +31,8 @@ class ProjectRectification extends BaseModel
protected $name = 'project_rectification';
protected $deleteTime = 'delete_time';
public function projectInfo()
{
return $this->hasOne(CostProject::class, 'id', 'project_id');
}
}