|
|
@@ -49,6 +49,36 @@ class Department extends Controller
|
|
|
return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $result]);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 所有部门
|
|
|
+ * @author 唐远望
|
|
|
+ * @version 1.0
|
|
|
+ * @date 2025-12-08
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function all(DepartmentModel $DepartmentModel)
|
|
|
+ {
|
|
|
+ $map = [];
|
|
|
+ $status = request('status', '');
|
|
|
+ $start_time = request('start_time', '');
|
|
|
+ $end_time = request('end_time', '');
|
|
|
+ $name = request('name', '');
|
|
|
+ // 时间条件
|
|
|
+ if ($start_time) $map[] = ['insert_time', '>=', strtotime($start_time)];
|
|
|
+ if ($end_time) $map[] = ['insert_time', '<=', strtotime($end_time)];
|
|
|
+ // 其他条件
|
|
|
+ if ($status) $map[] = ['status', '=', $status];
|
|
|
+ if ($name) $map[] = ['name', 'like', "%$name%"];
|
|
|
+ $result = $DepartmentModel->query()
|
|
|
+ ->where($map)
|
|
|
+ ->orderByDesc('id')
|
|
|
+ ->get();
|
|
|
+ // 分配数据
|
|
|
+ if (!$result) return json_send(['code' => 'error', 'msg' => '暂无数据']);
|
|
|
+ // 加载模板
|
|
|
+ return json_send(['code' => 'success', 'msg' => '获取成功', 'data' => $result]);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 详情
|
|
|
* @author 唐远望
|