
请交格位大神, 想这种的组合查询怎么做在
String sql = "select * from table t where 1=1 ";
if(部门!=null&&!部门.equals("")){
sql += " and t.部门 = " + 部门; //记得varchar加单引号:" and t.部门 = '" + 部门+"'";
}
if 性别 .... if ...
String sql = "select * from table t where 1=1 ";
if(部门!=null&&!部门.equals("")){
sql += " and t.部门 = " + 部门; //记得varchar加单引号:" and t.部门 = '" + 部门+"'";
}
if 性别 .... if ...