修复任务列表多条件搜索 or、 and 联合查询的语法错误
This commit is contained in:
parent
0ff2d82126
commit
95596fea5b
@ -15,6 +15,7 @@ class ProjectDocument extends Model
|
|||||||
//列表
|
//列表
|
||||||
function list($param) {
|
function list($param) {
|
||||||
$where = array();
|
$where = array();
|
||||||
|
$whereOr = array();
|
||||||
$map1 = [];
|
$map1 = [];
|
||||||
$map2 = [];
|
$map2 = [];
|
||||||
if (!empty($param['project_id'])) {
|
if (!empty($param['project_id'])) {
|
||||||
@ -23,13 +24,13 @@ class ProjectDocument extends Model
|
|||||||
$project_ids = Db::name('ProjectUser')->where(['uid' => $param['uid'], 'delete_time' => 0])->column('project_id');
|
$project_ids = Db::name('ProjectUser')->where(['uid' => $param['uid'], 'delete_time' => 0])->column('project_id');
|
||||||
$map1[] = ['admin_id', '=', $param['uid']];
|
$map1[] = ['admin_id', '=', $param['uid']];
|
||||||
$map2[] = ['project_id', 'in', $project_ids];
|
$map2[] = ['project_id', 'in', $project_ids];
|
||||||
|
$whereOr =[$map1,$map2];
|
||||||
}
|
}
|
||||||
if (!empty($param['keywords'])) {
|
if (!empty($param['keywords'])) {
|
||||||
$where[] = ['title|content', 'like', '%' . $param['keywords'] . '%'];
|
$where[] = ['title|content', 'like', '%' . $param['keywords'] . '%'];
|
||||||
}
|
}
|
||||||
$where[] = ['delete_time', '=', 0];
|
$where[] = ['delete_time', '=', 0];
|
||||||
|
|
||||||
$whereOr =[$map1,$map2];
|
|
||||||
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
|
||||||
$list = Db::name('ProjectDocument')
|
$list = Db::name('ProjectDocument')
|
||||||
->where(function ($query) use ($whereOr) {
|
->where(function ($query) use ($whereOr) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user