fastadmin FIND_IN_SET查询

时间:2021-04-10

fastadmin 使用FIND_IN_SET 查询。

$map=[];
$map2 = '';
 if (!empty($book_id)) {
      $map2 = 'FIND_IN_SET("' . $book_id . '",book_ids)';
}
 $list = $log->where($map)
            ->where($map2)
            ->select();

示例一

Db::table('think_user')
    ->where('find_in_set(1,sids)')
    ->select();

示例二

Db::table('think_user')
    ->where('find_in_set(:id,sids)',['id'=>$id])
    ->select();