= '{$startDate}' and IFNULL(`office_date`, `applydt`) <= '{$stopDate}'"; $where .= " and DATE_FORMAT(`office_date`,'%Y-%m-%d') >= '{$startDate}' and DATE_FORMAT(`office_date`,'%Y-%m-%d') <= '{$stopDate}'"; } if (isset($whereArr['status']) && $whereArr['status'] == 1) { $where .= " and `status` = 1"; } if (isset($whereArr['export_type']) && $whereArr['export_type'] != 0) { $where .= " and `seal_name` = '".$whereArr['export_type']."'"; } $list = m("sealapl") ->getall($where, "*", "substr(applydt, 1, 4) desc, id asc"); return $list; } }