|
|
@@ -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\lists\master_commission;
|
|
|
+
|
|
|
+
|
|
|
+use app\adminapi\lists\BaseAdminDataLists;
|
|
|
+use app\common\model\master_commission\MasterWorkerCommissionNotice;
|
|
|
+use app\common\lists\ListsSearchInterface;
|
|
|
+use think\facade\Db;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * MasterWorkerCommissionNotice列表
|
|
|
+ * Class MasterWorkerCommissionNoticeLists
|
|
|
+ * @package app\adminapi\lists
|
|
|
+ */
|
|
|
+class MasterWorkerCommissionNoticeLists extends BaseAdminDataLists implements ListsSearchInterface
|
|
|
+{
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @notes 设置搜索条件
|
|
|
+ * @return \string[][]
|
|
|
+ * @author likeadmin
|
|
|
+ * @date 2024/12/16 17:37
|
|
|
+ */
|
|
|
+ public function setSearch(): array
|
|
|
+ {
|
|
|
+ return [
|
|
|
+ '=' => ['commission_config_id', 'master_worker_id', 'day_num', 'order_num', 'signing_date', 'signing_date_end'],
|
|
|
+ 'like' => ['worker_number%', 'real_name%', 'mobile%'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @notes 获取列表
|
|
|
+ * @return array
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ * @author likeadmin
|
|
|
+ * @date 2024/12/16 17:37
|
|
|
+ */
|
|
|
+ public function lists(): array
|
|
|
+ {
|
|
|
+ return Db::name('master_worker_commission_notice')->alias('n')
|
|
|
+ ->leftJoin('service_work sw', 'n.master_worker_id = sw.master_worker_id AND sw.create_time >= n.signing_date AND sw.create_time <= n.signing_date_end')
|
|
|
+ ->leftJoin('master_worker mw', 'n.master_worker_id = mw.id')
|
|
|
+ ->field([
|
|
|
+ 'n.id', 'n.commission_config_id', 'n.master_worker_id', 'n.day_num', 'n.order_num', 'n.signing_date', 'n.signing_date_end',
|
|
|
+ 'mw.real_name', 'mw.nickname', 'mw.worker_number', 'mw.mobile',
|
|
|
+ Db::raw("COUNT(sw.id) AS order_count"),
|
|
|
+ Db::raw("MAX(sw.finished_time) max_time")
|
|
|
+ ])
|
|
|
+ ->where($this->searchWhere)
|
|
|
+ ->group('n.master_worker_id, n.id')
|
|
|
+ ->limit($this->limitOffset, $this->limitLength)
|
|
|
+ ->select()->toArray();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @notes 获取数量
|
|
|
+ * @return int
|
|
|
+ * @author likeadmin
|
|
|
+ * @date 2024/12/16 17:37
|
|
|
+ */
|
|
|
+ public function count(): int
|
|
|
+ {
|
|
|
+ return Db::name('master_worker_commission_notice')->alias('n')
|
|
|
+ ->with('masterWorker')
|
|
|
+ ->leftJoin('service_work sw', 'n.master_worker_id = sw.master_worker_id AND sw.create_time >= n.signing_date AND sw.create_time <= n.signing_date_end')
|
|
|
+ ->field([
|
|
|
+ 'n.id', 'n.commission_config_id', 'n.master_worker_id', 'n.day_num', 'n.order_num', 'n.signing_date', 'n.signing_date_end',
|
|
|
+ Db::raw("COUNT(sw.id) AS order_count"),
|
|
|
+ Db::raw("MAX(sw.finished_time) max_time")
|
|
|
+ ])
|
|
|
+ ->where($this->searchWhere)
|
|
|
+ ->group('n.master_worker_id, n.id')
|
|
|
+ ->count();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|