Realize the if judgment of where of mysql

how to realize the if judgment of mysql. There is now a table with two key fields
SELECT * FROM house WHERE price="8500" OR shoufu="30"
I think, when the $price passed in by php is empty, the sql search statement is
SELECT * FROM house WHERE shoufu="30"
when the $shoufu passed by php is empty, the sql search statement is
SELECT * FROM house WHERE price="8500"
it is not possible to judge with or. I want to use if to judge
. In addition, I would like to ask how to implement if else sql sentence judgment

in thinkphp5 in where.
Mar.07,2021

$map = [];
if(!empty($price))
{
    $map['price'] = $price;
}
if(!empty($shoufu))
{
    $map['shoufu'] = $shoufu;
}
Db::table('xxxxx')->where($map)->select(); 
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e7b747-85a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e7b747-85a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?