[{"互联网":["网络媒体","微博","墨迹天气","河北天气","其他"]},{"气象部门":["灾害大典","灾情普查","灾情直报","其他"]}]
**.java文件
if(StringUtil.isNotEmpty(dataSource)){
if(dataSource.equals("互联网")){
sql_dataSource = " AND 数据来源 = '互联网' ";
if(StringUtil.isNotEmpty(infoSource)){
//infoSource = infoSource.replaceAll(" +", ""); //去除字符串空格
if(infoSource.equals("其他")){
//like 模糊查询
sql_infoSource = " AND 信息来源 not like '网络媒体' and 信息来源 not like '%微博%' and 信息来源 not like '墨迹天气' and 信息来源 not like '河北天气' ";
} else{
sql_infoSource = " AND 信息来源 like '%"+ infoSource +"%' ";
}
}
}else if(dataSource.equals("气象部门")){
sql_dataSource = " AND 数据来源 = '气象部门' ";
if(StringUtil.isNotEmpty(infoSource)){
if(infoSource.equals("其他")){
//in
sql_infoSource = " AND 信息来源 not in "+ "("+"'灾害大典'"+","+"'灾情直报'"+","+"'灾情普查'"+") ";
}else{
sql_infoSource = " AND 信息来源 = '" + infoSource +"' ";
}
}
}else{
sql_dataSource = " AND 数据来源 = '" + dataSource +"' ";
if(StringUtil.isNotEmpty(infoSource)){
sql_infoSource = " AND 信息来源 = '" + infoSource +"' ";
}
}
}
参考:
SQL模糊查询条件的四种匹配模式https://www.cnblogs.com/LoveSuk/p/6672768.html