if(id != null){
whereSQL.append("id = "+id).append(" and ");
}else if(mobile != null){
whereSQL.append("mobile = "+mobile).append(" and ");
}else if(agentsName != null){
whereSQL.append("agentsName = "+agentsName).append(" and ");
}else if(id != null){
whereSQL.append("userId = "+userId).append(" and ");
}else if(id != null){
whereSQL.append("invitationCode = "+invitationCode).append(" and ");
}else if(id != null){
whereSQL.append("agentType = "+agentType).append(" and ");
}else if(id != null){
whereSQL.append("del = "+del).append(" and ");
}else if(id != null){
whereSQL.append("areaIds = "+areaIds).append(" and ");
}
你是不是写错了 一堆id != null
switch-case应该可以
简单的 就用 转 map 然后 for循环
先判断不成立的条件
if(id==null){
return null,
}
if......
起码分开了,不用粘一起
还有你那样写有SQL注入风险