add 项目进度款

This commit is contained in:
chenbo 2024-02-23 13:47:35 +08:00
parent 5ce0329659
commit 9611b29dc2
5 changed files with 437 additions and 0 deletions

View File

@ -0,0 +1,108 @@
<?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\controller\project_process_management;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\project_process_management\ProjectProgressPaymentLists;
use app\adminapi\logic\project_process_management\ProjectProgressPaymentLogic;
use app\adminapi\validate\project_process_management\ProjectProgressPaymentValidate;
/**
* ProjectProgressPayment控制器
* Class ProjectProgressPaymentController
* @package app\adminapi\controller\project_process_management
*/
class ProjectProgressPaymentController extends BaseAdminController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function lists()
{
return $this->dataLists(new ProjectProgressPaymentLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function add()
{
$params = (new ProjectProgressPaymentValidate())->post()->goCheck('add');
$result = ProjectProgressPaymentLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(ProjectProgressPaymentLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function edit()
{
$params = (new ProjectProgressPaymentValidate())->post()->goCheck('edit');
$result = ProjectProgressPaymentLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(ProjectProgressPaymentLogic::getError());
}
/**
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function delete()
{
$params = (new ProjectProgressPaymentValidate())->post()->goCheck('delete');
ProjectProgressPaymentLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function detail()
{
$params = (new ProjectProgressPaymentValidate())->goCheck('detail');
$result = ProjectProgressPaymentLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,77 @@
<?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\ProjectProgressPayment;
use app\common\lists\ListsSearchInterface;
/**
* ProjectProgressPayment列表
* Class ProjectProgressPaymentLists
* @package app\adminapi\listsproject_process_management
*/
class ProjectProgressPaymentLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2024/02/23 13:47
*/
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 13:47
*/
public function lists(): array
{
return ProjectProgressPayment::where($this->searchWhere)
->field(['id', 'dataid', 'num', 'project', 'project_num', 'djr', 'djrq', 'sbhj', 'shhj', 'ljhj', 'annex'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function count(): int
{
return ProjectProgressPayment::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,124 @@
<?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\logic\project_process_management;
use app\common\model\project_process_management\ProjectProgressPayment;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* ProjectProgressPayment逻辑
* Class ProjectProgressPaymentLogic
* @package app\adminapi\logic\project_process_management
*/
class ProjectProgressPaymentLogic extends BaseLogic
{
/**
* @notes 添加
* @param array $params
* @return bool
* @author likeadmin
* @date 2024/02/23 13:47
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
ProjectProgressPayment::create([
'dataid' => $params['dataid'],
'num' => $params['num'],
'project' => $params['project'],
'project_num' => $params['project_num'],
'djr' => $params['djr'],
'djrq' => $params['djrq'],
'sbhj' => $params['sbhj'],
'shhj' => $params['shhj'],
'ljhj' => $params['ljhj'],
'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 13:47
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
ProjectProgressPayment::where('id', $params['id'])->update([
'dataid' => $params['dataid'],
'num' => $params['num'],
'project' => $params['project'],
'project_num' => $params['project_num'],
'djr' => $params['djr'],
'djrq' => $params['djrq'],
'sbhj' => $params['sbhj'],
'shhj' => $params['shhj'],
'ljhj' => $params['ljhj'],
'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 13:47
*/
public static function delete(array $params): bool
{
return ProjectProgressPayment::destroy($params['id']);
}
/**
* @notes 获取详情
* @param $params
* @return array
* @author likeadmin
* @date 2024/02/23 13:47
*/
public static function detail($params): array
{
return ProjectProgressPayment::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,94 @@
<?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\validate\project_process_management;
use app\common\validate\BaseValidate;
/**
* ProjectProgressPayment验证器
* Class ProjectProgressPaymentValidate
* @package app\adminapi\validate\project_process_management
*/
class ProjectProgressPaymentValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
];
/**
* @notes 添加场景
* @return ProjectProgressPaymentValidate
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function sceneAdd()
{
return $this->remove('id', true);
}
/**
* @notes 编辑场景
* @return ProjectProgressPaymentValidate
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function sceneEdit()
{
return $this->only(['id']);
}
/**
* @notes 删除场景
* @return ProjectProgressPaymentValidate
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return ProjectProgressPaymentValidate
* @author likeadmin
* @date 2024/02/23 13:47
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,34 @@
<?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\common\model\project_process_management;
use app\common\model\BaseModel;
use think\model\concern\SoftDelete;
/**
* ProjectProgressPayment模型
* Class ProjectProgressPayment
* @package app\common\model\project_process_management
*/
class ProjectProgressPayment extends BaseModel
{
use SoftDelete;
protected $name = 'project_progress_payment';
protected $deleteTime = 'delete_time';
}