if(!(isInvalid(strwhere)))是什么意思啊大佬们

qq_43343356 2020-06-17 04:26:11
if(!(isInvalid(strwhere)))
{
sql+=" where "+strwhere;
}
if(!(isInvalid(strorder)))
{
sql+=" order by "+strorder;
}
Statement stat = null;
ResultSet rs = null;
Connection conn = new DBHelper().getConn();
List<AdminBean> list=new ArrayList<AdminBean>();
try{
stat = conn.createStatement();
rs = stat.executeQuery(sql);
while(rs.next()){
AdminBean cnbean=new AdminBean();
cnbean.setAdmin_ID(rs.getInt("Admin_ID"));
cnbean.setAdmin_Username(rs.getString("Admin_Username"));
cnbean.setAdmin_Password(rs.getString("Admin_Password"));
cnbean.setAdmin_Name(rs.getString("Admin_Name"));
cnbean.setAdmin_Sex(rs.getString("Admin_Sex"));
cnbean.setAdmin_Tel(rs.getString("Admin_Tel"));
list.add(cnbean);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (conn != null)
conn.close();
if (stat != null)
stat.close();
if (rs != null)
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
return list;
}
开头的f(!(isInvalid(strwhere)))是什么意思啊大佬们,小白真的不懂了求救
...全文
3024 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
代码间的舞者 2020-06-28
  • 打赏
  • 举报
回复

public static boolean isInvalid(Object s){
    	if(s==null||"".equals(s)){
    		return true;
    	}
    	return false;
    }
xuyiziyong 2020-06-19
  • 打赏
  • 举报
回复
if(!(isInvalid(strwhere))) if是判断语句 isInvalid是方法返回boolean值,参数应该是字符串 strwhere 没猜错的话这应该是字符串吧,是上面方法的实参 题外话,如果你这是工作中遇到的问题,那么,我建议你可以换个职位做做,比如测试之类的。
锦秀北里 2020-06-17
  • 打赏
  • 举报
回复
参数无效的话,不走if里面,有效的话,走if里面
weixin_40290083 2020-06-17
  • 打赏
  • 举报
回复
isInvalid应当是个自定义的方法吧,看方法名就是判断参数是否已失效,结合代码上下文当失效时返回为true,未失效时返回为true. 代码就是判断是否包含where和order by条件。
dkwuxiang 2020-06-17
  • 打赏
  • 举报
回复
如果编译能通过 isInvalid(strwhere) 返回的应该是 true 或者 false 然后取反; 意思就是当 isInvalid(strwhere) 返回false的时候 进入 if 代码块

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧