多条件查询

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_41713836/article/details/89679145

$where['pname|thing_name|pcode|c.pid'] = ['like','%'.$filter['pname'].'%'];


 $data = input('param.');

      $whereDate = [];

      // 转换条件查询
      if (!empty($data['start_time']) && !empty($data['end_time']) && $data['end_time'] > $data['start_time']) {
        
        $whereDate['created'] = [
                ['gt',strtotime($data['start_time'])],
                ['lt',strtotime($data['end_time'])],
        ];

      }

      if (!empty($data['filter'])) {
        $whereDate['hcode|hname'] = ['like','%'.$data['filter'].'%'];
      }

      if(!empty($data['hstate'])){
        $whereDate['hstate'] = ['like','%'.$data['hstate'].'%'];
      }

      return $this->fetch('',[

              'list' => $list,
              'listRows' => $listRows,
              'currentPage' => $currentPage,
              'page'=> $page,
              'hstate' => $hstate,
              'start_time' => empty($data['start_time']) ? '' : $data['start_time'],
              'end_time' => empty($data['end_time']) ? '' : $data['end_time'],
              'filter' => empty($data['filter']) ? '' : $data['filter'],
              'hstate' => empty($data['hstate']) ?  '' : $data['hstate'],

        ]);
    }

展开阅读全文

没有更多推荐了,返回首页