ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
组装查询条件条件  注意这里store\_ids是数组格式 ``` if(isset($params['store_ids'])&&!empty($params['store_ids'])) { $store_ids=$params['store_ids']; $sql_where=''; foreach($store_ids as $v){ $sql_where .= "FIND_IN_SET('{$v}',t1.store_ids) or "; } $sql_where = rtrim($sql_where," or "); $map=Db::raw($sql_where); $where[]=['','exp',$map]; } ``` 查询关联语句 ``` `public``function``getStoreGuidePlanList(``$where``=[],``$page``,``$limit``)` `{` `$result``=``$this``->db->name(``'store_guide_plan'``)` `->alias(``'t1'``)` `->field(``'t1.plan_id,t1.plan_name,t1.status,t1.store_ids,GROUP_CONCAT(t2.store_name) store_name,t1.create_time'``)` `->leftJoin(``'store t2'``,``'FIND_IN_SET(t2.store_id,t1.store_ids)'``)` `->where(``'t1.delete_time'``,0)` `->where(``$where``)` `->order([``'t1.plan_id'``=>``'desc'``])` `->group(``'t1.plan_id'``);` `$result``->page(``$page``,``$limit``);` `$count``=``$result``->``count``();` `$list``=``$result``->select()->toArray();` `return``compact(``'list'``,``'count'``);` `}` ```