我需要在java spring中执行预构建的SQL查询,我创建的查询如下,
String query = "select * from device where";
if (status != null) {
query += " status = "+status;
}
if (cinema != "") {
query += " and cinema_code = \'"+cinema+"\'";
}
if (content_profile != "") {
query += " and content_profile = \'"+content_profile+"\'";
}
if (mac != "") {
query += " and mac = \'"+mac+"\'";
}
构建查询:
select *
from device
where status = 2
and cinema_code = 'AL10'
and content_profile = 'signage'
潇湘沐
犯罪嫌疑人X
30秒到达战场
相关分类