12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- /**
- *
- *User:Administrator
- *Date:2021/10/13
- */
- namespace app\api\model;
- use think\Collection;
- use think\Model;
- class Undertake extends Model
- {
- public function insert(array $data = [], bool $getLastInsID = false)
- {
- return parent::insert($data, $getLastInsID); // TODO: Change the autogenerated stub
- }
- public function deleteInfoByID($id_arr)
- {
- return $this->select($id_arr)->delete();
- }
- //获取抽样任务列表
- public function selectByTaskIdAndWhere($task_id, $where='',$pageNum=1,$pageSize=null)
- {
- if ($task_id == '' || $where == '') {
- return false;
- }
- return $this->where([
- ['task_id', '=', $task_id],
- [$where]
- ])
- ->page($pageNum,$pageSize)
- ->select();
- }
- //获取抽样任务列表数量
- public function countByTaskIdAndWhere($task_id, $where='')
- {
- if ($task_id == '' || $where == '') {
- return false;
- }
- return $this->where([
- ['task_id', '=', $task_id],
- [$where]
- ])
- ->count();
- }
- public function selectTaskListByTaskIdAndUid($task_id,$unit_id='',$bear_id='',$report_id='',$pageNum=1,$pageSize=null)
- {
- $where=[
- ['task_id', '=', $task_id],
- ];
- if ($unit_id!='') {
- array_push($where, ['unit_id', '=', $unit_id]);
- }
- if ($bear_id!='') {
- array_push($where, ['bear_id', '=', $bear_id]);
- }
- if ($report_id!='') {
- array_push($where,['report_id', '=', $report_id]);
- }
- return $this->where($where)->page($pageNum,$pageSize)->select();
- }
- public function countTaskListByTaskIdAndUid($task_id,$unit_id='',$bear_id='',$report_id='')
- {
- $where=[
- ['task_id', '=', $task_id],
- ];
- if ($unit_id != '') {
- array_push($where, ['unit_id', '=', $unit_id]);
- }
- if ($bear_id != '') {
- array_push($where, ['bear_id', '=', $bear_id]);
- }
- if ($report_id != '') {
- array_push($where,['report_id', '=', $report_id]);
- }
- return $this->where($where)->count();
- }
- }
|